From 938c03b734aa04966da1b6b8feeb7426bd2ebd4e Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Sun, 14 Jul 2013 20:59:36 -0700 Subject: [PATCH] Backed out changeset fa6ef0b63025 (bug 889515) for OSX browser-chrome bustage on a CLOSED TREE --HG-- extra : amend_source : f0064ef485170a679744ea3e211535a9d58f0fc9 --- gfx/layers/client/ClientLayerManager.cpp | 12 +-------- gfx/layers/client/ClientLayerManager.h | 7 ----- gfx/layers/ipc/CompositableForwarder.h | 17 ++++++++---- gfx/layers/ipc/CompositorParent.cpp | 34 +++++++----------------- gfx/layers/ipc/CompositorParent.h | 4 --- gfx/layers/ipc/PCompositor.ipdl | 2 -- gfx/layers/ipc/ShadowLayers.cpp | 5 +++- layout/ipc/RenderFrameParent.cpp | 8 +----- 8 files changed, 28 insertions(+), 61 deletions(-) diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index ba9bddac1a3..7524d91521c 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -232,16 +232,6 @@ ClientLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) return true; } -CompositorChild * -ClientLayerManager::GetRemoteRenderer() -{ - if (!mWidget) { - return nullptr; - } - - return mWidget->GetRemoteRenderer(); -} - void ClientLayerManager::MakeSnapshotIfRequired() { @@ -249,7 +239,7 @@ ClientLayerManager::MakeSnapshotIfRequired() return; } if (mWidget) { - if (CompositorChild* remoteRenderer = GetRemoteRenderer()) { + if (CompositorChild* remoteRenderer = mWidget->GetRemoteRenderer()) { nsIntRect bounds; mWidget->GetBounds(bounds); SurfaceDescriptor inSnapshot, snapshot; diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h index 90c66018dbf..9a05ed0d069 100644 --- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -53,11 +53,6 @@ public: virtual already_AddRefed CreateColorLayer(); virtual already_AddRefed CreateRefLayer(); - virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE - { - return mTextureFactoryIdentifier; - } - virtual void FlushRendering() MOZ_OVERRIDE; virtual bool NeedsWidgetInvalidation() MOZ_OVERRIDE { return false; } @@ -94,8 +89,6 @@ public: void* GetThebesLayerCallbackData() const { return mThebesLayerCallbackData; } - CompositorChild *GetRemoteRenderer(); - /** * Called for each iteration of a progressive tile update. Fills * aViewport, aScaleX and aScaleY with the current scale and viewport diff --git a/gfx/layers/ipc/CompositableForwarder.h b/gfx/layers/ipc/CompositableForwarder.h index 509a1553186..d65ec64d4c5 100644 --- a/gfx/layers/ipc/CompositableForwarder.h +++ b/gfx/layers/ipc/CompositableForwarder.h @@ -40,6 +40,10 @@ public: typedef gfxASurface::gfxContentType gfxContentType; CompositableForwarder() + : mMaxTextureSize(0) + , mCompositorBackend(layers::LAYERS_NONE) + , mSupportsTextureBlitting(false) + , mSupportsPartialUploads(false) {} /** @@ -146,7 +150,7 @@ public: /** * Returns the maximum texture size supported by the compositor. */ - virtual int32_t GetMaxTextureSize() const { return mTextureFactoryIdentifier.mMaxTextureSize; } + virtual int32_t GetMaxTextureSize() const { return mMaxTextureSize; } bool IsOnCompositorSide() const MOZ_OVERRIDE { return false; } @@ -157,21 +161,24 @@ public: */ LayersBackend GetCompositorBackendType() const { - return mTextureFactoryIdentifier.mParentBackend; + return mCompositorBackend; } bool SupportsTextureBlitting() const { - return mTextureFactoryIdentifier.mSupportsTextureBlitting; + return mSupportsTextureBlitting; } bool SupportsPartialUploads() const { - return mTextureFactoryIdentifier.mSupportsPartialUploads; + return mSupportsPartialUploads; } protected: - TextureFactoryIdentifier mTextureFactoryIdentifier; + uint32_t mMaxTextureSize; + LayersBackend mCompositorBackend; + bool mSupportsTextureBlitting; + bool mSupportsPartialUploads; }; } // namespace diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index d8cef7ebeb8..a6fd1c4746a 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -36,6 +36,7 @@ namespace layers { // FIXME/bug 774386: we're assuming that there's only one // CompositorParent, but that's not always true. This assumption only // affects CrossProcessCompositorParent below. +static CompositorParent* sCurrentCompositor; static Thread* sCompositorThread = nullptr; // manual reference count of the compositor thread. static int sCompositorThreadRefCount = 0; @@ -152,6 +153,9 @@ CompositorParent::CompositorParent(nsIWidget* aWidget, CompositorLoop()->PostTask(FROM_HERE, NewRunnableFunction(&AddCompositor, this, &mCompositorID)); + if (!sCurrentCompositor) { + sCurrentCompositor = this; + } ++sCompositorThreadRefCount; } @@ -165,6 +169,9 @@ CompositorParent::~CompositorParent() { MOZ_COUNT_DTOR(CompositorParent); + if (this == sCurrentCompositor) { + sCurrentCompositor = NULL; + } ReleaseCompositorThread(); } @@ -670,19 +677,6 @@ CompositorParent::SetTimeAndSampleAnimations(TimeStamp aTime, bool aIsTesting) typedef map LayerTreeMap; static LayerTreeMap sIndirectLayerTrees; -bool -CompositorParent::RecvNotifyChildCreated(const uint64_t& child) -{ - NotifyChildCreated(child); - return true; -} - -void -CompositorParent::NotifyChildCreated(uint64_t aChild) -{ - sIndirectLayerTrees[aChild].mParent = this; -} - /*static*/ uint64_t CompositorParent::AllocateLayerTreeId() { @@ -716,7 +710,7 @@ UpdateControllerForLayersId(uint64_t aLayersId, // Notify the AsyncPanZoomController about the current compositor so that it // can request composites off the compositor thread. - aController->SetCompositorParent(sIndirectLayerTrees[aLayersId].mParent); + aController->SetCompositorParent(sCurrentCompositor); } /*static*/ void @@ -758,7 +752,6 @@ public: virtual bool RecvStop() MOZ_OVERRIDE { return true; } virtual bool RecvPause() MOZ_OVERRIDE { return true; } virtual bool RecvResume() MOZ_OVERRIDE { return true; } - virtual bool RecvNotifyChildCreated(const uint64_t& child) MOZ_OVERRIDE; virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot, SurfaceDescriptor* aOutSnapshot) { return true; } @@ -858,7 +851,7 @@ CrossProcessCompositorParent::AllocPLayerTransactionParent(const LayersBackend& { MOZ_ASSERT(aId != 0); - nsRefPtr lm = sIndirectLayerTrees[aId].mParent->GetLayerManager(); + nsRefPtr lm = sCurrentCompositor->GetLayerManager(); *aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier(); return new LayerTransactionParent(lm->AsLayerManagerComposite(), this, aId); } @@ -872,13 +865,6 @@ CrossProcessCompositorParent::DeallocPLayerTransactionParent(PLayerTransactionPa return true; } -bool -CrossProcessCompositorParent::RecvNotifyChildCreated(const uint64_t& child) -{ - sIndirectLayerTrees[child].mParent->NotifyChildCreated(child); - return true; -} - void CrossProcessCompositorParent::ShadowLayersUpdated( LayerTransactionParent* aLayerTree, @@ -893,7 +879,7 @@ CrossProcessCompositorParent::ShadowLayersUpdated( } UpdateIndirectTree(id, shadowRoot, aTargetConfig, isFirstPaint); - sIndirectLayerTrees[id].mParent->NotifyShadowTreeTransaction(); + sCurrentCompositor->NotifyShadowTreeTransaction(); } void diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h index 94fa4d42f25..edd14f1c188 100644 --- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -53,7 +53,6 @@ public: virtual bool RecvStop() MOZ_OVERRIDE; virtual bool RecvPause() MOZ_OVERRIDE; virtual bool RecvResume() MOZ_OVERRIDE; - virtual bool RecvNotifyChildCreated(const uint64_t& child) MOZ_OVERRIDE; virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot, SurfaceDescriptor* aOutSnapshot); virtual bool RecvFlushRendering() MOZ_OVERRIDE; @@ -75,8 +74,6 @@ public: LayerManagerComposite* GetLayerManager() { return mLayerManager; } - void NotifyChildCreated(uint64_t aChild); - void AsyncRender(); // Can be called from any thread @@ -155,7 +152,6 @@ public: struct LayerTreeState { nsRefPtr mRoot; nsRefPtr mController; - CompositorParent *mParent; TargetConfig mTargetConfig; }; diff --git a/gfx/layers/ipc/PCompositor.ipdl b/gfx/layers/ipc/PCompositor.ipdl index 708a78cb811..72e1ea00f01 100644 --- a/gfx/layers/ipc/PCompositor.ipdl +++ b/gfx/layers/ipc/PCompositor.ipdl @@ -43,8 +43,6 @@ parent: sync Pause(); sync Resume(); - async NotifyChildCreated(uint64_t id); - // Make a snapshot of the content that would have been drawn to our // render target at the time this message is received. If the size // or format of |inSnapshot| doesn't match our render target, diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index beb7eef11f2..c7872e04404 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -160,7 +160,10 @@ struct AutoTxnEnd { void CompositableForwarder::IdentifyTextureHost(const TextureFactoryIdentifier& aIdentifier) { - mTextureFactoryIdentifier = aIdentifier; + mMaxTextureSize = aIdentifier.mMaxTextureSize; + mCompositorBackend = aIdentifier.mParentBackend; + mSupportsTextureBlitting = aIdentifier.mSupportsTextureBlitting; + mSupportsPartialUploads = aIdentifier.mSupportsPartialUploads; } ShadowLayerForwarder::ShadowLayerForwarder() diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index dd1183fb4a8..3ad75232f77 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -26,8 +26,6 @@ #include "nsViewportFrame.h" #include "RenderFrameParent.h" #include "mozilla/layers/LayerManagerComposite.h" -#include "mozilla/layers/CompositorChild.h" -#include "ClientLayerManager.h" typedef nsContentView::ViewConfig ViewConfig; using namespace mozilla::dom; @@ -604,7 +602,7 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader, nsRefPtr lm = GetFrom(mFrameLoader); // Perhaps the document containing this frame currently has no presentation? - if (lm && lm->GetBackendType() == LAYERS_CLIENT) { + if (lm && lm->AsLayerManagerComposite()) { *aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier(); } else { *aTextureFactoryIdentifier = TextureFactoryIdentifier(); @@ -614,10 +612,6 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader, // Our remote frame will push layers updates to the compositor, // and we'll keep an indirect reference to that tree. *aId = mLayersId = CompositorParent::AllocateLayerTreeId(); - if (lm && lm->GetBackendType() == LAYERS_CLIENT) { - ClientLayerManager *clientManager = static_cast(lm.get()); - clientManager->GetRemoteRenderer()->SendNotifyChildCreated(mLayersId); - } if (aScrollingBehavior == ASYNC_PAN_ZOOM) { mContentController = new RemoteContentController(this); mPanZoomController = new AsyncPanZoomController(