diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /dom/webgpu/Buffer.cpp | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/webgpu/Buffer.cpp')
-rw-r--r-- | dom/webgpu/Buffer.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/dom/webgpu/Buffer.cpp b/dom/webgpu/Buffer.cpp index b7b689a9a0..3bd1353e69 100644 --- a/dom/webgpu/Buffer.cpp +++ b/dom/webgpu/Buffer.cpp @@ -24,7 +24,7 @@ GPU_IMPL_JS_WRAP(Buffer) NS_IMPL_CYCLE_COLLECTION_CLASS(Buffer) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Buffer) - tmp->Drop(); + tmp->Cleanup(); NS_IMPL_CYCLE_COLLECTION_UNLINK(mParent) NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_UNLINK_END @@ -51,7 +51,7 @@ Buffer::Buffer(Device* const aParent, RawId aId, BufferAddress aSize, } Buffer::~Buffer() { - Drop(); + Cleanup(); mozilla::DropJSObjects(this); } @@ -136,11 +136,10 @@ already_AddRefed<Buffer> Buffer::Create(Device* aDevice, RawId aDeviceId, return buffer.forget(); } -void Buffer::Drop() { +void Buffer::Cleanup() { if (!mValid) { return; } - mValid = false; AbortMapRequest(); @@ -158,9 +157,16 @@ void Buffer::Drop() { GetDevice().UntrackBuffer(this); - if (GetDevice().IsBridgeAlive()) { - GetDevice().GetBridge()->SendBufferDrop(mId); + auto bridge = GetDevice().GetBridge(); + if (!bridge) { + return; } + + if (bridge->CanSend()) { + bridge->SendBufferDrop(mId); + } + + wgpu_client_free_buffer_id(bridge->GetClient(), mId); } void Buffer::SetMapped(BufferAddress aOffset, BufferAddress aSize, |