Bug 1917652 Part 2: Explicitly define AddRef and Release in VideoBridgeParent. r=aosmond

This change prevents VideoBridgeParent from being incorrectly reported
as leaked memory. Something about the logging used by the previous macro
confuses the leakchecker. Appropriate deallocation was confirmed by
creating manual implementations of AddRef and Release and the various
Actor lifecyle methods (not part of this patch). The change to this new
approach does the same work as the old macro, minus the conditional
logging of the old macro.

Differential Revision: https://phabricator.services.mozilla.com/D222715
This commit is contained in:
Brad Werth 2024-10-10 18:39:02 +00:00
parent 842297cee4
commit f470faee03
2 changed files with 5 additions and 1 deletions

View File

@ -21,6 +21,9 @@ using namespace mozilla::gfx;
using VideoBridgeTable = EnumeratedArray<VideoBridgeSource, VideoBridgeParent*,
size_t(VideoBridgeSource::_Count)>;
NS_IMPL_NONLOGGING_ADDREF_INHERITED(VideoBridgeParent, HostIPCAllocator)
NS_IMPL_NONLOGGING_RELEASE_INHERITED(VideoBridgeParent, HostIPCAllocator)
static StaticDataMutex<VideoBridgeTable> sVideoBridgeFromProcess(
"VideoBridges");
static Atomic<bool> sVideoBridgeParentShutDown(false);

View File

@ -20,7 +20,8 @@ class VideoBridgeParent final : public PVideoBridgeParent,
public HostIPCAllocator,
public mozilla::ipc::IShmemAllocator {
public:
NS_INLINE_DECL_REFCOUNTING_INHERITED(VideoBridgeParent, HostIPCAllocator)
NS_IMETHODIMP_(MozExternalRefCountType) AddRef(void) override;
NS_IMETHODIMP_(MozExternalRefCountType) Release(void) override;
static RefPtr<VideoBridgeParent> GetSingleton(
const Maybe<VideoBridgeSource>& aSource);