summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/Buffer.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /dom/webgpu/Buffer.cpp
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 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.cpp18
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,