# HG changeset patch # User Jed Davis # Date 1539984574 21600 # Node ID 1ca458791c2739f9c6bc7abe2b0672ed3518e9a3 # Parent ae3ad508fac346e96eb58e12ed95200725621d68 Bug 1498765 - Clean up ContentParent::KillHard handling. r=mccr8 MessageChannel shouldn't need to care about PContent-specific details. diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -3026,21 +3026,16 @@ ContentParent::KillHard(const char* aRea // process handle becomes invalid on the first call, causing a second call // to crash our process - more details in bug 890840. if (mCalledKillHard) { return; } mCalledKillHard = true; mForceKillTimer = nullptr; - MessageChannel* channel = GetIPCChannel(); - if (channel) { - channel->SetInKillHardShutdown(); - } - // We're about to kill the child process associated with this content. // Something has gone wrong to get us here, so we generate a minidump // of the parent and child for submission to the crash server. if (mCrashReporter) { // GeneratePairedMinidump creates two minidumps for us - the main // one is for the content process we're about to kill, and the other // one is for the main browser process. That second one is the extra // minidump tagging along, so we have to tell the crash reporter that diff --git a/ipc/glue/MessageChannel.cpp b/ipc/glue/MessageChannel.cpp --- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -529,18 +529,17 @@ MessageChannel::MessageChannel(const cha mRemoteStackDepthGuess(0), mSawInterruptOutMsg(false), mIsWaitingForIncoming(false), mAbortOnError(false), mNotifiedChannelDone(false), mFlags(REQUIRE_DEFAULT), mPeerPidSet(false), mPeerPid(-1), - mIsPostponingSends(false), - mInKillHardShutdown(false) + mIsPostponingSends(false) { MOZ_COUNT_CTOR(ipc::MessageChannel); #ifdef OS_WIN mTopFrame = nullptr; mIsSyncWaitingOnNonMainThread = false; #endif @@ -695,20 +694,17 @@ MessageChannel::Clear() // Also don't clear mListener. If we clear it, then sending a message // through this channel after it's Clear()'ed can cause this process to // crash. // // In practice, mListener owns the channel, so the channel gets deleted // before mListener. But just to be safe, mListener is a weak pointer. #if !defined(ANDROID) - // KillHard shutdowns can occur with the channel in connected state. We are - // already collecting crash dump data about KillHard shutdowns and we - // shouldn't intentionally crash here. - if (!Unsound_IsClosed() && !mInKillHardShutdown) { + if (!Unsound_IsClosed()) { CrashReporter::AnnotateCrashReport( CrashReporter::Annotation::IPCFatalErrorProtocol, nsDependentCString(mName)); switch (mChannelState) { case ChannelOpening: MOZ_CRASH("MessageChannel destroyed without being closed " \ "(mChannelState == ChannelOpening)."); break; case ChannelConnected: diff --git a/ipc/glue/MessageChannel.h b/ipc/glue/MessageChannel.h --- a/ipc/glue/MessageChannel.h +++ b/ipc/glue/MessageChannel.h @@ -322,20 +322,16 @@ private: static bool IsPumpingMessages() { return sIsPumpingMessages; } static void SetIsPumpingMessages(bool aIsPumping) { sIsPumpingMessages = aIsPumping; } - void SetInKillHardShutdown() { - mInKillHardShutdown = true; - } - #ifdef OS_WIN struct MOZ_STACK_CLASS SyncStackFrame { SyncStackFrame(MessageChannel* channel, bool interrupt); ~SyncStackFrame(); bool mInterrupt; bool mSpinNestedEvents; @@ -853,18 +849,16 @@ private: RefPtr mOnChannelConnectedTask; bool mPeerPidSet; int32_t mPeerPid; // Channels can enter messages are not sent immediately; instead, they are // held in a queue until another thread deems it is safe to send them. bool mIsPostponingSends; std::vector> mPostponedSends; - - bool mInKillHardShutdown; }; void CancelCPOWs(); } // namespace ipc } // namespace mozilla