From 6bda5576a0e694470b50b62a2102b7a6837c87d1 Mon Sep 17 00:00:00 2001 From: Nika Layzell Date: Fri, 23 Nov 2018 18:01:03 -0500 Subject: [PATCH] Bug 1509591 - Part 2: Remove now-unnecessary mIPCOpen variable, r=mccr8 This should eliminate most variables which can be replaced with IPCOpen(). Differential Revision: https://phabricator.services.mozilla.com/D12957 --- dom/base/nsContentPermissionHelper.cpp | 4 +-- dom/base/nsContentPermissionHelper.h | 7 ++-- dom/ipc/ContentParent.cpp | 13 +++---- dom/ipc/ContentParent.h | 3 +- dom/ipc/ProcessHangMonitor.cpp | 32 ++++++----------- dom/ipc/TabChild.cpp | 5 --- dom/ipc/TabChild.h | 3 -- dom/ipc/URLClassifierParent.cpp | 12 ------- dom/ipc/URLClassifierParent.h | 12 ++----- dom/network/TCPServerSocketChild.cpp | 7 +--- dom/network/TCPServerSocketChild.h | 1 - dom/network/TCPServerSocketParent.cpp | 5 --- dom/network/TCPServerSocketParent.h | 1 - dom/network/TCPSocketChild.cpp | 7 +--- dom/network/TCPSocketChild.h | 1 - dom/network/TCPSocketParent.cpp | 9 ++--- dom/network/TCPSocketParent.h | 1 - dom/network/UDPSocketChild.cpp | 7 +--- dom/network/UDPSocketChild.h | 1 - dom/network/UDPSocketParent.cpp | 10 ++---- dom/network/UDPSocketParent.h | 1 - dom/storage/StorageIPC.cpp | 34 +++++++------------ dom/storage/StorageIPC.h | 7 ---- gfx/layers/client/TextureClient.cpp | 27 ++------------- gfx/layers/ipc/LayerTransactionChild.h | 10 ++---- gfx/layers/ipc/LayerTransactionParent.cpp | 7 ++-- gfx/layers/ipc/LayerTransactionParent.h | 7 ++-- gfx/layers/wr/WebRenderBridgeChild.cpp | 1 - gfx/layers/wr/WebRenderBridgeChild.h | 9 ++--- gfx/vr/ipc/VRLayerChild.cpp | 12 +------ gfx/vr/ipc/VRLayerChild.h | 2 -- gfx/vr/ipc/VRLayerParent.cpp | 11 ++---- gfx/vr/ipc/VRLayerParent.h | 4 --- netwerk/cookie/CookieServiceChild.cpp | 13 ++----- netwerk/cookie/CookieServiceChild.h | 3 -- netwerk/dns/DNSRequestChild.cpp | 13 ++----- netwerk/dns/DNSRequestChild.h | 2 -- netwerk/protocol/data/DataChannelChild.cpp | 6 +--- netwerk/protocol/data/DataChannelChild.h | 2 -- netwerk/protocol/file/FileChannelChild.cpp | 6 +--- netwerk/protocol/file/FileChannelChild.h | 2 -- netwerk/protocol/ftp/FTPChannelChild.cpp | 22 ++++++------ netwerk/protocol/ftp/FTPChannelChild.h | 1 - .../http/AltDataOutputStreamChild.cpp | 18 ++++------ .../protocol/http/AltDataOutputStreamChild.h | 1 - .../http/AltDataOutputStreamParent.cpp | 16 +++------ .../protocol/http/AltDataOutputStreamParent.h | 2 -- netwerk/protocol/http/HttpChannelChild.cpp | 3 +- .../websocket/WebSocketChannelParent.cpp | 17 ++++------ .../websocket/WebSocketChannelParent.h | 1 - .../protocol/wyciwyg/WyciwygChannelChild.cpp | 17 +++++----- .../protocol/wyciwyg/WyciwygChannelChild.h | 1 - security/manager/ssl/PSMContentListener.cpp | 11 ++---- security/manager/ssl/PSMContentListener.h | 3 -- .../reputationservice/LoginReputationIPC.cpp | 8 +---- .../reputationservice/LoginReputationIPC.h | 3 -- 56 files changed, 105 insertions(+), 339 deletions(-) diff --git a/dom/base/nsContentPermissionHelper.cpp b/dom/base/nsContentPermissionHelper.cpp index ac417419c530..116b4591b80c 100644 --- a/dom/base/nsContentPermissionHelper.cpp +++ b/dom/base/nsContentPermissionHelper.cpp @@ -992,7 +992,6 @@ RemotePermissionRequest::RemotePermissionRequest( nsPIDOMWindowInner* aWindow) : mRequest(aRequest) , mWindow(aWindow) - , mIPCOpen(false) , mDestroyed(false) { mListener = new VisibilityChangeListener(mWindow); @@ -1001,7 +1000,8 @@ RemotePermissionRequest::RemotePermissionRequest( RemotePermissionRequest::~RemotePermissionRequest() { - MOZ_ASSERT(!mIPCOpen, "Protocol must not be open when RemotePermissionRequest is destroyed."); + MOZ_ASSERT(!mozilla::ipc::IProtocol::IPCOpen(), + "Protocol must not be open when RemotePermissionRequest is destroyed."); } void diff --git a/dom/base/nsContentPermissionHelper.h b/dom/base/nsContentPermissionHelper.h index f8dab043b2ae..67fe47c5c31c 100644 --- a/dom/base/nsContentPermissionHelper.h +++ b/dom/base/nsContentPermissionHelper.h @@ -234,19 +234,19 @@ public: void IPDLAddRef() { - mIPCOpen = true; AddRef(); } void IPDLRelease() { - mIPCOpen = false; Release(); } void Destroy(); - bool IPCOpen() const { return mIPCOpen && !mDestroyed; } + bool IPCOpen() const { + return mozilla::ipc::IProtocol::IPCOpen() && !mDestroyed; + } private: virtual ~RemotePermissionRequest(); @@ -256,7 +256,6 @@ private: nsCOMPtr mRequest; nsCOMPtr mWindow; - bool mIPCOpen; bool mDestroyed; RefPtr mListener; }; diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 511076f79bee..c8f5e0eaf584 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1484,7 +1484,7 @@ ContentParent::ShutDownProcess(ShutDownMethod aMethod) } } - if (mIPCOpen && !mShutdownPending) { + if (IPCOpen() && !mShutdownPending) { // Stop sending input events with input priority when shutting down. SetInputPriorityEventEnabled(false); if (SendShutdown()) { @@ -1687,10 +1687,6 @@ ContentParent::ActorDestroy(ActorDestroyReason why) mForceKillTimer = nullptr; } - // Signal shutdown completion regardless of error state, so we can - // finish waiting in the xpcom-shutdown/profile-before-change observer. - mIPCOpen = false; - if (mHangMonitorActor) { ProcessHangMonitor::RemoveProcess(mHangMonitorActor); mHangMonitorActor = nullptr; @@ -1944,7 +1940,7 @@ ContentParent::NotifyTabDestroying(const TabId& aTabId, void ContentParent::StartForceKillTimer() { - if (mForceKillTimer || !mIPCOpen) { + if (mForceKillTimer || !IPCOpen()) { return; } @@ -2401,7 +2397,6 @@ ContentParent::ContentParent(ContentParent* aOpener, , mCalledKillHard(false) , mCreatedPairedMinidumps(false) , mShutdownPending(false) - , mIPCOpen(true) , mIsRemoteInputEventQueueEnabled(false) , mIsInputPriorityEventEnabled(false) , mHangMonitorActor(nullptr) @@ -2906,7 +2901,7 @@ ContentParent::IsInputEventQueueSupported() void ContentParent::OnVarChanged(const GfxVarUpdate& aVar) { - if (!mIPCOpen) { + if (!IPCOpen()) { return; } Unused << SendVarUpdate(aVar); @@ -3140,7 +3135,7 @@ ContentParent::Observe(nsISupports* aSubject, // Wait for shutdown to complete, so that we receive any shutdown // data (e.g. telemetry) from the child before we quit. // This loop terminate prematurely based on mForceKillTimer. - SpinEventLoopUntil([&]() { return !mIPCOpen || mCalledKillHard; }); + SpinEventLoopUntil([&]() { return !IPCOpen() || mCalledKillHard; }); NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess"); } diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index df69da65f860..5db9d3a729fe 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -288,7 +288,7 @@ public: #endif // Let managees query if it is safe to send messages. - bool IsDestroyed() const { return !mIPCOpen; } + bool IsDestroyed() const { return !IPCOpen(); } virtual mozilla::ipc::IPCResult RecvCreateChildProcess(const IPCTabContext& aContext, const hal::ProcessPriority& aPriority, @@ -1351,7 +1351,6 @@ private: bool mCalledKillHard; bool mCreatedPairedMinidumps; bool mShutdownPending; - bool mIPCOpen; // True if the input event queue on the main thread of the content process is // enabled. diff --git a/dom/ipc/ProcessHangMonitor.cpp b/dom/ipc/ProcessHangMonitor.cpp index 7b73a3452dde..14fb03978c52 100644 --- a/dom/ipc/ProcessHangMonitor.cpp +++ b/dom/ipc/ProcessHangMonitor.cpp @@ -154,9 +154,6 @@ class HangMonitorChild JSContext* mContext; bool mShutdownDone; - // This field is only accessed on the hang thread. - bool mIPCOpen; - // Allows us to ensure we NotifyActivity only once, allowing // either thread to do so. Atomic mPaintWhileInterruptingJSActive; @@ -276,9 +273,6 @@ private: // This field is read-only after construction. bool mReportHangs; - // This field is only accessed on the hang thread. - bool mIPCOpen; - Monitor mMonitor; // Must be accessed with mMonitor held. @@ -311,7 +305,6 @@ HangMonitorChild::HangMonitorChild(ProcessHangMonitor* aMonitor) mPaintWhileInterruptingJS(false), mPaintWhileInterruptingJSForce(false), mShutdownDone(false), - mIPCOpen(true), mPaintWhileInterruptingJSActive(false) { MOZ_RELEASE_ASSERT(NS_IsMainThread()); @@ -393,8 +386,6 @@ HangMonitorChild::ActorDestroy(ActorDestroyReason aWhy) { MOZ_RELEASE_ASSERT(IsOnThread()); - mIPCOpen = false; - // We use a task here to ensure that IPDL is finished with this // HangMonitorChild before it gets deleted on the main thread. Dispatch(NewNonOwningRunnableMethod("HangMonitorChild::ShutdownOnThread", @@ -488,7 +479,7 @@ HangMonitorChild::NotifySlowScriptAsync(TabId aTabId, const nsCString& aFileName, const nsString& aAddonId) { - if (mIPCOpen) { + if (IPCOpen()) { Unused << SendHangEvidence(SlowScriptData(aTabId, aFileName, aAddonId)); } } @@ -574,7 +565,7 @@ HangMonitorChild::NotifyPluginHangAsync(uint32_t aPluginId) MOZ_RELEASE_ASSERT(IsOnThread()); // bounce back to parent on background thread - if (mIPCOpen) { + if (IPCOpen()) { Unused << SendHangEvidence(PluginHangData(aPluginId, base::GetCurrentProcId())); } @@ -606,7 +597,7 @@ HangMonitorChild::ClearHangAsync() MOZ_RELEASE_ASSERT(IsOnThread()); // bounce back to parent on background thread - if (mIPCOpen) { + if (IPCOpen()) { Unused << SendClearHang(); } } @@ -615,7 +606,6 @@ HangMonitorChild::ClearHangAsync() HangMonitorParent::HangMonitorParent(ProcessHangMonitor* aMonitor) : mHangMonitor(aMonitor), - mIPCOpen(true), mMonitor("HangMonitorParent lock"), mShutdownDone(false), mBrowserCrashDumpHashLock("mBrowserCrashDumpIds lock"), @@ -670,10 +660,9 @@ HangMonitorParent::ShutdownOnThread() { MOZ_RELEASE_ASSERT(IsOnThread()); - // mIPCOpen is only written from this thread, so need need to take the lock - // here. We'd be shooting ourselves in the foot, because ActorDestroy takes - // it. - if (mIPCOpen) { + // Don't take the lock until after IPCOpen() is checked, as the actor lives on + // this thread and ActorDestroy will also take a lock. + if (IPCOpen()) { Close(); } @@ -707,7 +696,7 @@ HangMonitorParent::PaintWhileInterruptingJSOnThread(TabId aTabId, { MOZ_RELEASE_ASSERT(IsOnThread()); - if (mIPCOpen) { + if (IPCOpen()) { Unused << SendPaintWhileInterruptingJS(aTabId, aForceRepaint, aEpoch); } } @@ -716,7 +705,6 @@ void HangMonitorParent::ActorDestroy(ActorDestroyReason aWhy) { MOZ_RELEASE_ASSERT(IsOnThread()); - mIPCOpen = false; } void @@ -859,7 +847,7 @@ HangMonitorParent::TerminateScript(bool aTerminateGlobal) { MOZ_RELEASE_ASSERT(IsOnThread()); - if (mIPCOpen) { + if (IPCOpen()) { Unused << SendTerminateScript(aTerminateGlobal); } } @@ -869,7 +857,7 @@ HangMonitorParent::BeginStartingDebugger() { MOZ_RELEASE_ASSERT(IsOnThread()); - if (mIPCOpen) { + if (IPCOpen()) { Unused << SendBeginStartingDebugger(); } } @@ -879,7 +867,7 @@ HangMonitorParent::EndStartingDebugger() { MOZ_RELEASE_ASSERT(IsOnThread()); - if (mIPCOpen) { + if (IPCOpen()) { Unused << SendEndStartingDebugger(); } } diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 36db089a6c6a..1d0465e6f4ae 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -411,7 +411,6 @@ TabChild::TabChild(nsIContentChild* aManager, , mUniqueId(aTabId) , mHasSiblings(false) , mIsTransparent(false) - , mIPCOpen(false) , mParentIsActive(false) , mDidSetRealShowInfo(false) , mDidLoadURLInit(false) @@ -627,8 +626,6 @@ TabChild::Init(mozIDOMWindowProxy* aParent) }); mAPZEventState = new APZEventState(mPuppetWidget, std::move(callback)); - mIPCOpen = true; - // Recording/replaying processes use their own compositor. if (recordreplay::IsRecordingOrReplaying()) { mPuppetWidget->CreateCompositor(); @@ -1039,8 +1036,6 @@ TabChild::DestroyWindow() void TabChild::ActorDestroy(ActorDestroyReason why) { - mIPCOpen = false; - DestroyWindow(); if (mTabChildMessageManager) { diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index fc8ee8bf3e7c..dedbb4e747a3 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -588,8 +588,6 @@ public: LayoutDeviceIntPoint GetClientOffset() const { return mClientOffset; } LayoutDeviceIntPoint GetChromeOffset() const { return mChromeOffset; }; - bool IPCOpen() const { return mIPCOpen; } - bool ParentIsActive() const { return mParentIsActive; @@ -852,7 +850,6 @@ private: bool mIsTransparent; - bool mIPCOpen; bool mParentIsActive; CSSSize mUnscaledInnerSize; bool mDidSetRealShowInfo; diff --git a/dom/ipc/URLClassifierParent.cpp b/dom/ipc/URLClassifierParent.cpp index 8aef6cdeca8c..31d0ecbdc421 100644 --- a/dom/ipc/URLClassifierParent.cpp +++ b/dom/ipc/URLClassifierParent.cpp @@ -44,12 +44,6 @@ URLClassifierParent::StartClassify(nsIPrincipal* aPrincipal, return IPC_OK(); } -void -URLClassifierParent::ActorDestroy(ActorDestroyReason aWhy) -{ - mIPCOpen = false; -} - ///////////////////////////////////////////////////////////////////// //URLClassifierLocalParent. @@ -79,9 +73,3 @@ URLClassifierLocalParent::StartClassify(nsIURI* aURI, const nsACString& aTables) } return IPC_OK(); } - -void -URLClassifierLocalParent::ActorDestroy(ActorDestroyReason aWhy) -{ - mIPCOpen = false; -} diff --git a/dom/ipc/URLClassifierParent.h b/dom/ipc/URLClassifierParent.h index 7e726a9fc202..af2e620319b6 100644 --- a/dom/ipc/URLClassifierParent.h +++ b/dom/ipc/URLClassifierParent.h @@ -25,7 +25,7 @@ public: const nsACString& aProvider, const nsACString& aFullHash) override { - if (mIPCOpen) { + if (BaseProtocol::IPCOpen()) { ClassifierInfo info = ClassifierInfo(nsCString(aList), nsCString(aProvider), nsCString(aFullHash)); @@ -37,14 +37,13 @@ public: // Custom. void ClassificationFailed() { - if (mIPCOpen) { + if (BaseProtocol::IPCOpen()) { Unused << BaseProtocol::Send__delete__(this, void_t(), NS_ERROR_FAILURE); } } protected: ~URLClassifierParentBase() = default; - bool mIPCOpen = true; }; ////////////////////////////////////////////////////////////// @@ -60,10 +59,6 @@ public: bool* aSuccess); private: ~URLClassifierParent() = default; - - // Override PURLClassifierParent::ActorDestroy. We seem to unable to - // override from the base template class. - void ActorDestroy(ActorDestroyReason aWhy) override; }; ////////////////////////////////////////////////////////////// @@ -78,9 +73,6 @@ public: private: ~URLClassifierLocalParent() = default; - - // Override PURLClassifierParent::ActorDestroy. - void ActorDestroy(ActorDestroyReason aWhy) override; }; } // namespace dom diff --git a/dom/network/TCPServerSocketChild.cpp b/dom/network/TCPServerSocketChild.cpp index 675f54def119..91700495ead6 100644 --- a/dom/network/TCPServerSocketChild.cpp +++ b/dom/network/TCPServerSocketChild.cpp @@ -27,7 +27,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TCPServerSocketChildBase) NS_INTERFACE_MAP_END TCPServerSocketChildBase::TCPServerSocketChildBase() -: mIPCOpen(false) { } @@ -38,7 +37,7 @@ TCPServerSocketChildBase::~TCPServerSocketChildBase() NS_IMETHODIMP_(MozExternalRefCountType) TCPServerSocketChild::Release(void) { nsrefcnt refcnt = TCPServerSocketChildBase::Release(); - if (refcnt == 1 && mIPCOpen) { + if (refcnt == 1 && IPCOpen()) { PTCPServerSocketChild::SendRequestDelete(); return 1; } @@ -60,16 +59,12 @@ TCPServerSocketChild::TCPServerSocketChild(TCPServerSocket* aServerSocket, uint1 void TCPServerSocketChildBase::ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen); - mIPCOpen = false; this->Release(); } void TCPServerSocketChildBase::AddIPDLReference() { - MOZ_ASSERT(!mIPCOpen); - mIPCOpen = true; this->AddRef(); } diff --git a/dom/network/TCPServerSocketChild.h b/dom/network/TCPServerSocketChild.h index 2a02f848468b..6b7b326794c4 100644 --- a/dom/network/TCPServerSocketChild.h +++ b/dom/network/TCPServerSocketChild.h @@ -34,7 +34,6 @@ protected: virtual ~TCPServerSocketChildBase(); RefPtr mServerSocket; - bool mIPCOpen; }; class TCPServerSocketChild : public mozilla::net::PTCPServerSocketChild diff --git a/dom/network/TCPServerSocketParent.cpp b/dom/network/TCPServerSocketParent.cpp index 6d2f1d68d3b1..53b2a799ee3f 100644 --- a/dom/network/TCPServerSocketParent.cpp +++ b/dom/network/TCPServerSocketParent.cpp @@ -26,16 +26,12 @@ NS_INTERFACE_MAP_END void TCPServerSocketParent::ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen); - mIPCOpen = false; this->Release(); } void TCPServerSocketParent::AddIPDLReference() { - MOZ_ASSERT(!mIPCOpen); - mIPCOpen = true; this->AddRef(); } @@ -44,7 +40,6 @@ TCPServerSocketParent::TCPServerSocketParent(PNeckoParent* neckoParent, uint16_t aBacklog, bool aUseArrayBuffers) : mNeckoParent(neckoParent) -, mIPCOpen(false) { mServerSocket = new TCPServerSocket(nullptr, aLocalPort, aUseArrayBuffers, aBacklog); mServerSocket->SetServerBridgeParent(this); diff --git a/dom/network/TCPServerSocketParent.h b/dom/network/TCPServerSocketParent.h index 8cac6375af67..3990befb2469 100644 --- a/dom/network/TCPServerSocketParent.h +++ b/dom/network/TCPServerSocketParent.h @@ -48,7 +48,6 @@ private: PNeckoParent* mNeckoParent; RefPtr mServerSocket; - bool mIPCOpen; }; } // namespace dom diff --git a/dom/network/TCPSocketChild.cpp b/dom/network/TCPSocketChild.cpp index ecb9a57bc571..09b41136ec0d 100644 --- a/dom/network/TCPSocketChild.cpp +++ b/dom/network/TCPSocketChild.cpp @@ -69,7 +69,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TCPSocketChildBase) NS_INTERFACE_MAP_END TCPSocketChildBase::TCPSocketChildBase() -: mIPCOpen(false) { mozilla::HoldJSObjects(this); } @@ -82,7 +81,7 @@ TCPSocketChildBase::~TCPSocketChildBase() NS_IMETHODIMP_(MozExternalRefCountType) TCPSocketChild::Release(void) { nsrefcnt refcnt = TCPSocketChildBase::Release(); - if (refcnt == 1 && mIPCOpen) { + if (refcnt == 1 && IPCOpen()) { PTCPSocketChild::SendRequestDelete(); return 1; } @@ -138,8 +137,6 @@ TCPSocketChild::SendWindowlessOpenBind(nsITCPSocketCallback* aSocket, void TCPSocketChildBase::ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen); - mIPCOpen = false; mSocket = nullptr; this->Release(); } @@ -147,8 +144,6 @@ TCPSocketChildBase::ReleaseIPDLReference() void TCPSocketChildBase::AddIPDLReference() { - MOZ_ASSERT(!mIPCOpen); - mIPCOpen = true; this->AddRef(); } diff --git a/dom/network/TCPSocketChild.h b/dom/network/TCPSocketChild.h index e7f6d98d7a11..f6b605be5f9b 100644 --- a/dom/network/TCPSocketChild.h +++ b/dom/network/TCPSocketChild.h @@ -40,7 +40,6 @@ protected: virtual ~TCPSocketChildBase(); nsCOMPtr mSocket; - bool mIPCOpen; }; class TCPSocketChild : public mozilla::net::PTCPSocketChild diff --git a/dom/network/TCPSocketParent.cpp b/dom/network/TCPSocketParent.cpp index 141308649f46..a5cd7fc824a5 100644 --- a/dom/network/TCPSocketParent.cpp +++ b/dom/network/TCPSocketParent.cpp @@ -62,7 +62,6 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(TCPSocketParentBase) NS_IMPL_CYCLE_COLLECTING_RELEASE(TCPSocketParentBase) TCPSocketParentBase::TCPSocketParentBase() -: mIPCOpen(false) { } @@ -73,23 +72,19 @@ TCPSocketParentBase::~TCPSocketParentBase() void TCPSocketParentBase::ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen); - mIPCOpen = false; this->Release(); } void TCPSocketParentBase::AddIPDLReference() { - MOZ_ASSERT(!mIPCOpen); - mIPCOpen = true; this->AddRef(); } NS_IMETHODIMP_(MozExternalRefCountType) TCPSocketParent::Release(void) { nsrefcnt refcnt = TCPSocketParentBase::Release(); - if (refcnt == 1 && mIPCOpen) { + if (refcnt == 1 && IPCOpen()) { mozilla::Unused << PTCPSocketParent::SendRequestDelete(); return 1; } @@ -330,7 +325,7 @@ TCPSocketParent::FireStringDataEvent(const nsACString& aData, TCPReadyState aRea void TCPSocketParent::SendEvent(const nsAString& aType, CallbackData aData, TCPReadyState aReadyState) { - if (mIPCOpen) { + if (IPCOpen()) { mozilla::Unused << PTCPSocketParent::SendCallback(nsString(aType), aData, static_cast(aReadyState)); diff --git a/dom/network/TCPSocketParent.h b/dom/network/TCPSocketParent.h index c1a6f7ad5c32..5016cd684d4f 100644 --- a/dom/network/TCPSocketParent.h +++ b/dom/network/TCPSocketParent.h @@ -36,7 +36,6 @@ protected: virtual ~TCPSocketParentBase(); RefPtr mSocket; - bool mIPCOpen; }; class TCPSocketParent : public mozilla::net::PTCPSocketParent diff --git a/dom/network/UDPSocketChild.cpp b/dom/network/UDPSocketChild.cpp index b48dba26e699..0baf3637eafe 100644 --- a/dom/network/UDPSocketChild.cpp +++ b/dom/network/UDPSocketChild.cpp @@ -23,7 +23,6 @@ namespace dom { NS_IMPL_ISUPPORTS(UDPSocketChildBase, nsIUDPSocketChild) UDPSocketChildBase::UDPSocketChildBase() -: mIPCOpen(false) { } @@ -34,8 +33,6 @@ UDPSocketChildBase::~UDPSocketChildBase() void UDPSocketChildBase::ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen); - mIPCOpen = false; mSocket = nullptr; this->Release(); } @@ -43,15 +40,13 @@ UDPSocketChildBase::ReleaseIPDLReference() void UDPSocketChildBase::AddIPDLReference() { - MOZ_ASSERT(!mIPCOpen); - mIPCOpen = true; this->AddRef(); } NS_IMETHODIMP_(MozExternalRefCountType) UDPSocketChild::Release(void) { nsrefcnt refcnt = UDPSocketChildBase::Release(); - if (refcnt == 1 && mIPCOpen) { + if (refcnt == 1 && IPCOpen()) { PUDPSocketChild::SendRequestDelete(); return 1; } diff --git a/dom/network/UDPSocketChild.h b/dom/network/UDPSocketChild.h index 78d102c32941..d22712a6053d 100644 --- a/dom/network/UDPSocketChild.h +++ b/dom/network/UDPSocketChild.h @@ -29,7 +29,6 @@ protected: UDPSocketChildBase(); virtual ~UDPSocketChildBase(); nsCOMPtr mSocket; - bool mIPCOpen; }; class UDPSocketChild : public mozilla::net::PUDPSocketChild diff --git a/dom/network/UDPSocketParent.cpp b/dom/network/UDPSocketParent.cpp index 3822d197fc61..0d25e8c3197a 100644 --- a/dom/network/UDPSocketParent.cpp +++ b/dom/network/UDPSocketParent.cpp @@ -30,13 +30,11 @@ NS_IMPL_ISUPPORTS(UDPSocketParent, nsIUDPSocketListener) UDPSocketParent::UDPSocketParent(PBackgroundParent* aManager) : mBackgroundManager(aManager) - , mIPCOpen(true) { } UDPSocketParent::UDPSocketParent(PNeckoParent* aManager) : mBackgroundManager(nullptr) - , mIPCOpen(true) { } @@ -510,8 +508,6 @@ UDPSocketParent::RecvRequestDelete() void UDPSocketParent::ActorDestroy(ActorDestroyReason why) { - MOZ_ASSERT(mIPCOpen); - mIPCOpen = false; if (mSocket) { mSocket->Close(); } @@ -524,7 +520,7 @@ NS_IMETHODIMP UDPSocketParent::OnPacketReceived(nsIUDPSocket* aSocket, nsIUDPMessage* aMessage) { // receiving packet from remote host, forward the message content to child process - if (!mIPCOpen) { + if (!IPCOpen()) { return NS_OK; } @@ -577,7 +573,7 @@ NS_IMETHODIMP UDPSocketParent::OnStopListening(nsIUDPSocket* aSocket, nsresult aStatus) { // underlying socket is dead, send state update to child process - if (mIPCOpen) { + if (IPCOpen()) { mozilla::Unused << SendCallbackClosed(); } return NS_OK; @@ -586,7 +582,7 @@ UDPSocketParent::OnStopListening(nsIUDPSocket* aSocket, nsresult aStatus) void UDPSocketParent::FireInternalError(uint32_t aLineNo) { - if (!mIPCOpen) { + if (!IPCOpen()) { return; } diff --git a/dom/network/UDPSocketParent.h b/dom/network/UDPSocketParent.h index e4cf15249fe5..006bb2f0f28a 100644 --- a/dom/network/UDPSocketParent.h +++ b/dom/network/UDPSocketParent.h @@ -70,7 +70,6 @@ private: PBackgroundParent* mBackgroundManager; - bool mIPCOpen; nsCOMPtr mSocket; nsCOMPtr mFilter; nsCOMPtr mPrincipal; diff --git a/dom/storage/StorageIPC.cpp b/dom/storage/StorageIPC.cpp index 54bcaab64269..0afb0299ae8a 100644 --- a/dom/storage/StorageIPC.cpp +++ b/dom/storage/StorageIPC.cpp @@ -129,23 +129,18 @@ private: void StorageDBChild::AddIPDLReference() { - MOZ_ASSERT(!mIPCOpen, "Attempting to retain multiple IPDL references"); - mIPCOpen = true; AddRef(); } void StorageDBChild::ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen, "Attempting to release non-existent IPDL reference"); - mIPCOpen = false; Release(); } StorageDBChild::StorageDBChild(LocalStorageManager* aManager) : mManager(aManager) , mStatus(NS_OK) - , mIPCOpen(false) { } @@ -248,7 +243,7 @@ StorageDBChild::Shutdown() void StorageDBChild::AsyncPreload(LocalStorageCacheBridge* aCache, bool aPriority) { - if (mIPCOpen) { + if (IPCOpen()) { // Adding ref to cache for the time of preload. This ensures a reference to // to the cache and that all keys will load into this cache object. mLoadingCaches.PutEntry(aCache); @@ -263,7 +258,7 @@ StorageDBChild::AsyncPreload(LocalStorageCacheBridge* aCache, bool aPriority) void StorageDBChild::AsyncGetUsage(StorageUsageBridge* aUsage) { - if (mIPCOpen) { + if (IPCOpen()) { SendAsyncGetUsage(aUsage->OriginScope()); } } @@ -276,7 +271,7 @@ StorageDBChild::SyncPreload(LocalStorageCacheBridge* aCache, bool aForceSync) return; } - if (!mIPCOpen) { + if (!IPCOpen()) { aCache->LoadDone(NS_ERROR_UNEXPECTED); return; } @@ -302,7 +297,7 @@ StorageDBChild::AsyncAddItem(LocalStorageCacheBridge* aCache, const nsAString& aKey, const nsAString& aValue) { - if (NS_FAILED(mStatus) || !mIPCOpen) { + if (NS_FAILED(mStatus) || !IPCOpen()) { return mStatus; } @@ -317,7 +312,7 @@ StorageDBChild::AsyncUpdateItem(LocalStorageCacheBridge* aCache, const nsAString& aKey, const nsAString& aValue) { - if (NS_FAILED(mStatus) || !mIPCOpen) { + if (NS_FAILED(mStatus) || !IPCOpen()) { return mStatus; } @@ -331,7 +326,7 @@ nsresult StorageDBChild::AsyncRemoveItem(LocalStorageCacheBridge* aCache, const nsAString& aKey) { - if (NS_FAILED(mStatus) || !mIPCOpen) { + if (NS_FAILED(mStatus) || !IPCOpen()) { return mStatus; } @@ -343,7 +338,7 @@ StorageDBChild::AsyncRemoveItem(LocalStorageCacheBridge* aCache, nsresult StorageDBChild::AsyncClear(LocalStorageCacheBridge* aCache) { - if (NS_FAILED(mStatus) || !mIPCOpen) { + if (NS_FAILED(mStatus) || !IPCOpen()) { return mStatus; } @@ -607,16 +602,12 @@ NS_IMPL_RELEASE(StorageDBParent) void StorageDBParent::AddIPDLReference() { - MOZ_ASSERT(!mIPCOpen, "Attempting to retain multiple IPDL references"); - mIPCOpen = true; AddRef(); } void StorageDBParent::ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen, "Attempting to release non-existent IPDL reference"); - mIPCOpen = false; Release(); } @@ -626,7 +617,6 @@ namespace { StorageDBParent::StorageDBParent(const nsString& aProfilePath) : mProfilePath(aProfilePath) - , mIPCOpen(false) { AssertIsOnBackgroundThread(); @@ -844,7 +834,7 @@ StorageDBParent::RecvAsyncAddItem(const nsCString& aOriginSuffix, storageThread->AsyncAddItem(NewCache(aOriginSuffix, aOriginNoSuffix), aKey, aValue); - if (NS_FAILED(rv) && mIPCOpen) { + if (NS_FAILED(rv) && IPCOpen()) { mozilla::Unused << SendError(rv); } @@ -866,7 +856,7 @@ StorageDBParent::RecvAsyncUpdateItem(const nsCString& aOriginSuffix, storageThread->AsyncUpdateItem(NewCache(aOriginSuffix, aOriginNoSuffix), aKey, aValue); - if (NS_FAILED(rv) && mIPCOpen) { + if (NS_FAILED(rv) && IPCOpen()) { mozilla::Unused << SendError(rv); } @@ -886,7 +876,7 @@ StorageDBParent::RecvAsyncRemoveItem(const nsCString& aOriginSuffix, nsresult rv = storageThread->AsyncRemoveItem(NewCache(aOriginSuffix, aOriginNoSuffix), aKey); - if (NS_FAILED(rv) && mIPCOpen) { + if (NS_FAILED(rv) && IPCOpen()) { mozilla::Unused << SendError(rv); } @@ -904,7 +894,7 @@ StorageDBParent::RecvAsyncClear(const nsCString& aOriginSuffix, nsresult rv = storageThread->AsyncClear(NewCache(aOriginSuffix, aOriginNoSuffix)); - if (NS_FAILED(rv) && mIPCOpen) { + if (NS_FAILED(rv) && IPCOpen()) { mozilla::Unused << SendError(rv); } @@ -980,7 +970,7 @@ StorageDBParent::Observe(const nsCString& aTopic, const nsString& aOriginAttributesPattern, const nsCString& aOriginScope) { - if (mIPCOpen) { + if (IPCOpen()) { mozilla::Unused << SendObserve(aTopic, aOriginAttributesPattern, aOriginScope); } diff --git a/dom/storage/StorageIPC.h b/dom/storage/StorageIPC.h index 52f211889c72..a762f994816d 100644 --- a/dom/storage/StorageIPC.h +++ b/dom/storage/StorageIPC.h @@ -178,8 +178,6 @@ private: // Status of the remote database nsresult mStatus; - - bool mIPCOpen; }; class LocalStorageCacheParent final @@ -239,8 +237,6 @@ public: void AddIPDLReference(); void ReleaseIPDLReference(); - bool IPCOpen() { return mIPCOpen; } - public: // Fake cache class receiving async callbacks from DB thread, sending // them back to appropriate cache object on the child process. @@ -367,9 +363,6 @@ private: ThreadSafeAutoRefCnt mRefCnt; NS_DECL_OWNINGTHREAD - - // True when IPC channel is open and Send*() methods are OK to use. - bool mIPCOpen; }; PBackgroundLocalStorageCacheParent* diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 7b29a829c1ad..68c236f8be58 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -106,7 +106,6 @@ public: , mTextureData(nullptr) , mDestroyed(false) , mMainThreadOnly(false) - , mIPCOpen(false) , mOwnsTextureData(false) , mOwnerCalledDestroy(false) {} @@ -117,28 +116,12 @@ public: void ActorDestroy(ActorDestroyReason why) override; - bool IPCOpen() const { return mIPCOpen; } - void Lock() const { if (mCompositableForwarder && mCompositableForwarder->GetTextureForwarder()->UsesImageBridge()) { mLock.Enter(); } } void Unlock() const { if (mCompositableForwarder && mCompositableForwarder->GetTextureForwarder()->UsesImageBridge()) { mLock.Leave(); } } private: - // AddIPDLReference and ReleaseIPDLReference are only to be called by CreateIPDLActor - // and DestroyIPDLActor, respectively. We intentionally make them private to prevent misuse. - // The purpose of these methods is to be aware of when the IPC system around this - // actor goes down: mIPCOpen is then set to false. - void AddIPDLReference() { - MOZ_ASSERT(mIPCOpen == false); - mIPCOpen = true; - AddRef(); - } - void ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen == false); - Release(); - } - /// The normal way to destroy the actor. /// /// This will asynchronously send a Destroy message to the parent actor, whom @@ -217,7 +200,6 @@ private: TextureData* mTextureData; Atomic mDestroyed; bool mMainThreadOnly; - bool mIPCOpen; bool mOwnsTextureData; bool mOwnerCalledDestroy; @@ -255,8 +237,6 @@ void TextureChild::ActorDestroy(ActorDestroyReason why) { AUTO_PROFILER_LABEL("TextureChild::ActorDestroy", GRAPHICS); - MOZ_ASSERT(mIPCOpen); - mIPCOpen = false; if (mTextureData) { DestroyTextureData(mTextureData, GetAllocator(), mOwnsTextureData, mMainThreadOnly); @@ -744,16 +724,15 @@ TextureClient::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) PTextureChild* TextureClient::CreateIPDLActor() { - TextureChild* c = new TextureChild(); - c->AddIPDLReference(); - return c; + RefPtr c = new TextureChild(); + return c.forget().take(); } // static bool TextureClient::DestroyIPDLActor(PTextureChild* actor) { - static_cast(actor)->ReleaseIPDLReference(); + RefPtr tc = dont_AddRef(static_cast(actor)); return true; } diff --git a/gfx/layers/ipc/LayerTransactionChild.h b/gfx/layers/ipc/LayerTransactionChild.h index 02acbd357e01..86c627866935 100644 --- a/gfx/layers/ipc/LayerTransactionChild.h +++ b/gfx/layers/ipc/LayerTransactionChild.h @@ -33,7 +33,9 @@ public: */ void Destroy(); - bool IPCOpen() const { return mIPCOpen && !mDestroyed; } + bool IPCOpen() const { + return mozilla::ipc::IProtocol::IPCOpen() && !mDestroyed; + } bool IsDestroyed() const { return mDestroyed; } void SetForwarder(ShadowLayerForwarder* aForwarder) @@ -50,7 +52,6 @@ public: protected: explicit LayerTransactionChild(const LayersId& aId) : mForwarder(nullptr) - , mIPCOpen(false) , mDestroyed(false) , mId(aId) {} @@ -59,19 +60,14 @@ protected: void ActorDestroy(ActorDestroyReason why) override; void AddIPDLReference() { - MOZ_ASSERT(mIPCOpen == false); - mIPCOpen = true; AddRef(); } void ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen == true); - mIPCOpen = false; Release(); } friend class CompositorBridgeChild; ShadowLayerForwarder* mForwarder; - bool mIPCOpen; bool mDestroyed; LayersId mId; }; diff --git a/gfx/layers/ipc/LayerTransactionParent.cpp b/gfx/layers/ipc/LayerTransactionParent.cpp index 6154346ecb15..43bdcc95ca3d 100644 --- a/gfx/layers/ipc/LayerTransactionParent.cpp +++ b/gfx/layers/ipc/LayerTransactionParent.cpp @@ -58,7 +58,6 @@ LayerTransactionParent::LayerTransactionParent(HostLayerManager* aManager, , mVsyncRate(aVsyncRate) , mPendingTransaction{0} , mDestroyed(false) - , mIPCOpen(false) , mUpdateHitTestingTree(false) { MOZ_ASSERT(mId.IsValid()); @@ -884,7 +883,7 @@ LayerTransactionParent::AllocShmem(size_t aSize, ipc::SharedMemory::SharedMemoryType aType, ipc::Shmem* aShmem) { - if (!mIPCOpen || mDestroyed) { + if (!IPCOpen() || mDestroyed) { return false; } return PLayerTransactionParent::AllocShmem(aSize, aType, aShmem); @@ -895,7 +894,7 @@ LayerTransactionParent::AllocUnsafeShmem(size_t aSize, ipc::SharedMemory::SharedMemoryType aType, ipc::Shmem* aShmem) { - if (!mIPCOpen || mDestroyed) { + if (!IPCOpen() || mDestroyed) { return false; } @@ -905,7 +904,7 @@ LayerTransactionParent::AllocUnsafeShmem(size_t aSize, void LayerTransactionParent::DeallocShmem(ipc::Shmem& aShmem) { - if (!mIPCOpen || mDestroyed) { + if (!IPCOpen() || mDestroyed) { return; } PLayerTransactionParent::DeallocShmem(aShmem); diff --git a/gfx/layers/ipc/LayerTransactionParent.h b/gfx/layers/ipc/LayerTransactionParent.h index 3c197fe5d04e..ec516ea1fe25 100644 --- a/gfx/layers/ipc/LayerTransactionParent.h +++ b/gfx/layers/ipc/LayerTransactionParent.h @@ -57,6 +57,8 @@ public: LayersId GetId() const { return mId; } Layer* GetRoot() const { return mRoot; } + bool IPCOpen() const override { return mozilla::ipc::IProtocol::IPCOpen(); } + LayersObserverEpoch GetChildEpoch() const { return mChildEpoch; } bool ShouldParentObserveEpoch(); @@ -154,13 +156,9 @@ protected: bool Attach(Layer* aLayer, CompositableHost* aCompositable, bool aIsAsyncVideo); void AddIPDLReference() { - MOZ_ASSERT(mIPCOpen == false); - mIPCOpen = true; AddRef(); } void ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen == true); - mIPCOpen = false; Release(); } friend class CompositorBridgeParent; @@ -217,7 +215,6 @@ private: // transactions posted by the child. bool mDestroyed; - bool mIPCOpen; // This is set during RecvUpdate to track whether we'll need to update // APZ's hit test regions. diff --git a/gfx/layers/wr/WebRenderBridgeChild.cpp b/gfx/layers/wr/WebRenderBridgeChild.cpp index 72ca399b0fe8..1347ab43cfc1 100644 --- a/gfx/layers/wr/WebRenderBridgeChild.cpp +++ b/gfx/layers/wr/WebRenderBridgeChild.cpp @@ -29,7 +29,6 @@ WebRenderBridgeChild::WebRenderBridgeChild(const wr::PipelineId& aPipelineId) , mResourceId(0) , mPipelineId(aPipelineId) , mManager(nullptr) - , mIPCOpen(false) , mDestroyed(false) , mFontKeysDeleted(0) , mFontInstanceKeysDeleted(0) diff --git a/gfx/layers/wr/WebRenderBridgeChild.h b/gfx/layers/wr/WebRenderBridgeChild.h index 3e3fb1a92b17..f4c52210b5b3 100644 --- a/gfx/layers/wr/WebRenderBridgeChild.h +++ b/gfx/layers/wr/WebRenderBridgeChild.h @@ -113,7 +113,9 @@ public: * to be sent from the parent side. */ void Destroy(bool aIsSync); - bool IPCOpen() const { return mIPCOpen && !mDestroyed; } + bool IPCOpen() const { + return mozilla::ipc::IProtocol::IPCOpen() && !mDestroyed; + } bool IsDestroyed() const { return mDestroyed; } uint32_t GetNextResourceId() { return ++mResourceId; } @@ -213,13 +215,9 @@ private: mozilla::ipc::IPCResult RecvWrReleasedImages(nsTArray&& aPairs) override; void AddIPDLReference() { - MOZ_ASSERT(mIPCOpen == false); - mIPCOpen = true; AddRef(); } void ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen == true); - mIPCOpen = false; Release(); } @@ -235,7 +233,6 @@ private: wr::PipelineId mPipelineId; WebRenderLayerManager* mManager; - bool mIPCOpen; bool mDestroyed; uint32_t mFontKeysDeleted; diff --git a/gfx/vr/ipc/VRLayerChild.cpp b/gfx/vr/ipc/VRLayerChild.cpp index 25fbd3758785..8b64a36fdd77 100644 --- a/gfx/vr/ipc/VRLayerChild.cpp +++ b/gfx/vr/ipc/VRLayerChild.cpp @@ -20,7 +20,6 @@ namespace gfx { VRLayerChild::VRLayerChild() : mCanvasElement(nullptr) - , mIPCOpen(false) , mLastSubmittedFrameId(0) { MOZ_COUNT_CTOR(VRLayerChild); @@ -112,7 +111,7 @@ VRLayerChild::SubmitFrame(const VRDisplayInfo& aDisplayInfo) bool VRLayerChild::IsIPCOpen() { - return mIPCOpen; + return IPCOpen(); } void @@ -122,12 +121,6 @@ VRLayerChild::ClearSurfaces() mLastFrameTexture = nullptr; } -void -VRLayerChild::ActorDestroy(ActorDestroyReason aWhy) -{ - mIPCOpen = false; -} - // static PVRLayerChild* VRLayerChild::CreateIPDLActor() @@ -147,13 +140,10 @@ VRLayerChild::DestroyIPDLActor(PVRLayerChild* actor) void VRLayerChild::AddIPDLReference() { - MOZ_ASSERT(mIPCOpen == false); - mIPCOpen = true; AddRef(); } void VRLayerChild::ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen == false); Release(); } diff --git a/gfx/vr/ipc/VRLayerChild.h b/gfx/vr/ipc/VRLayerChild.h index 89ca8336ed0d..9e7581457486 100644 --- a/gfx/vr/ipc/VRLayerChild.h +++ b/gfx/vr/ipc/VRLayerChild.h @@ -44,10 +44,8 @@ private: VRLayerChild(); virtual ~VRLayerChild(); void ClearSurfaces(); - virtual void ActorDestroy(ActorDestroyReason aWhy) override; RefPtr mCanvasElement; - bool mIPCOpen; // AddIPDLReference and ReleaseIPDLReference are only to be called by CreateIPDLActor // and DestroyIPDLActor, respectively. We intentionally make them private to prevent misuse. diff --git a/gfx/vr/ipc/VRLayerParent.cpp b/gfx/vr/ipc/VRLayerParent.cpp index 024973db09e0..bf53bb6e0b5e 100644 --- a/gfx/vr/ipc/VRLayerParent.cpp +++ b/gfx/vr/ipc/VRLayerParent.cpp @@ -15,8 +15,7 @@ using namespace layers; namespace gfx { VRLayerParent::VRLayerParent(uint32_t aVRDisplayID, const uint32_t aGroup) - : mIPCOpen(true) - , mVRDisplayID(aVRDisplayID) + : mVRDisplayID(aVRDisplayID) , mGroup(aGroup) { } @@ -33,12 +32,6 @@ VRLayerParent::RecvDestroy() return IPC_OK(); } -void -VRLayerParent::ActorDestroy(ActorDestroyReason aWhy) -{ - mIPCOpen = false; -} - void VRLayerParent::Destroy() { @@ -53,7 +46,7 @@ VRLayerParent::Destroy() mVRDisplayID = 0; } - if (mIPCOpen) { + if (IPCOpen()) { Unused << PVRLayerParent::Send__delete__(this); } } diff --git a/gfx/vr/ipc/VRLayerParent.h b/gfx/vr/ipc/VRLayerParent.h index 7ec87d83f70b..12078d087605 100644 --- a/gfx/vr/ipc/VRLayerParent.h +++ b/gfx/vr/ipc/VRLayerParent.h @@ -29,13 +29,9 @@ public: uint32_t GetDisplayID() const { return mVRDisplayID; } uint32_t GetGroup() const { return mGroup; } protected: - virtual void ActorDestroy(ActorDestroyReason aWhy) override; - virtual ~VRLayerParent(); void Destroy(); - bool mIPCOpen; - uint32_t mVRDisplayID; gfx::Rect mLeftEyeRect; gfx::Rect mRightEyeRect; diff --git a/netwerk/cookie/CookieServiceChild.cpp b/netwerk/cookie/CookieServiceChild.cpp index d9414a5f1dcb..206ec931a027 100644 --- a/netwerk/cookie/CookieServiceChild.cpp +++ b/netwerk/cookie/CookieServiceChild.cpp @@ -68,7 +68,6 @@ CookieServiceChild::CookieServiceChild() , mThirdPartySession(false) , mThirdPartyNonsecureSession(false) , mLeaveSecureAlone(true) - , mIPCOpen(false) { NS_ASSERTION(IsNeckoChild(), "not a child process"); @@ -86,8 +85,6 @@ CookieServiceChild::CookieServiceChild() // Create a child PCookieService actor. gNeckoChild->SendPCookieServiceConstructor(this); - mIPCOpen = true; - mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID); NS_ASSERTION(mTLDService, "couldn't get TLDService"); @@ -156,16 +153,10 @@ CookieServiceChild::~CookieServiceChild() gCookieService = nullptr; } -void -CookieServiceChild::ActorDestroy(ActorDestroyReason why) -{ - mIPCOpen = false; -} - void CookieServiceChild::TrackCookieLoad(nsIChannel *aChannel) { - if (!mIPCOpen) { + if (!IPCOpen()) { return; } @@ -652,7 +643,7 @@ CookieServiceChild::SetCookieStringInternal(nsIURI *aHostURI, } // Asynchronously call the parent. - if (mIPCOpen) { + if (IPCOpen()) { SendSetCookieString(hostURIParams, channelURIParams, isForeign, isTrackingResource, firstPartyStorageAccessGranted, cookieString, diff --git a/netwerk/cookie/CookieServiceChild.h b/netwerk/cookie/CookieServiceChild.h index 5008df4f6a7e..de9137586c09 100644 --- a/netwerk/cookie/CookieServiceChild.h +++ b/netwerk/cookie/CookieServiceChild.h @@ -116,8 +116,6 @@ protected: mozilla::ipc::IPCResult RecvAddCookie(const CookieStruct &aCookie, const OriginAttributes &aAttrs) override; - virtual void ActorDestroy(ActorDestroyReason aWhy) override; - CookiesMap mCookiesMap; nsCOMPtr mCookieTimer; nsCOMPtr mThirdPartyUtil; @@ -126,7 +124,6 @@ protected: bool mThirdPartySession; bool mThirdPartyNonsecureSession; bool mLeaveSecureAlone; - bool mIPCOpen; }; } // namespace net diff --git a/netwerk/dns/DNSRequestChild.cpp b/netwerk/dns/DNSRequestChild.cpp index daa629de291e..94826e81c705 100644 --- a/netwerk/dns/DNSRequestChild.cpp +++ b/netwerk/dns/DNSRequestChild.cpp @@ -215,7 +215,7 @@ public: NS_IMETHOD Run() override { - if (mDnsRequest->mIPCOpen) { + if (mDnsRequest->IPCOpen()) { // Send request to Parent process. mDnsRequest->SendCancelDNSRequest(mDnsRequest->mHost, mDnsRequest->mType, @@ -247,7 +247,6 @@ DNSRequestChild::DNSRequestChild(const nsACString &aHost, , mType(aType) , mOriginAttributes(aOriginAttributes) , mFlags(aFlags) - , mIPCOpen(false) { } @@ -278,7 +277,6 @@ DNSRequestChild::StartRequest() // Send request to Parent process. gNeckoChild->SendPDNSRequestConstructor(this, mHost, mOriginAttributes, mFlags); - mIPCOpen = true; // IPDL holds a reference until IPDL channel gets destroyed AddIPDLReference(); @@ -302,7 +300,6 @@ DNSRequestChild::CallOnLookupByTypeComplete() mozilla::ipc::IPCResult DNSRequestChild::RecvLookupCompleted(const DNSRequestResponse& reply) { - mIPCOpen = false; MOZ_ASSERT(mListener); switch (reply.type()) { @@ -371,12 +368,6 @@ DNSRequestChild::ReleaseIPDLReference() Release(); } -void -DNSRequestChild::ActorDestroy(ActorDestroyReason why) -{ - mIPCOpen = false; -} - //----------------------------------------------------------------------------- // DNSRequestChild::nsISupports //----------------------------------------------------------------------------- @@ -391,7 +382,7 @@ NS_IMPL_ISUPPORTS(DNSRequestChild, NS_IMETHODIMP DNSRequestChild::Cancel(nsresult reason) { - if(mIPCOpen) { + if(IPCOpen()) { // We can only do IPDL on the main thread nsCOMPtr runnable = new CancelDNSRequestEvent(this, reason); SystemGroup::Dispatch(TaskCategory::Other, runnable.forget()); diff --git a/netwerk/dns/DNSRequestChild.h b/netwerk/dns/DNSRequestChild.h index dc25a9aeaf15..675d93165c4f 100644 --- a/netwerk/dns/DNSRequestChild.h +++ b/netwerk/dns/DNSRequestChild.h @@ -47,7 +47,6 @@ protected: virtual ~DNSRequestChild() {} virtual mozilla::ipc::IPCResult RecvLookupCompleted(const DNSRequestResponse& reply) override; - virtual void ActorDestroy(ActorDestroyReason why) override; nsCOMPtr mListener; nsCOMPtr mTarget; @@ -63,7 +62,6 @@ protected: uint16_t mType; const OriginAttributes mOriginAttributes; uint16_t mFlags; - bool mIPCOpen; }; } // namespace net diff --git a/netwerk/protocol/data/DataChannelChild.cpp b/netwerk/protocol/data/DataChannelChild.cpp index 90a765957350..cd6a52ce6406 100644 --- a/netwerk/protocol/data/DataChannelChild.cpp +++ b/netwerk/protocol/data/DataChannelChild.cpp @@ -17,7 +17,6 @@ NS_IMPL_ISUPPORTS_INHERITED(DataChannelChild, nsDataChannel, nsIChildChannel) DataChannelChild::DataChannelChild(nsIURI* aURI) : nsDataChannel(aURI) - , mIPCOpen(false) { } @@ -55,7 +54,7 @@ DataChannelChild::CompleteRedirectSetup(nsIStreamListener *aListener, return rv; } - if (mIPCOpen) { + if (IPCOpen()) { Unused << Send__delete__(this); } return NS_OK; @@ -65,14 +64,11 @@ void DataChannelChild::AddIPDLReference() { AddRef(); - mIPCOpen = true; } void DataChannelChild::ActorDestroy(ActorDestroyReason why) { - MOZ_ASSERT(mIPCOpen); - mIPCOpen = false; Release(); } diff --git a/netwerk/protocol/data/DataChannelChild.h b/netwerk/protocol/data/DataChannelChild.h index c220586a9b56..e2323b52067a 100644 --- a/netwerk/protocol/data/DataChannelChild.h +++ b/netwerk/protocol/data/DataChannelChild.h @@ -33,8 +33,6 @@ private: ~DataChannelChild() = default; void AddIPDLReference(); - - bool mIPCOpen; }; } // namespace net diff --git a/netwerk/protocol/file/FileChannelChild.cpp b/netwerk/protocol/file/FileChannelChild.cpp index 15cc61cb88cb..59eec4a4d800 100644 --- a/netwerk/protocol/file/FileChannelChild.cpp +++ b/netwerk/protocol/file/FileChannelChild.cpp @@ -17,7 +17,6 @@ NS_IMPL_ISUPPORTS_INHERITED(FileChannelChild, nsFileChannel, nsIChildChannel) FileChannelChild::FileChannelChild(nsIURI *uri) : nsFileChannel(uri) - , mIPCOpen(false) { } @@ -55,7 +54,7 @@ FileChannelChild::CompleteRedirectSetup(nsIStreamListener *listener, return rv; } - if (mIPCOpen) { + if (IPCOpen()) { Unused << Send__delete__(this); } @@ -66,14 +65,11 @@ void FileChannelChild::AddIPDLReference() { AddRef(); - mIPCOpen = true; } void FileChannelChild::ActorDestroy(ActorDestroyReason why) { - MOZ_ASSERT(mIPCOpen); - mIPCOpen = false; Release(); } diff --git a/netwerk/protocol/file/FileChannelChild.h b/netwerk/protocol/file/FileChannelChild.h index f59ef593651a..6cd852cfd98c 100644 --- a/netwerk/protocol/file/FileChannelChild.h +++ b/netwerk/protocol/file/FileChannelChild.h @@ -33,8 +33,6 @@ private: ~FileChannelChild() = default;; void AddIPDLReference(); - - bool mIPCOpen; }; } // namespace net diff --git a/netwerk/protocol/ftp/FTPChannelChild.cpp b/netwerk/protocol/ftp/FTPChannelChild.cpp index ae2f684164d8..ce79a57232ed 100644 --- a/netwerk/protocol/ftp/FTPChannelChild.cpp +++ b/netwerk/protocol/ftp/FTPChannelChild.cpp @@ -34,8 +34,7 @@ namespace mozilla { namespace net { FTPChannelChild::FTPChannelChild(nsIURI* uri) -: mIPCOpen(false) -, mUnknownDecoderInvolved(false) +: mUnknownDecoderInvolved(false) , mCanceled(false) , mSuspendCount(0) , mIsPending(false) @@ -65,16 +64,12 @@ FTPChannelChild::~FTPChannelChild() void FTPChannelChild::AddIPDLReference() { - MOZ_ASSERT(!mIPCOpen, "Attempt to retain more than one IPDL reference"); - mIPCOpen = true; AddRef(); } void FTPChannelChild::ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen, "Attempt to release nonexistent IPDL reference"); - mIPCOpen = false; Release(); } @@ -687,8 +682,9 @@ FTPChannelChild::DoFailedAsyncOpen(const nsresult& statusCode) mListener = nullptr; mListenerContext = nullptr; - if (mIPCOpen) + if (IPCOpen()) { Send__delete__(this); + } } class FTPFlushedForDiversionEvent : public NeckoTargetChannelEvent @@ -763,8 +759,9 @@ FTPChannelChild::RecvDeleteSelf() void FTPChannelChild::DoDeleteSelf() { - if (mIPCOpen) + if (IPCOpen()) { Send__delete__(this); + } } NS_IMETHODIMP @@ -776,15 +773,16 @@ FTPChannelChild::Cancel(nsresult status) mCanceled = true; mStatus = status; - if (mIPCOpen) + if (IPCOpen()) { SendCancel(status); + } return NS_OK; } NS_IMETHODIMP FTPChannelChild::Suspend() { - NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_NOT_AVAILABLE); + NS_ENSURE_TRUE(IPCOpen(), NS_ERROR_NOT_AVAILABLE); LOG(("FTPChannelChild::Suspend [this=%p]\n", this)); @@ -803,7 +801,7 @@ FTPChannelChild::Suspend() NS_IMETHODIMP FTPChannelChild::Resume() { - NS_ENSURE_TRUE(mIPCOpen, NS_ERROR_NOT_AVAILABLE); + NS_ENSURE_TRUE(IPCOpen(), NS_ERROR_NOT_AVAILABLE); LOG(("FTPChannelChild::Resume [this=%p]\n", this)); @@ -905,7 +903,7 @@ FTPChannelChild::DivertToParent(ChannelDiverterChild **aChild) // We must fail DivertToParent() if there's no parent end of the channel (and // won't be!) due to early failure. - if (NS_FAILED(mStatus) && !mIPCOpen) { + if (NS_FAILED(mStatus) && !IPCOpen()) { return mStatus; } diff --git a/netwerk/protocol/ftp/FTPChannelChild.h b/netwerk/protocol/ftp/FTPChannelChild.h index ac0af2b406d3..bc5a1fd5b24d 100644 --- a/netwerk/protocol/ftp/FTPChannelChild.h +++ b/netwerk/protocol/ftp/FTPChannelChild.h @@ -133,7 +133,6 @@ protected: private: nsCOMPtr mUploadStream; - bool mIPCOpen; RefPtr mEventQ; // If nsUnknownDecoder is involved we queue onDataAvailable (and possibly diff --git a/netwerk/protocol/http/AltDataOutputStreamChild.cpp b/netwerk/protocol/http/AltDataOutputStreamChild.cpp index 78d1b398e1b1..65e024ef1d19 100644 --- a/netwerk/protocol/http/AltDataOutputStreamChild.cpp +++ b/netwerk/protocol/http/AltDataOutputStreamChild.cpp @@ -14,7 +14,7 @@ NS_IMETHODIMP_(MozExternalRefCountType) AltDataOutputStreamChild::Release() --mRefCnt; NS_LOG_RELEASE(this, mRefCnt, "AltDataOutputStreamChild"); - if (mRefCnt == 1 && mIPCOpen) { + if (mRefCnt == 1 && IPCOpen()) { // The only reference left is the IPDL one. After the parent replies back // with a DeleteSelf message, the child will call Send__delete__(this), // decrementing the ref count and triggering the destructor. @@ -36,8 +36,7 @@ NS_INTERFACE_MAP_BEGIN(AltDataOutputStreamChild) NS_INTERFACE_MAP_END AltDataOutputStreamChild::AltDataOutputStreamChild() - : mIPCOpen(false) - , mError(NS_OK) + : mError(NS_OK) { MOZ_ASSERT(NS_IsMainThread(), "Main thread only"); } @@ -45,16 +44,12 @@ AltDataOutputStreamChild::AltDataOutputStreamChild() void AltDataOutputStreamChild::AddIPDLReference() { - MOZ_ASSERT(!mIPCOpen, "Attempt to retain more than one IPDL reference"); - mIPCOpen = true; AddRef(); } void AltDataOutputStreamChild::ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen, "Attempt to release nonexistent IPDL reference"); - mIPCOpen = false; Release(); } @@ -66,8 +61,7 @@ AltDataOutputStreamChild::WriteDataInChunks(const nsDependentCSubstring& data) for (uint32_t i = 0; i < data.Length(); i = next, next = std::min(data.Length(), next + kChunkSize)) { nsCString chunk(Substring(data, i, kChunkSize)); - if (mIPCOpen && !SendWriteData(chunk)) { - mIPCOpen = false; + if (IPCOpen() && !SendWriteData(chunk)) { return false; } } @@ -77,7 +71,7 @@ AltDataOutputStreamChild::WriteDataInChunks(const nsDependentCSubstring& data) NS_IMETHODIMP AltDataOutputStreamChild::Close() { - if (!mIPCOpen) { + if (!IPCOpen()) { return NS_ERROR_NOT_AVAILABLE; } if (NS_FAILED(mError)) { @@ -90,7 +84,7 @@ AltDataOutputStreamChild::Close() NS_IMETHODIMP AltDataOutputStreamChild::Flush() { - if (!mIPCOpen) { + if (!IPCOpen()) { return NS_ERROR_NOT_AVAILABLE; } if (NS_FAILED(mError)) { @@ -104,7 +98,7 @@ AltDataOutputStreamChild::Flush() NS_IMETHODIMP AltDataOutputStreamChild::Write(const char * aBuf, uint32_t aCount, uint32_t *_retval) { - if (!mIPCOpen) { + if (!IPCOpen()) { return NS_ERROR_NOT_AVAILABLE; } if (NS_FAILED(mError)) { diff --git a/netwerk/protocol/http/AltDataOutputStreamChild.h b/netwerk/protocol/http/AltDataOutputStreamChild.h index 48a92f54a8d1..f30ff5c2b423 100644 --- a/netwerk/protocol/http/AltDataOutputStreamChild.h +++ b/netwerk/protocol/http/AltDataOutputStreamChild.h @@ -34,7 +34,6 @@ private: // Sends data to the parent process in 256k chunks. bool WriteDataInChunks(const nsDependentCSubstring& data); - bool mIPCOpen; // If there was an error opening the output stream or writing to it on the // parent side, this will be set to the error code. We check it before we // write so we can report an error to the consumer. diff --git a/netwerk/protocol/http/AltDataOutputStreamParent.cpp b/netwerk/protocol/http/AltDataOutputStreamParent.cpp index a764b2a459f4..11442bf7b9c6 100644 --- a/netwerk/protocol/http/AltDataOutputStreamParent.cpp +++ b/netwerk/protocol/http/AltDataOutputStreamParent.cpp @@ -16,7 +16,6 @@ NS_IMPL_ISUPPORTS0(AltDataOutputStreamParent) AltDataOutputStreamParent::AltDataOutputStreamParent(nsIOutputStream* aStream) : mOutputStream(aStream) , mStatus(NS_OK) - , mIPCOpen(true) { MOZ_ASSERT(NS_IsMainThread(), "Main thread only"); } @@ -30,7 +29,7 @@ mozilla::ipc::IPCResult AltDataOutputStreamParent::RecvWriteData(const nsCString& data) { if (NS_FAILED(mStatus)) { - if (mIPCOpen) { + if (IPCOpen()) { Unused << SendError(mStatus); } return IPC_OK(); @@ -40,7 +39,7 @@ AltDataOutputStreamParent::RecvWriteData(const nsCString& data) if (mOutputStream) { rv = mOutputStream->Write(data.BeginReading(), data.Length(), &n); MOZ_ASSERT(n == data.Length() || NS_FAILED(rv)); - if (NS_FAILED(rv) && mIPCOpen) { + if (NS_FAILED(rv) && IPCOpen()) { Unused << SendError(rv); } } @@ -51,7 +50,7 @@ mozilla::ipc::IPCResult AltDataOutputStreamParent::RecvClose() { if (NS_FAILED(mStatus)) { - if (mIPCOpen) { + if (IPCOpen()) { Unused << SendError(mStatus); } return IPC_OK(); @@ -59,7 +58,7 @@ AltDataOutputStreamParent::RecvClose() nsresult rv; if (mOutputStream) { rv = mOutputStream->Close(); - if (NS_FAILED(rv) && mIPCOpen) { + if (NS_FAILED(rv) && IPCOpen()) { Unused << SendError(rv); } mOutputStream = nullptr; @@ -67,16 +66,9 @@ AltDataOutputStreamParent::RecvClose() return IPC_OK(); } -void -AltDataOutputStreamParent::ActorDestroy(ActorDestroyReason aWhy) -{ - mIPCOpen = false; -} - mozilla::ipc::IPCResult AltDataOutputStreamParent::RecvDeleteSelf() { - mIPCOpen = false; Unused << SendDeleteSelf(); return IPC_OK(); } diff --git a/netwerk/protocol/http/AltDataOutputStreamParent.h b/netwerk/protocol/http/AltDataOutputStreamParent.h index b2f876218db5..3cca1daead74 100644 --- a/netwerk/protocol/http/AltDataOutputStreamParent.h +++ b/netwerk/protocol/http/AltDataOutputStreamParent.h @@ -33,7 +33,6 @@ public: // Called when AltDataOutputStreamChild::Close() is // Closes and nulls the output stream. virtual mozilla::ipc::IPCResult RecvClose() override; - virtual void ActorDestroy(ActorDestroyReason aWhy) override; // Sets an error that will be reported to the content process. void SetError(nsresult status) { mStatus = status; } @@ -45,7 +44,6 @@ private: // In case any error occurs mStatus will be != NS_OK, and this status code will // be sent to the content process asynchronously. nsresult mStatus; - bool mIPCOpen; }; } // namespace net diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index aabc1ca1ad96..9aafc668fcec 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -2441,10 +2441,11 @@ HttpChannelChild::OnRedirectVerifyCallback(nsresult result) ChildLoadInfoForwarderArgs loadInfoForwarder; LoadInfoToChildLoadInfoForwarder(newChannelLoadInfo, &loadInfoForwarder); - if (mIPCOpen) + if (mIPCOpen) { SendRedirect2Verify(result, *headerTuples, loadInfoForwarder, loadFlags, referrerPolicy, referrerURI, redirectURI, corsPreflightArgs, chooseAppcache); + } return NS_OK; } diff --git a/netwerk/protocol/websocket/WebSocketChannelParent.cpp b/netwerk/protocol/websocket/WebSocketChannelParent.cpp index 68722e2b030d..84a8c18d5bbe 100644 --- a/netwerk/protocol/websocket/WebSocketChannelParent.cpp +++ b/netwerk/protocol/websocket/WebSocketChannelParent.cpp @@ -29,7 +29,6 @@ WebSocketChannelParent::WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvi uint32_t aSerial) : mAuthProvider(aAuthProvider) , mLoadContext(aLoadContext) - , mIPCOpen(true) , mSerial(aSerial) { // Websocket channels can't have a private browsing override @@ -46,7 +45,7 @@ WebSocketChannelParent::RecvDeleteSelf() mChannel = nullptr; mAuthProvider = nullptr; IProtocol* mgr = Manager(); - if (mIPCOpen && !Send__delete__(this)) { + if (IPCOpen() && !Send__delete__(this)) { return IPC_FAIL_NO_REASON(mgr); } return IPC_OK(); @@ -222,7 +221,7 @@ WebSocketChannelParent::OnStart(nsISupports *aContext) channel->GetEffectiveURL(effectiveURL); encrypted = channel->IsEncrypted(); } - if (!mIPCOpen || !SendOnStart(protocol, extensions, effectiveURL, encrypted)) { + if (!IPCOpen() || !SendOnStart(protocol, extensions, effectiveURL, encrypted)) { return NS_ERROR_FAILURE; } return NS_OK; @@ -232,7 +231,7 @@ NS_IMETHODIMP WebSocketChannelParent::OnStop(nsISupports *aContext, nsresult aStatusCode) { LOG(("WebSocketChannelParent::OnStop() %p\n", this)); - if (!mIPCOpen || !SendOnStop(aStatusCode)) { + if (!IPCOpen() || !SendOnStop(aStatusCode)) { return NS_ERROR_FAILURE; } return NS_OK; @@ -242,7 +241,7 @@ NS_IMETHODIMP WebSocketChannelParent::OnMessageAvailable(nsISupports *aContext, const nsACString& aMsg) { LOG(("WebSocketChannelParent::OnMessageAvailable() %p\n", this)); - if (!mIPCOpen || !SendOnMessageAvailable(nsCString(aMsg))) { + if (!IPCOpen() || !SendOnMessageAvailable(nsCString(aMsg))) { return NS_ERROR_FAILURE; } return NS_OK; @@ -252,7 +251,7 @@ NS_IMETHODIMP WebSocketChannelParent::OnBinaryMessageAvailable(nsISupports *aContext, const nsACString& aMsg) { LOG(("WebSocketChannelParent::OnBinaryMessageAvailable() %p\n", this)); - if (!mIPCOpen || !SendOnBinaryMessageAvailable(nsCString(aMsg))) { + if (!IPCOpen() || !SendOnBinaryMessageAvailable(nsCString(aMsg))) { return NS_ERROR_FAILURE; } return NS_OK; @@ -262,7 +261,7 @@ NS_IMETHODIMP WebSocketChannelParent::OnAcknowledge(nsISupports *aContext, uint32_t aSize) { LOG(("WebSocketChannelParent::OnAcknowledge() %p\n", this)); - if (!mIPCOpen || !SendOnAcknowledge(aSize)) { + if (!IPCOpen() || !SendOnAcknowledge(aSize)) { return NS_ERROR_FAILURE; } return NS_OK; @@ -273,7 +272,7 @@ WebSocketChannelParent::OnServerClose(nsISupports *aContext, uint16_t code, const nsACString & reason) { LOG(("WebSocketChannelParent::OnServerClose() %p\n", this)); - if (!mIPCOpen || !SendOnServerClose(code, nsCString(reason))) { + if (!IPCOpen() || !SendOnServerClose(code, nsCString(reason))) { return NS_ERROR_FAILURE; } return NS_OK; @@ -290,8 +289,6 @@ WebSocketChannelParent::ActorDestroy(ActorDestroyReason why) Unused << mChannel->Close(nsIWebSocketChannel::CLOSE_GOING_AWAY, NS_LITERAL_CSTRING("Child was killed")); } - - mIPCOpen = false; } //----------------------------------------------------------------------------- diff --git a/netwerk/protocol/websocket/WebSocketChannelParent.h b/netwerk/protocol/websocket/WebSocketChannelParent.h index 705b73d97c22..09ad65ab691e 100644 --- a/netwerk/protocol/websocket/WebSocketChannelParent.h +++ b/netwerk/protocol/websocket/WebSocketChannelParent.h @@ -61,7 +61,6 @@ class WebSocketChannelParent : public PWebSocketParent, nsCOMPtr mAuthProvider; nsCOMPtr mChannel; nsCOMPtr mLoadContext; - bool mIPCOpen; uint32_t mSerial; }; diff --git a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp index 3cc561e26e41..e7717ae83e14 100644 --- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp +++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp @@ -47,7 +47,6 @@ WyciwygChannelChild::WyciwygChannelChild(nsIEventTarget *aNeckoTarget) , mContentLength(-1) , mCharsetSource(kCharsetUninitialized) , mState(WCC_NEW) - , mIPCOpen(false) , mSentAppData(false) { LOG(("Creating WyciwygChannelChild @%p\n", this)); @@ -74,16 +73,12 @@ WyciwygChannelChild::~WyciwygChannelChild() void WyciwygChannelChild::AddIPDLReference() { - MOZ_ASSERT(!mIPCOpen, "Attempt to retain more than one IPDL reference"); - mIPCOpen = true; AddRef(); } void WyciwygChannelChild::ReleaseIPDLReference() { - MOZ_ASSERT(mIPCOpen, "Attempt to release nonexistent IPDL reference"); - mIPCOpen = false; Release(); } @@ -328,8 +323,9 @@ WyciwygChannelChild::OnStopRequest(const nsresult& statusCode) mProgressSink = nullptr; } - if (mIPCOpen) + if (IPCOpen()) { PWyciwygChannelChild::Send__delete__(this); + } } class WyciwygCancelEvent : public NeckoTargetChannelEvent @@ -373,8 +369,9 @@ void WyciwygChannelChild::CancelEarly(const nsresult& statusCode) mListener = nullptr; mListenerContext = nullptr; - if (mIPCOpen) + if (IPCOpen()) { PWyciwygChannelChild::Send__delete__(this); + } } //----------------------------------------------------------------------------- @@ -409,8 +406,9 @@ WyciwygChannelChild::Cancel(nsresult aStatus) mCanceled = true; mStatus = aStatus; - if (mIPCOpen) + if (IPCOpen()) { SendCancel(aStatus); + } return NS_OK; } @@ -753,8 +751,9 @@ WyciwygChannelChild::CloseCacheEntry(nsresult reason) SendCloseCacheEntry(reason); mState = WCC_ONCLOSED; - if (mIPCOpen) + if (IPCOpen()) { PWyciwygChannelChild::Send__delete__(this); + } return NS_OK; } diff --git a/netwerk/protocol/wyciwyg/WyciwygChannelChild.h b/netwerk/protocol/wyciwyg/WyciwygChannelChild.h index 3790c29df714..3f395da02acd 100644 --- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.h +++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.h @@ -104,7 +104,6 @@ private: // FIXME: replace with IPDL states (bug 536319) enum WyciwygChannelChildState mState; - bool mIPCOpen; bool mSentAppData; RefPtr mEventQ; diff --git a/security/manager/ssl/PSMContentListener.cpp b/security/manager/ssl/PSMContentListener.cpp index 4f5f25967600..c57ec9fd942b 100644 --- a/security/manager/ssl/PSMContentListener.cpp +++ b/security/manager/ssl/PSMContentListener.cpp @@ -213,7 +213,6 @@ PSMContentStreamListener::ImportCertificate() PSMContentDownloaderParent::PSMContentDownloaderParent(uint32_t type) : PSMContentStreamListener(type) - , mIPCOpen(true) { } @@ -248,7 +247,7 @@ PSMContentDownloaderParent::RecvOnStopRequest(const nsresult& code) ImportCertificate(); } - if (mIPCOpen) { + if (IPCOpen()) { mozilla::Unused << Send__delete__(this); } return IPC_OK(); @@ -259,7 +258,7 @@ PSMContentDownloaderParent::OnStopRequest(nsIRequest* request, nsISupports* cont { nsresult rv = PSMContentStreamListener::OnStopRequest(request, context, code); - if (mIPCOpen) { + if (IPCOpen()) { mozilla::Unused << Send__delete__(this); } return rv; @@ -275,12 +274,6 @@ PSMContentDownloaderParent::RecvDivertToParentUsing(mozilla::net::PChannelDivert return IPC_OK(); } -void -PSMContentDownloaderParent::ActorDestroy(ActorDestroyReason why) -{ - mIPCOpen = false; -} - /* ------------------------ * PSMContentDownloaderChild * ------------------------ */ diff --git a/security/manager/ssl/PSMContentListener.h b/security/manager/ssl/PSMContentListener.h index 52e864952f15..ce529a27c92d 100644 --- a/security/manager/ssl/PSMContentListener.h +++ b/security/manager/ssl/PSMContentListener.h @@ -67,9 +67,6 @@ public: protected: virtual ~PSMContentDownloaderParent(); - - virtual void ActorDestroy(ActorDestroyReason why) override; - bool mIPCOpen; }; // Child actor for importing a cert. diff --git a/toolkit/components/reputationservice/LoginReputationIPC.cpp b/toolkit/components/reputationservice/LoginReputationIPC.cpp index 9f35f44798d7..f0da32ad2ed9 100644 --- a/toolkit/components/reputationservice/LoginReputationIPC.cpp +++ b/toolkit/components/reputationservice/LoginReputationIPC.cpp @@ -46,14 +46,8 @@ LoginReputationParent::OnComplete(nsresult aResult, LR_LOG(("OnComplete() [verdict=%s]", LoginReputationService::VerdictTypeToString(aVerdict).get())); - if (mIPCOpen) { + if (IPCOpen()) { Unused << Send__delete__(this); } return NS_OK; } - -void -LoginReputationParent::ActorDestroy(ActorDestroyReason aWhy) -{ - mIPCOpen = false; -} diff --git a/toolkit/components/reputationservice/LoginReputationIPC.h b/toolkit/components/reputationservice/LoginReputationIPC.h index 8649867aa2d7..0b7f4ea92c8d 100644 --- a/toolkit/components/reputationservice/LoginReputationIPC.h +++ b/toolkit/components/reputationservice/LoginReputationIPC.h @@ -24,11 +24,8 @@ public: mozilla::ipc::IPCResult QueryReputation(nsIURI* aURI); - void ActorDestroy(ActorDestroyReason aWhy) override; - private: ~LoginReputationParent() = default; - bool mIPCOpen = true; }; } // namespace dom