From f24f2d486111293dde45cb9570686a3185e1b66d Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Fri, 5 Apr 2024 20:35:48 +0000 Subject: [PATCH] Bug 1882538 - Convert some TextureClient assertions into warnings. r=aosmond Differential Revision: https://phabricator.services.mozilla.com/D206810 --- gfx/layers/PersistentBufferProvider.cpp | 7 ++++--- gfx/layers/client/TextureClient.cpp | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/gfx/layers/PersistentBufferProvider.cpp b/gfx/layers/PersistentBufferProvider.cpp index 0e02501a4a1f..d79c8cdca108 100644 --- a/gfx/layers/PersistentBufferProvider.cpp +++ b/gfx/layers/PersistentBufferProvider.cpp @@ -663,14 +663,15 @@ PersistentBufferProviderShared::BorrowSnapshot(gfx::DrawTarget* aTarget) { if (mDrawTarget) { auto back = GetTexture(mBack); - MOZ_ASSERT(back && back->IsLocked()); + if (NS_WARN_IF(!back) || NS_WARN_IF(!back->IsLocked())) { + return nullptr; + } mSnapshot = back->BorrowSnapshot(); return do_AddRef(mSnapshot); } auto front = GetTexture(mFront); - if (!front || front->IsLocked()) { - MOZ_ASSERT(false); + if (NS_WARN_IF(!front) || NS_WARN_IF(front->IsLocked())) { return nullptr; } diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 26b583729d06..12a34ff92fa3 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -748,12 +748,10 @@ void TextureClient::ReadUnlock() { } bool TextureClient::Lock(OpenMode aMode) { - MOZ_ASSERT(IsValid()); - MOZ_ASSERT(!mIsLocked); - if (!IsValid()) { + if (NS_WARN_IF(!IsValid())) { return false; } - if (mIsLocked) { + if (NS_WARN_IF(mIsLocked)) { return mOpenMode == aMode; }