Bug 1360449 - Remove duplicate WrManager functions. r=kats
authorEthan Lin <ethlin@mozilla.com>
Mon, 01 May 2017 00:59:26 +0800
changeset 357010 647d9f960b055285ea19797ea56d9e6ecd7c48ea
parent 357009 14b78eff0a909fa6906dbb0f5ac57271c8761987
child 357011 eb77f99d677f82fe62cbc1f634fb0e249f72e496
push id31780
push userkwierso@gmail.com
push dateMon, 08 May 2017 20:34:47 +0000
treeherdermozilla-central@bab7046ee2d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1360449
milestone55.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 1360449 - Remove duplicate WrManager functions. r=kats
gfx/layers/wr/WebRenderCanvasLayer.cpp
gfx/layers/wr/WebRenderCanvasLayer.h
gfx/layers/wr/WebRenderDisplayItemLayer.cpp
gfx/layers/wr/WebRenderImageLayer.cpp
gfx/layers/wr/WebRenderImageLayer.h
gfx/layers/wr/WebRenderPaintedLayer.cpp
gfx/layers/wr/WebRenderPaintedLayer.h
--- a/gfx/layers/wr/WebRenderCanvasLayer.cpp
+++ b/gfx/layers/wr/WebRenderCanvasLayer.cpp
@@ -77,27 +77,27 @@ WebRenderCanvasLayer::RenderLayer(wr::Di
   if (gfxPrefs::LayersDump()) {
     printf_stderr("CanvasLayer %p texture-filter=%s\n",
                   this->GetLayer(),
                   Stringify(filter).c_str());
   }
 
   WrImageKey key = GetImageKey();
   WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId.value(), key));
-  Manager()->AddImageKeyForDiscard(key);
+  WrManager()->AddImageKeyForDiscard(key);
 
   aBuilder.PushImage(sc.ToRelativeWrRect(rect), clip, filter, key);
 }
 
 void
 WebRenderCanvasLayer::AttachCompositable()
 {
   mCanvasClient->Connect();
 }
 
 CompositableForwarder*
 WebRenderCanvasLayer::GetForwarder()
 {
-  return Manager()->WrBridge();
+  return WrManager()->WrBridge();
 }
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/wr/WebRenderCanvasLayer.h
+++ b/gfx/layers/wr/WebRenderCanvasLayer.h
@@ -30,20 +30,16 @@ public:
   virtual void Initialize(const Data& aData) override;
 
   virtual CompositableForwarder* GetForwarder() override;
 
   virtual void AttachCompositable() override;
 
 protected:
   virtual ~WebRenderCanvasLayer();
-  WebRenderLayerManager* Manager()
-  {
-    return static_cast<WebRenderLayerManager*>(mManager);
-  }
 
 public:
   Layer* GetLayer() override { return this; }
   void RenderLayer(wr::DisplayListBuilder& aBuilder) override;
 
 protected:
   wr::MaybeExternalImageId mExternalImageId;
 };
