diff --git a/dom/base/nsCCUncollectableMarker.cpp b/dom/base/nsCCUncollectableMarker.cpp index 2b97003233d8..96baf5eb7855 100644 --- a/dom/base/nsCCUncollectableMarker.cpp +++ b/dom/base/nsCCUncollectableMarker.cpp @@ -169,8 +169,8 @@ MarkMessageManagers() if (nsFrameMessageManager::sSameProcessParentManager) { nsFrameMessageManager::sSameProcessParentManager->MarkForCC(); } - if (nsFrameMessageManager::sChildProcessManager) { - nsFrameMessageManager::sChildProcessManager->MarkForCC(); + if (nsFrameMessageManager::GetChildProcessManager()) { + nsFrameMessageManager::GetChildProcessManager()->MarkForCC(); } } diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp index f983cee42bf6..86fc597badfe 100644 --- a/dom/base/nsFrameMessageManager.cpp +++ b/dom/base/nsFrameMessageManager.cpp @@ -1656,7 +1656,7 @@ public: NS_IMETHOD Run() { - nsFrameMessageManager* ppm = nsFrameMessageManager::sChildProcessManager; + nsFrameMessageManager* ppm = nsFrameMessageManager::GetChildProcessManager(); ReceiveMessage(static_cast(ppm), ppm); return NS_OK; } @@ -1920,7 +1920,7 @@ nsFrameMessageManager::NewProcessMessageManager(mozilla::dom::nsIContentParent* nsresult NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult) { - NS_ASSERTION(!nsFrameMessageManager::sChildProcessManager, + NS_ASSERTION(!nsFrameMessageManager::GetChildProcessManager(), "Re-creating sChildProcessManager"); MessageManagerCallback* cb; @@ -1933,7 +1933,7 @@ NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult) nsFrameMessageManager* mm = new nsFrameMessageManager(cb, nullptr, MM_PROCESSMANAGER | MM_OWNSCALLBACK); - nsFrameMessageManager::sChildProcessManager = mm; + nsFrameMessageManager::SetChildProcessManager(mm); return CallQueryInterface(mm, aResult); } diff --git a/dom/base/nsFrameMessageManager.h b/dom/base/nsFrameMessageManager.h index 366f7b1d5ef4..59fb3ecacc6a 100644 --- a/dom/base/nsFrameMessageManager.h +++ b/dom/base/nsFrameMessageManager.h @@ -274,6 +274,10 @@ public: { return sChildProcessManager; } + static void SetChildProcessManager(nsFrameMessageManager* aManager) + { + sChildProcessManager = aManager; + } private: nsresult SendMessage(const nsAString& aMessageName, JS::Handle aJSON, @@ -307,10 +311,10 @@ protected: nsFrameMessageManager* aChildMM); public: static nsFrameMessageManager* sParentProcessManager; - static nsFrameMessageManager* sChildProcessManager; static nsFrameMessageManager* sSameProcessParentManager; static nsTArray >* sPendingSameProcessAsyncMessages; private: + static nsFrameMessageManager* sChildProcessManager; enum ProcessCheckerType { PROCESS_CHECKER_PERMISSION, PROCESS_CHECKER_MANIFEST_URL, diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index d91b2f787be1..4cf538d6e5e9 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -1919,7 +1919,7 @@ ContentChild::RecvAsyncMessage(const nsString& aMsg, InfallibleTArray&& aCpows, const IPC::Principal& aPrincipal) { - nsRefPtr cpm = nsFrameMessageManager::sChildProcessManager; + nsRefPtr cpm = nsFrameMessageManager::GetChildProcessManager(); if (cpm) { StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForChild(aData); CrossProcessCpowHolder cpows(this, aCpows); diff --git a/dom/ipc/nsIContentChild.cpp b/dom/ipc/nsIContentChild.cpp index 25acddea2932..929ea9490faa 100644 --- a/dom/ipc/nsIContentChild.cpp +++ b/dom/ipc/nsIContentChild.cpp @@ -113,7 +113,7 @@ nsIContentChild::RecvAsyncMessage(const nsString& aMsg, InfallibleTArray&& aCpows, const IPC::Principal& aPrincipal) { - nsRefPtr cpm = nsFrameMessageManager::sChildProcessManager; + nsRefPtr cpm = nsFrameMessageManager::GetChildProcessManager(); if (cpm) { StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForChild(aData); CrossProcessCpowHolder cpows(this, aCpows);