Bug 948555. Fix a bogus assert in CompositorParent. r=mattwoodrow
authorNicholas Cameron <ncameron@mozilla.com>
Wed, 11 Dec 2013 16:51:00 +1300
changeset 159830 d14c74014d9513c4ba1555c7917e3dbbc854087f
parent 159829 21ecf45dd59015d26b0ed46571745a41ce31f714
child 159831 744abfd3ed39b168ce52907fddd848ec9d2d5be9
child 159894 12ea03a702437fb9421c94756436d867f809bf79
push id37435
push userncameron@mozilla.com
push dateWed, 11 Dec 2013 03:51:37 +0000
treeherdermozilla-inbound@d14c74014d95 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs948555
milestone29.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 948555. Fix a bogus assert in CompositorParent. r=mattwoodrow
gfx/layers/ipc/CompositorParent.cpp
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -705,16 +705,17 @@ CompositorParent::ShadowLayersUpdated(La
   ScheduleComposition();
   mCompositor->NotifyLayersTransaction();
 }
 
 void
 CompositorParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints)
 {
   NS_ASSERTION(!mLayerManager, "Already initialised mLayerManager");
+  NS_ASSERTION(!mCompositor,   "Already initialised mCompositor");
 
   for (size_t i = 0; i < aBackendHints.Length(); ++i) {
     RefPtr<Compositor> compositor;
     if (aBackendHints[i] == LAYERS_OPENGL) {
       compositor = new CompositorOGL(mWidget,
                                      mEGLSurfaceSize.width,
                                      mEGLSurfaceSize.height,
                                      mUseExternalSurfaceSize);
@@ -723,17 +724,21 @@ CompositorParent::InitializeLayerManager
 #ifdef XP_WIN
     } else if (aBackendHints[i] == LAYERS_D3D11) {
       compositor = new CompositorD3D11(mWidget);
     } else if (aBackendHints[i] == LAYERS_D3D9) {
       compositor = new CompositorD3D9(this, mWidget);
 #endif
     }
 
-    MOZ_ASSERT(compositor, "Passed invalid backend hint");
+    if (!compositor) {
+      // We passed a backend hint for which we can't create a compositor.
+      // For example, we sometime pass LAYERS_NONE as filler in aBackendHints.
+      continue;
+    }
 
     compositor->SetCompositorID(mCompositorID);
     RefPtr<LayerManagerComposite> layerManager = new LayerManagerComposite(compositor);
 
     if (layerManager->Initialize()) {
       mLayerManager = layerManager;
       MOZ_ASSERT(compositor);
       mCompositor = compositor;