--- a/gfx/layers/wr/WebRenderDisplayItemLayer.cpp
+++ b/gfx/layers/wr/WebRenderDisplayItemLayer.cpp
@@ -47,17 +47,17 @@ WebRenderDisplayItemLayer::RenderLayer(w
     wr::DisplayListBuilder builder(WrBridge()->GetPipeline());
     // We might have recycled this layer. Throw away the old commands.
     mParentCommands.Clear();
     mItem->CreateWebRenderCommands(builder, mParentCommands, this);
     mBuiltDisplayList = builder.Finalize();
   } else {
     // else we have an empty transaction and just use the
     // old commands.
-    WebRenderLayerManager* manager = static_cast<WebRenderLayerManager*>(Manager());
+    WebRenderLayerManager* manager = WrManager();
     MOZ_ASSERT(manager);
 
     // Since our recording relies on our parent layer's transform and stacking context
     // If this layer or our parent changed, this empty transaction won't work.
     if (manager->IsMutatedLayer(this) || manager->IsMutatedLayer(GetParent())) {
       manager->SetTransactionIncomplete();
       return;
     }
--- a/gfx/layers/wr/WebRenderImageLayer.cpp
+++ b/gfx/layers/wr/WebRenderImageLayer.cpp
@@ -99,17 +99,17 @@ WebRenderImageLayer::RenderLayer(wr::Dis
 
   // Allocate PipelineId if necessary
   if (GetImageClientType() == CompositableType::IMAGE_BRIDGE &&
       mPipelineId.isNothing() && !mPipelineIdRequest.Exists()) {
     // Use Holder to pass this pointer to lambda.
     // Static anaysis tool does not permit to pass refcounted variable to lambda.
     // And we do not want to use RefPtr<WebRenderImageLayer> here.
     Holder holder(this);
-    Manager()->AllocPipelineId()
+    WrManager()->AllocPipelineId()
       ->Then(AbstractThread::GetCurrent(), __func__,
       [holder] (const wr::PipelineId& aPipelineId) {
         holder->mPipelineIdRequest.Complete();
         holder->mPipelineId = Some(aPipelineId);
       },
       [holder] (const ipc::PromiseRejectReason &aReason) {
         holder->mPipelineIdRequest.Complete();
       })->Track(mPipelineIdRequest);
@@ -144,17 +144,17 @@ WebRenderImageLayer::RenderLayer(wr::Dis
     return;
   }
   gfx::IntSize size = image->GetSize();
 
   if (GetImageClientType() == CompositableType::IMAGE_BRIDGE) {
     // Always allocate key
     WrImageKey key = GetImageKey();
     WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId.value(), key));
-    Manager()->AddImageKeyForDiscard(key);
+    WrManager()->AddImageKeyForDiscard(key);
     mKey = Some(key);
   } else {
     // Handle CompositableType::IMAGE case
     MOZ_ASSERT(mImageClient->AsImageClientSingle());
     mKey = UpdateImageKey(mImageClient->AsImageClientSingle(),
                           mContainer,
                           mKey,
                           mExternalImageId.ref());
--- a/gfx/layers/wr/WebRenderImageLayer.h
+++ b/gfx/layers/wr/WebRenderImageLayer.h
@@ -22,21 +22,16 @@ public:
 
   virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
 
   virtual void ClearCachedResources() override;
 
 protected:
   virtual ~WebRenderImageLayer();
 
-  WebRenderLayerManager* Manager()
-  {
-    return static_cast<WebRenderLayerManager*>(mManager);
-  }
-
 public:
   Layer* GetLayer() override { return this; }
   void RenderLayer(wr::DisplayListBuilder& aBuilder) override;
   Maybe<WrImageMask> RenderMaskLayer(const gfx::Matrix4x4& aTransform) override;
 
 protected:
   CompositableType GetImageClientType();
 
--- a/gfx/layers/wr/WebRenderPaintedLayer.cpp
+++ b/gfx/layers/wr/WebRenderPaintedLayer.cpp
@@ -45,17 +45,17 @@ WebRenderPaintedLayer::SetupExternalImag
   }
 
   return true;
 }
 
 bool
 WebRenderPaintedLayer::UpdateImageClient()
 {
-  MOZ_ASSERT(Manager()->GetPaintedLayerCallback());
+  MOZ_ASSERT(WrManager()->GetPaintedLayerCallback());
   LayerIntRegion visibleRegion = GetVisibleRegion();
   LayerIntRect bounds = visibleRegion.GetBounds();
   LayerIntSize size = bounds.Size();
   IntSize imageSize(size.width, size.height);
 
   UpdateImageHelper helper(mImageContainer, mImageClient, imageSize);
 
   {
@@ -65,20 +65,20 @@ WebRenderPaintedLayer::UpdateImageClient
     }
 
     target->ClearRect(Rect(0, 0, imageSize.width, imageSize.height));
     target->SetTransform(Matrix().PreTranslate(-bounds.x, -bounds.y));
     RefPtr<gfxContext> ctx =
         gfxContext::CreatePreservingTransformOrNull(target);
     MOZ_ASSERT(ctx); // already checked the target above
 
-    Manager()->GetPaintedLayerCallback()(this,
-                                         ctx,
-                                         visibleRegion.ToUnknownRegion(), visibleRegion.ToUnknownRegion(),
-                                         DrawRegionClip::DRAW, nsIntRegion(), Manager()->GetPaintedLayerCallbackData());
+    WrManager()->GetPaintedLayerCallback()(this,
+                                           ctx,
+                                           visibleRegion.ToUnknownRegion(), visibleRegion.ToUnknownRegion(),
+                                           DrawRegionClip::DRAW, nsIntRegion(), WrManager()->GetPaintedLayerCallbackData());
 
     if (gfxPrefs::WebRenderHighlightPaintedLayers()) {
       target->SetTransform(Matrix());
       target->FillRect(Rect(0, 0, imageSize.width, imageSize.height), ColorPattern(Color(1.0, 0.0, 0.0, 0.5)));
     }
   }
 
   if (!helper.UpdateImage()) {
@@ -99,17 +99,17 @@ WebRenderPaintedLayer::CreateWebRenderDi
   LayerRect clipRect = ClipRect().valueOr(rect);
   Maybe<WrImageMask> mask = BuildWrMaskLayer(true);
   WrClipRegion clip = aBuilder.BuildClipRegion(
       sc.ToRelativeWrRect(clipRect),
       mask.ptrOr(nullptr));
 
   WrImageKey key = GetImageKey();
   WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId.value(), key));
