Bug 1455974 - Ensure that mCanSend is cleared at the right time. r=sotaro
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 23 Apr 2018 14:24:36 -0400
changeset 468954 c9ee020a4abde994cd2f626665c6c0f6d1ed3530
parent 468953 9c2af62ba0cd59f8bd0b4cdbf037576db7a150bd
child 468955 59f704125010863c16501f1d401112807f01e7b8
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1455974
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455974 - Ensure that mCanSend is cleared at the right time. r=sotaro mCanSend was being cleared in ActorDestroy which is fine, but we actually cannot reliably send IPC messages from CompositorBridgeParent after we get a RecvWillClose message, because that's the last thing that the child side sends before it gets destroyed. After the WillClose message there's no guarantee that the child side actor will still be alive. So this patch also sets mCanSend to false in RecvWillClose. mCanSend is only used in two places, both of which have to do with the APZ metrics-sharing code, so this shouldn't have any unexpected side-effects. It is needed for the next patch. MozReview-Commit-ID: 8CuFienWVUU
gfx/layers/ipc/CompositorBridgeParent.cpp
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -512,16 +512,19 @@ CompositorBridgeParent::StopAndClearReso
   // still exists when we destroy it.
   mAnimationStorage = nullptr;
 }
 
 mozilla::ipc::IPCResult
 CompositorBridgeParent::RecvWillClose()
 {
   StopAndClearResources();
+  // Once we get the WillClose message, the client side is going to go away
+  // soon and we can't be guaranteed that sending messages will work.
+  mCanSend = false;
   return IPC_OK();
 }
 
 void CompositorBridgeParent::DeferredDestroy()
 {
   MOZ_ASSERT(!NS_IsMainThread());
   mSelfRef = nullptr;
 }