Bug 1049303 - Avoid an invalid cast to ClientThebesLayer when we're using tiling. r=Bas
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 07 Aug 2014 11:55:31 +1200
changeset 198482 c20ec99f9a19702b3b127c64d561c0d9eaf7a679
parent 198481 da90bd5e5145582e21926a6823f3a74102e311ab
child 198483 c7089f9065dae6785e9d514f152813df54c78da5
push id27272
push useremorley@mozilla.com
push dateFri, 08 Aug 2014 14:41:27 +0000
treeherdermozilla-central@96a566fa1599 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs1049303
milestone34.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 1049303 - Avoid an invalid cast to ClientThebesLayer when we're using tiling. r=Bas
gfx/layers/client/ClientContainerLayer.h
gfx/layers/client/ClientLayerManager.h
gfx/layers/client/ClientThebesLayer.cpp
gfx/layers/client/ClientThebesLayer.h
--- a/gfx/layers/client/ClientContainerLayer.h
+++ b/gfx/layers/client/ClientContainerLayer.h
@@ -61,21 +61,17 @@ public:
     readback.BuildUpdates(this);
 
     for (uint32_t i = 0; i < children.Length(); i++) {
       Layer* child = children.ElementAt(i);
       if (child->GetEffectiveVisibleRegion().IsEmpty()) {
         continue;
       }
 
-      if (child->GetType() != TYPE_THEBES) {
-        ToClientLayer(child)->RenderLayer();
-      } else {
-        static_cast<ClientThebesLayer*>(child)->RenderLayer(&readback);
-      }
+      ToClientLayer(child)->RenderLayerWithReadback(&readback);
 
       if (!ClientManager()->GetRepeatTransaction() &&
           !child->GetInvalidRegion().IsEmpty()) {
         child->Mutated();
       }
     }
   }
 
--- a/gfx/layers/client/ClientLayerManager.h
+++ b/gfx/layers/client/ClientLayerManager.h
@@ -329,16 +329,17 @@ public:
     // free them here (it's hard to get that right on emergency
     // shutdown anyway).
     mShadow = nullptr;
   }
 
   virtual void ClearCachedResources() { }
 
   virtual void RenderLayer() = 0;
+  virtual void RenderLayerWithReadback(ReadbackProcessor *aReadback) { RenderLayer(); }
 
   virtual ClientThebesLayer* AsThebes() { return nullptr; }
 
   static inline ClientLayer *
   ToClientLayer(Layer* aLayer)
   {
     return static_cast<ClientLayer*>(aLayer->ImplData());
   }
--- a/gfx/layers/client/ClientThebesLayer.cpp
+++ b/gfx/layers/client/ClientThebesLayer.cpp
@@ -100,17 +100,17 @@ ClientThebesLayer::PaintThebes()
     ClientManager()->Hold(this);
     contentClientRemote->Updated(state.mRegionToDraw,
                                  mVisibleRegion,
                                  state.mDidSelfCopy);
   }
 }
 
 void
-ClientThebesLayer::RenderLayer(ReadbackProcessor *aReadback)
+ClientThebesLayer::RenderLayerWithReadback(ReadbackProcessor *aReadback)
 {
   if (GetMaskLayer()) {
     ToClientLayer(GetMaskLayer())->RenderLayer();
   }
   
   if (!mContentClient) {
     mContentClient = ContentClient::CreateContentClient(ClientManager()->AsShadowForwarder());
     if (!mContentClient) {
--- a/gfx/layers/client/ClientThebesLayer.h
+++ b/gfx/layers/client/ClientThebesLayer.h
@@ -64,19 +64,19 @@ public:
   {
     NS_ASSERTION(ClientManager()->InConstruction(),
                  "Can only set properties in construction phase");
     mInvalidRegion.Or(mInvalidRegion, aRegion);
     mInvalidRegion.SimplifyOutward(20);
     mValidRegion.Sub(mValidRegion, mInvalidRegion);
   }
 
-  virtual void RenderLayer() { RenderLayer(nullptr); }
+  virtual void RenderLayer() { RenderLayerWithReadback(nullptr); }
 
-  virtual void RenderLayer(ReadbackProcessor *aReadback);
+  virtual void RenderLayerWithReadback(ReadbackProcessor *aReadback) MOZ_OVERRIDE;
 
   virtual void ClearCachedResources()
   {
     if (mContentClient) {
       mContentClient->Clear();
     }
     mValidRegion.SetEmpty();
     DestroyBackBuffer();