Commit 611c3506 authored by Jinho Bang's avatar Jinho Bang Committed by Commit Bot

WebGPU: Should reject with an OperationError if GPUDevice is lost

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] https://github.com/gpuweb/gpuweb/pull/433

Bug: 852089
Change-Id: I3a80b5e741e1ea831fd92aa2eb3dcdafd6bc740e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1898891Reviewed-by: default avatarAustin Eng <enga@chromium.org>
Reviewed-by: default avatarCorentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712587}
parent 77d532c2
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment