From 48efee8e29a824c290f03f202324cbabab132344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 9 Mar 2023 10:22:35 +0000 Subject: [PATCH] Bug 1820280 - Don't proxy some principal destruction to the main thread. r=dshin Drive-by, but nsIPrincipal is thread-safe now. Differential Revision: https://phabricator.services.mozilla.com/D171642 --- gfx/thebes/gfxFontSrcPrincipal.cpp | 8 +------- gfx/thebes/gfxFontSrcPrincipal.h | 5 +++-- layout/style/URLExtraData.cpp | 7 +------ 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/gfx/thebes/gfxFontSrcPrincipal.cpp b/gfx/thebes/gfxFontSrcPrincipal.cpp index 3e4c2b9ef342..97ddc5ffe7fd 100644 --- a/gfx/thebes/gfxFontSrcPrincipal.cpp +++ b/gfx/thebes/gfxFontSrcPrincipal.cpp @@ -5,7 +5,6 @@ #include "gfxFontSrcPrincipal.h" -#include "nsProxyRelease.h" #include "nsURIHashKey.h" #include "mozilla/BasePrincipal.h" #include "mozilla/HashFunctions.h" @@ -29,12 +28,7 @@ gfxFontSrcPrincipal::gfxFontSrcPrincipal(nsIPrincipal* aNodePrincipal, mozilla::HashString(suffix)); } -gfxFontSrcPrincipal::~gfxFontSrcPrincipal() { - NS_ReleaseOnMainThread("gfxFontSrcPrincipal::mNodePrincipal", - mNodePrincipal.forget()); - NS_ReleaseOnMainThread("gfxFontSrcPrincipal::mStoragePrincipal", - mStoragePrincipal.forget()); -} +gfxFontSrcPrincipal::~gfxFontSrcPrincipal() = default; bool gfxFontSrcPrincipal::Equals(gfxFontSrcPrincipal* aOther) { return BasePrincipal::Cast(mStoragePrincipal) diff --git a/gfx/thebes/gfxFontSrcPrincipal.h b/gfx/thebes/gfxFontSrcPrincipal.h index 406d26915d4d..44170701a16f 100644 --- a/gfx/thebes/gfxFontSrcPrincipal.h +++ b/gfx/thebes/gfxFontSrcPrincipal.h @@ -20,6 +20,9 @@ class nsSimpleURI; /** * A wrapper for an nsIPrincipal that can be used OMT, which has cached * information useful for the gfxUserFontSet. + * + * TODO(emilio): This has grown a bit more complex, but nsIPrincipal is now + * thread-safe, re-evaluate the existence of this class. */ class gfxFontSrcPrincipal { public: @@ -28,8 +31,6 @@ class gfxFontSrcPrincipal { NS_INLINE_DECL_THREADSAFE_REFCOUNTING(gfxFontSrcPrincipal) - nsIPrincipal* get() const { return NodePrincipal(); } - nsIPrincipal* NodePrincipal() const { return mNodePrincipal; } nsIPrincipal* StoragePrincipal() const { return mStoragePrincipal; } diff --git a/layout/style/URLExtraData.cpp b/layout/style/URLExtraData.cpp index 111c9ecb57ed..0e7299b392d6 100644 --- a/layout/style/URLExtraData.cpp +++ b/layout/style/URLExtraData.cpp @@ -9,7 +9,6 @@ #include "mozilla/URLExtraData.h" #include "mozilla/NullPrincipal.h" -#include "nsProxyRelease.h" #include "ReferrerInfo.h" namespace mozilla { @@ -36,11 +35,7 @@ void URLExtraData::Shutdown() { sDummyChrome = nullptr; } -URLExtraData::~URLExtraData() { - if (!NS_IsMainThread()) { - NS_ReleaseOnMainThread("URLExtraData::mPrincipal", mPrincipal.forget()); - } -} +URLExtraData::~URLExtraData() = default; StaticRefPtr URLExtraData::sShared[size_t(UserAgentStyleSheetID::Count)];