From 817005681783124ff41166ff8cd39a45f017d532 Mon Sep 17 00:00:00 2001 From: Andrew Osmond Date: Wed, 9 Feb 2022 22:01:48 +0000 Subject: [PATCH] Bug 1754302 - WebGPU should consistently use GetCurrentSerialEventTarget instead of GetMainThreadSerialEventTarget. r=kvark This is necessary for when WebGPU objects are accessed from a worker thread instead of the main thread. It should be otherwise a non-functional change. Differential Revision: https://phabricator.services.mozilla.com/D138206 --- dom/webgpu/Buffer.cpp | 2 +- dom/webgpu/Device.cpp | 6 +++--- dom/webgpu/Instance.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dom/webgpu/Buffer.cpp b/dom/webgpu/Buffer.cpp index 4855988f1a8e..e6e76e06cac4 100644 --- a/dom/webgpu/Buffer.cpp +++ b/dom/webgpu/Buffer.cpp @@ -114,7 +114,7 @@ already_AddRefed Buffer::MapAsync( } mappingPromise->Then( - GetMainThreadSerialEventTarget(), __func__, + GetCurrentSerialEventTarget(), __func__, [promise, self](ipc::Shmem&& aShmem) { self->mMapped->mShmem = std::move(aShmem); promise->MaybeResolve(0); diff --git a/dom/webgpu/Device.cpp b/dom/webgpu/Device.cpp index 21641b3fde47..173128ae65de 100644 --- a/dom/webgpu/Device.cpp +++ b/dom/webgpu/Device.cpp @@ -247,7 +247,7 @@ already_AddRefed Device::CreateComputePipelineAsync( context->mParentId = mId; mBridge->DeviceCreateComputePipelineAsync(context.get(), aDesc) ->Then( - GetMainThreadSerialEventTarget(), __func__, + GetCurrentSerialEventTarget(), __func__, [self = RefPtr{this}, context, promise](RawId aId) { RefPtr object = new ComputePipeline( self, aId, context->mImplicitPipelineLayoutId, @@ -274,7 +274,7 @@ already_AddRefed Device::CreateRenderPipelineAsync( context->mParentId = mId; mBridge->DeviceCreateRenderPipelineAsync(context.get(), aDesc) ->Then( - GetMainThreadSerialEventTarget(), __func__, + GetCurrentSerialEventTarget(), __func__, [self = RefPtr{this}, context, promise](RawId aId) { RefPtr object = new RenderPipeline( self, aId, context->mImplicitPipelineLayoutId, @@ -351,7 +351,7 @@ already_AddRefed Device::PopErrorScope(ErrorResult& aRv) { auto errorPromise = mBridge->SendDevicePopErrorScope(mId); errorPromise->Then( - GetMainThreadSerialEventTarget(), __func__, + GetCurrentSerialEventTarget(), __func__, [self = RefPtr{this}, promise](const MaybeScopedError& aMaybeError) { if (aMaybeError) { if (aMaybeError->operationError) { diff --git a/dom/webgpu/Instance.cpp b/dom/webgpu/Instance.cpp index 07c91d20d1b2..9b22c439b7ba 100644 --- a/dom/webgpu/Instance.cpp +++ b/dom/webgpu/Instance.cpp @@ -60,7 +60,7 @@ already_AddRefed Instance::RequestAdapter( RefPtr instance = this; mBridge->InstanceRequestAdapter(aOptions)->Then( - GetMainThreadSerialEventTarget(), __func__, + GetCurrentSerialEventTarget(), __func__, [promise, instance](ipc::ByteBuf aInfoBuf) { ffi::WGPUAdapterInformation info = {}; ffi::wgpu_client_adapter_extract_info(ToFFI(&aInfoBuf), &info);