From 83ac5d30d959d3e2180058d139a2c4114c9b1940 Mon Sep 17 00:00:00 2001 From: Nicholas Cameron Date: Mon, 9 Dec 2013 14:40:59 +1300 Subject: [PATCH] Bug 946958 part 2. Remove methods which just forward to compositor. r=mattwoodrow --- gfx/layers/Layers.cpp | 9 ------- gfx/layers/Layers.h | 6 ----- gfx/layers/client/ClientLayerManager.h | 2 +- .../composite/LayerManagerComposite.cpp | 25 ------------------- gfx/layers/composite/LayerManagerComposite.h | 16 ++++++------ gfx/layers/ipc/CompositorParent.cpp | 10 ++++---- layout/ipc/RenderFrameParent.cpp | 3 ++- 7 files changed, 15 insertions(+), 56 deletions(-) diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 53fa38457d5..14ab891c6b3 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -133,15 +133,6 @@ LayerManager::CreateDrawTarget(const IntSize &aSize, CreateOffscreenCanvasDrawTarget(aSize, aFormat); } -TextureFactoryIdentifier -LayerManager::GetTextureFactoryIdentifier() -{ - //TODO[nrc] make pure virtual when all layer managers use Compositor - NS_ERROR("Should have been overridden"); - return TextureFactoryIdentifier(); -} - - #ifdef DEBUG void LayerManager::Mutated(Layer* aLayer) diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index 5495036de96..3776120436b 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -437,12 +437,6 @@ public: virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) { return true; } - /** - * Returns a TextureFactoryIdentifier which describes properties of the backend - * used to decide what kind of texture and buffer clients to create - */ - virtual TextureFactoryIdentifier GetTextureFactoryIdentifier(); - /** * returns the maximum texture size on this layer backend, or INT32_MAX * if there is no maximum diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h index 0955238ead5..ddff4448933 100644 --- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -73,7 +73,7 @@ public: virtual already_AddRefed CreateColorLayer(); virtual already_AddRefed CreateRefLayer(); - virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE + TextureFactoryIdentifier GetTextureFactoryIdentifier() { return mForwarder->GetTextureFactoryIdentifier(); } diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 94d8d654bea..ed03052b1f8 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -786,19 +786,6 @@ LayerComposite::Destroy() } } -void -LayerManagerComposite::SetCompositorID(uint32_t aID) -{ - NS_ASSERTION(mCompositor, "No compositor"); - mCompositor->SetCompositorID(aID); -} - -void -LayerManagerComposite::NotifyShadowTreeTransaction() -{ - mCompositor->NotifyLayersTransaction(); -} - bool LayerManagerComposite::CanUseCanvasLayerForSize(const gfxIntSize &aSize) { @@ -806,18 +793,6 @@ LayerManagerComposite::CanUseCanvasLayerForSize(const gfxIntSize &aSize) aSize.height)); } -TextureFactoryIdentifier -LayerManagerComposite::GetTextureFactoryIdentifier() -{ - return mCompositor->GetTextureFactoryIdentifier(); -} - -int32_t -LayerManagerComposite::GetMaxTextureSize() const -{ - return mCompositor->GetMaxTextureSize(); -} - #ifndef MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS /*static*/ bool diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index 1dde8755d8f..c9c6226b818 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -110,8 +110,6 @@ public: } void BeginTransactionWithDrawTarget(gfx::DrawTarget* aTarget); - void NotifyShadowTreeTransaction(); - virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE; virtual void EndTransaction(DrawThebesLayerCallback aCallback, void* aCallbackData, @@ -119,11 +117,14 @@ public: virtual void SetRoot(Layer* aLayer) MOZ_OVERRIDE { mRoot = aLayer; } + // XXX[nrc]: never called, we should move this logic to ClientLayerManager + // (bug 946926). virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) MOZ_OVERRIDE; - virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE; - - virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE; + virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE + { + MOZ_CRASH("Call on compositor, not LayerManagerComposite"); + } virtual void ClearCachedResources(Layer* aSubtree = nullptr) MOZ_OVERRIDE; @@ -145,8 +146,7 @@ public: } virtual void GetBackendName(nsAString& name) MOZ_OVERRIDE { - MOZ_ASSERT(false, "Shouldn't be called for composited layer manager"); - name.AssignLiteral("Composite"); + MOZ_CRASH("Shouldn't be called for composited layer manager"); } virtual already_AddRefed @@ -215,8 +215,6 @@ public: static void PlatformSyncBeforeReplyUpdate(); - void SetCompositorID(uint32_t aID); - void AddInvalidRegion(const nsIntRegion& aRegion) { mInvalidRegion.Or(mInvalidRegion, aRegion); diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index 2a0f0f2f310..19fd0da0889 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -509,7 +509,7 @@ CompositorParent::NotifyShadowTreeTransaction(uint64_t aId, bool aIsFirstPaint) AutoResolveRefLayers resolve(mCompositionManager); mApzcTreeManager->UpdatePanZoomControllerTree(this, mLayerManager->GetRoot(), aIsFirstPaint, aId); - mLayerManager->NotifyShadowTreeTransaction(); + mCompositor->NotifyLayersTransaction(); } ScheduleComposition(); } @@ -703,7 +703,7 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree, } } ScheduleComposition(); - mLayerManager->NotifyShadowTreeTransaction(); + mCompositor->NotifyLayersTransaction(); } void @@ -730,8 +730,8 @@ CompositorParent::InitializeLayerManager(const nsTArray& aBackend MOZ_ASSERT(compositor, "Passed invalid backend hint"); + compositor->SetCompositorID(mCompositorID); RefPtr layerManager = new LayerManagerComposite(compositor); - layerManager->SetCompositorID(mCompositorID); if (layerManager->Initialize()) { mLayerManager = layerManager; @@ -769,7 +769,7 @@ CompositorParent::AllocPLayerTransactionParent(const nsTArray& aB mCompositionManager = new AsyncCompositionManager(mLayerManager); *aSuccess = true; - *aTextureFactoryIdentifier = mLayerManager->GetTextureFactoryIdentifier(); + *aTextureFactoryIdentifier = mCompositor->GetTextureFactoryIdentifier(); LayerTransactionParent* p = new LayerTransactionParent(mLayerManager, this, 0); p->AddIPDLReference(); return p; @@ -1078,7 +1078,7 @@ CrossProcessCompositorParent::AllocPLayerTransactionParent(const nsTArrayGetTextureFactoryIdentifier(); + *aTextureFactoryIdentifier = lm->GetCompositor()->GetTextureFactoryIdentifier(); *aSuccess = true; LayerTransactionParent* p = new LayerTransactionParent(lm, this, aId); p->AddIPDLReference(); diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index c65ff48db0a..820bb239be5 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -647,7 +647,8 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader, nsRefPtr lm = GetFrom(mFrameLoader); // Perhaps the document containing this frame currently has no presentation? if (lm && lm->GetBackendType() == LAYERS_CLIENT) { - *aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier(); + *aTextureFactoryIdentifier = + static_cast(lm.get())->GetTextureFactoryIdentifier(); } else { *aTextureFactoryIdentifier = TextureFactoryIdentifier(); }