Bug 1454974 - Assert if RecvGetSnapshot ever gets called in a non-root WRBP. r=sotaro
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 18 Apr 2018 16:44:03 -0400
changeset 467939 86448c7121285f7fab7cb481ec0f06816634c5e3
parent 467938 46ea55337b33a0c5aa7b2cc71848139e7976f293
child 467940 18a5d8eaa39deb6dbc1217945bd2ca5d8fffb05e
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
bugs1454974
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 1454974 - Assert if RecvGetSnapshot ever gets called in a non-root WRBP. r=sotaro MozReview-Commit-ID: L6bUdfEykx7
gfx/layers/wr/WebRenderBridgeParent.cpp
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -791,16 +791,23 @@ WebRenderBridgeParent::ProcessWebRenderP
 mozilla::ipc::IPCResult
 WebRenderBridgeParent::RecvGetSnapshot(PTextureParent* aTexture)
 {
   if (mDestroyed) {
     return IPC_OK();
   }
   MOZ_ASSERT(!mPaused);
 
+  // This function should only get called in the root WRBP. If this function
+  // gets called in a non-root WRBP, we will set mForceRendering in this WRBP
+  // but it will have no effect because CompositeToTarget (which reads the
+  // flag) only gets invoked in the root WRBP. So we assert that this is the
+  // root WRBP (i.e. has a non-null mWidget) to catch violations of this rule.
+  MOZ_ASSERT(mWidget);
+
   RefPtr<TextureHost> texture = TextureHost::AsTextureHost(aTexture);
   if (!texture) {
     // We kill the content process rather than have it continue with an invalid
     // snapshot, that may be too harsh and we could decide to return some sort
     // of error to the child process and let it deal with it...
     return IPC_FAIL_NO_REASON(this);
   }
 
@@ -1194,16 +1201,19 @@ WebRenderBridgeParent::SampleAnimations(
       }
     }
   }
 }
 
 void
 WebRenderBridgeParent::CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect)
 {
+  // This function should only get called in the root WRBP
+  MOZ_ASSERT(mWidget);
+
   // The two arguments are part of the CompositorVsyncSchedulerOwner API but in
   // this implementation they should never be non-null.
   MOZ_ASSERT(aTarget == nullptr);
   MOZ_ASSERT(aRect == nullptr);
 
   AUTO_PROFILER_TRACING("Paint", "CompositeToTraget");
   if (mPaused || !mReceivedDisplayList) {
     return;