-  Manager()->AddImageKeyForDiscard(key);
+  WrManager()->AddImageKeyForDiscard(key);
 
   aBuilder.PushImage(sc.ToRelativeWrRect(rect), clip, wr::ImageRendering::Auto, key);
 }
 
 void
 WebRenderPaintedLayer::RenderLayer(wr::DisplayListBuilder& aBuilder)
 {
   if (!SetupExternalImages()) {
@@ -123,22 +123,22 @@ WebRenderPaintedLayer::RenderLayer(wr::D
     return;
   }
 
   nsIntRegion regionToPaint;
   regionToPaint.Sub(mVisibleRegion.ToUnknownRegion(), mValidRegion);
 
   // We have something to paint but can't. This usually happens only in
   // empty transactions
-  if (!regionToPaint.IsEmpty() && !Manager()->GetPaintedLayerCallback()) {
-    Manager()->SetTransactionIncomplete();
+  if (!regionToPaint.IsEmpty() && !WrManager()->GetPaintedLayerCallback()) {
+    WrManager()->SetTransactionIncomplete();
     return;
   }
 
-  if (!regionToPaint.IsEmpty() && Manager()->GetPaintedLayerCallback()) {
+  if (!regionToPaint.IsEmpty() && WrManager()->GetPaintedLayerCallback()) {
     if (!UpdateImageClient()) {
       return;
     }
   } else {
     // We have an empty transaction, just reuse the old image we had before.
     MOZ_ASSERT(mExternalImageId);
     MOZ_ASSERT(mImageContainer->HasCurrentImage());
     MOZ_ASSERT(GetInvalidRegion().IsEmpty());
--- a/gfx/layers/wr/WebRenderPaintedLayer.h
+++ b/gfx/layers/wr/WebRenderPaintedLayer.h
@@ -31,20 +31,16 @@ public:
 protected:
   virtual ~WebRenderPaintedLayer()
   {
     MOZ_COUNT_DTOR(WebRenderPaintedLayer);
     if (mExternalImageId.isSome()) {
       WrBridge()->DeallocExternalImageId(mExternalImageId.ref());
     }
   }
-  WebRenderLayerManager* Manager()
-  {
-    return static_cast<WebRenderLayerManager*>(mManager);
-  }
 
   wr::MaybeExternalImageId mExternalImageId;
 
 public:
   virtual void InvalidateRegion(const nsIntRegion& aRegion) override
   {
     mInvalidRegion.Add(aRegion);
     mValidRegion.Sub(mValidRegion, mInvalidRegion.GetRegion());