Skip to content

Commit

Permalink
WebGPU: Should reject with an OperationError if GPUDevice is lost
Browse files Browse the repository at this point in the history
The popErrorScope() was changed to reject with an OperationError if the
GPUDevice is lost[1]. So, this patch matches up with the spec. Also,
although the spec doesn't mention it yet, we should make it throw an
OperationError for all cases where the device is lost.

[1] gpuweb/gpuweb#433

Bug: 852089
Change-Id: I3a80b5e741e1ea831fd92aa2eb3dcdafd6bc740e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1898891
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712587}
  • Loading branch information
romandev authored and Commit Bot committed Nov 5, 2019
1 parent 77d532c commit 611c350
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
7 changes: 2 additions & 5 deletions third_party/blink/renderer/modules/webgpu/gpu_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,10 @@ void GPUBuffer::OnMapAsyncCallback(ScriptPromiseResolver* resolver,
resolver->Resolve(mapped_buffer_);
break;
case WGPUBufferMapAsyncStatus_Error:
resolver->Reject(MakeGarbageCollected<DOMException>(
DOMExceptionCode::kOperationError));
break;
case WGPUBufferMapAsyncStatus_Unknown:
case WGPUBufferMapAsyncStatus_DeviceLost:
resolver->Reject(
MakeGarbageCollected<DOMException>(DOMExceptionCode::kAbortError));
resolver->Reject(MakeGarbageCollected<DOMException>(
DOMExceptionCode::kOperationError));
break;
default:
NOTREACHED();
Expand Down
4 changes: 2 additions & 2 deletions third_party/blink/renderer/modules/webgpu/gpu_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ void GPUDevice::OnPopErrorScopeCallback(ScriptPromiseResolver* resolver,
break;
case WGPUErrorType_Unknown:
case WGPUErrorType_DeviceLost:
resolver->Reject(
MakeGarbageCollected<DOMException>(DOMExceptionCode::kAbortError));
resolver->Reject(MakeGarbageCollected<DOMException>(
DOMExceptionCode::kOperationError));
break;
default:
NOTREACHED();
Expand Down
7 changes: 2 additions & 5 deletions third_party/blink/renderer/modules/webgpu/gpu_fence.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,10 @@ void GPUFence::OnCompletionCallback(ScriptPromiseResolver* resolver,
resolver->Resolve();
break;
case WGPUFenceCompletionStatus_Error:
resolver->Reject(MakeGarbageCollected<DOMException>(
DOMExceptionCode::kOperationError));
break;
case WGPUFenceCompletionStatus_Unknown:
case WGPUFenceCompletionStatus_DeviceLost:
resolver->Reject(
MakeGarbageCollected<DOMException>(DOMExceptionCode::kAbortError));
resolver->Reject(MakeGarbageCollected<DOMException>(
DOMExceptionCode::kOperationError));
break;
default:
NOTREACHED();
Expand Down

0 comments on commit 611c350

Please sign in to comment.