summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/Texture.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /dom/webgpu/Texture.cpp
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-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/Texture.cpp')
-rw-r--r--dom/webgpu/Texture.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/dom/webgpu/Texture.cpp b/dom/webgpu/Texture.cpp
index c7bc406118..82e17c51c6 100644
--- a/dom/webgpu/Texture.cpp
+++ b/dom/webgpu/Texture.cpp
@@ -46,21 +46,21 @@ Texture::Texture(Device* const aParent, RawId aId,
}
void Texture::Cleanup() {
- if (!mParent) {
+ if (!mValid) {
return;
}
+ mValid = false;
auto bridge = mParent->GetBridge();
- if (bridge && bridge->IsOpen()) {
+ if (!bridge) {
+ return;
+ }
+
+ if (bridge->CanSend()) {
bridge->SendTextureDrop(mId);
}
- // After cleanup is called, no other method should ever be called on the
- // object so we don't have to null-check mParent in other places.
- // This serves the purpose of preventing SendTextureDrop from happening
- // twice. TODO: Does it matter for breaking cycles too? Cleanup is called
- // by the macros that deal with cycle colleciton.
- mParent = nullptr;
+ wgpu_client_free_texture_id(bridge->GetClient(), mId);
}
Texture::~Texture() { Cleanup(); }
@@ -113,7 +113,7 @@ already_AddRefed<TextureView> Texture::CreateView(
void Texture::Destroy() {
auto bridge = mParent->GetBridge();
- if (bridge && bridge->IsOpen()) {
+ if (bridge && bridge->CanSend()) {
bridge->SendTextureDestroy(mId, mParent->GetId());
}
}