diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /dom/webgpu/Texture.cpp | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-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/Texture.cpp')
-rw-r--r-- | dom/webgpu/Texture.cpp | 18 |
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()); } } |