Allow top-level window changes to the remembered compositor type. (bug 1211109 part 3, r=mattwoodrow)
authorDavid Anderson <danderson@mozilla.com>
Mon, 05 Oct 2015 23:39:28 -0700
changeset 266158 f6dfce68d9e6d67cdff0630cb90f31a8b40d5653
parent 266157 34e69198f0187b5a224d12303faed2da6a375cc0
child 266159 13badd64d40f65168cd94a464784e093e61b0cf0
push id66137
push userdanderson@mozilla.com
push dateTue, 06 Oct 2015 06:41:06 +0000
treeherdermozilla-inbound@13badd64d40f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1211109
milestone44.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
Allow top-level window changes to the remembered compositor type. (bug 1211109 part 3, r=mattwoodrow)
gfx/thebes/gfxPlatform.cpp
widget/nsBaseWidget.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2203,17 +2203,20 @@ gfxPlatform::GetCompositorBackends(bool 
 
 void
 gfxPlatform::NotifyCompositorCreated(LayersBackend aBackend)
 {
   if (mCompositorBackend == aBackend) {
     return;
   }
 
-  NS_ASSERTION(mCompositorBackend == LayersBackend::LAYERS_NONE, "Compositor backend changed.");
+  if (mCompositorBackend != LayersBackend::LAYERS_NONE) {
+    gfxCriticalNote << "Compositors might be mixed ("
+      << int(mCompositorBackend) << "," << int(aBackend) << ")";
+  }
 
   // Set the backend before we notify so it's available immediately.
   mCompositorBackend = aBackend;
 
   // Notify that we created a compositor, so telemetry can update.
   NS_DispatchToMainThread(NS_NewRunnableFunction([] {
     if (nsCOMPtr<nsIObserverService> obsvc = services::GetObserverService()) {
       obsvc->NotifyObservers(nullptr, "compositor:created", nullptr);
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -1127,17 +1127,21 @@ void nsBaseWidget::CreateCompositor(int 
 
   lf->SetShadowManager(shadowManager);
   lf->IdentifyTextureHost(textureFactoryIdentifier);
   ImageBridgeChild::IdentifyCompositorTextureHost(textureFactoryIdentifier);
   WindowUsesOMTC();
 
   mLayerManager = lm.forget();
 
-  gfxPlatform::GetPlatform()->NotifyCompositorCreated(mLayerManager->GetCompositorBackendType());
+  if (mWindowType == eWindowType_toplevel) {
+    // Only track compositors for top-level windows, since other window types
+    // may use the basic compositor.
+    gfxPlatform::GetPlatform()->NotifyCompositorCreated(mLayerManager->GetCompositorBackendType());
+  }
 }
 
 bool nsBaseWidget::ShouldUseOffMainThreadCompositing()
 {
   return gfxPlatform::UsesOffMainThreadCompositing();
 }
 
 LayerManager* nsBaseWidget::GetLayerManager(PLayerTransactionChild* aShadowManager,