Remove direct calls to CompositorBridgeParent::GetAPZCTreeManager. (bug 1274149 part 2, r=kats)

This commit is contained in:
David Anderson 2016-05-23 00:27:51 -07:00
parent ecf249bd9a
commit 44e1ee52df
7 changed files with 35 additions and 13 deletions

View File

@ -25,7 +25,7 @@ public:
CompositorBridgeParent* GetInProcessBridge() const override; CompositorBridgeParent* GetInProcessBridge() const override;
void SetContentController(GeckoContentController* aController) override; void SetContentController(GeckoContentController* aController) override;
uint64_t RootLayerTreeId() const override; uint64_t RootLayerTreeId() const override;
APZCTreeManager* GetAPZCTreeManager() const override; already_AddRefed<APZCTreeManager> GetAPZCTreeManager() const override;
void Shutdown() override; void Shutdown() override;
private: private:
@ -101,7 +101,7 @@ InProcessCompositorSession::RootLayerTreeId() const
return mCompositorBridgeParent->RootLayerTreeId(); return mCompositorBridgeParent->RootLayerTreeId();
} }
APZCTreeManager* already_AddRefed<APZCTreeManager>
InProcessCompositorSession::GetAPZCTreeManager() const InProcessCompositorSession::GetAPZCTreeManager() const
{ {
return mCompositorBridgeParent->GetAPZCTreeManager(RootLayerTreeId()); return mCompositorBridgeParent->GetAPZCTreeManager(RootLayerTreeId());

View File

@ -46,7 +46,7 @@ public:
virtual uint64_t RootLayerTreeId() const = 0; virtual uint64_t RootLayerTreeId() const = 0;
// Return the Async Pan/Zoom Tree Manager for this compositor. // Return the Async Pan/Zoom Tree Manager for this compositor.
virtual APZCTreeManager* GetAPZCTreeManager() const = 0; virtual already_AddRefed<APZCTreeManager> GetAPZCTreeManager() const = 0;
// Return the child end of the compositor IPC bridge. // Return the child end of the compositor IPC bridge.
CompositorBridgeChild* GetCompositorBridgeChild(); CompositorBridgeChild* GetCompositorBridgeChild();

View File

@ -60,5 +60,11 @@ GPUProcessManager::CreateTopLevelCompositor(widget::CompositorWidgetProxy* aProx
aSurfaceHeight); aSurfaceHeight);
} }
already_AddRefed<APZCTreeManager>
GPUProcessManager::GetAPZCTreeManagerForLayers(uint64_t aLayersId)
{
return CompositorBridgeParent::GetAPZCTreeManager(aLayersId);
}
} // namespace gfx } // namespace gfx
} // namespace mozilla } // namespace mozilla

View File

@ -11,6 +11,7 @@
namespace mozilla { namespace mozilla {
namespace layers { namespace layers {
class APZCTreeManager;
class CompositorSession; class CompositorSession;
class ClientLayerManager; class ClientLayerManager;
} // namespace layers } // namespace layers
@ -24,6 +25,8 @@ namespace gfx {
// to the compositor via CompositorBridgeParent. // to the compositor via CompositorBridgeParent.
class GPUProcessManager final class GPUProcessManager final
{ {
typedef layers::APZCTreeManager APZCTreeManager;
public: public:
static void Initialize(); static void Initialize();
static void Shutdown(); static void Shutdown();
@ -40,6 +43,10 @@ public:
int aSurfaceWidth, int aSurfaceWidth,
int aSurfaceHeight); int aSurfaceHeight);
// This returns a reference to the APZCTreeManager to which
// pan/zoom-related events can be sent.
already_AddRefed<APZCTreeManager> GetAPZCTreeManagerForLayers(uint64_t aLayersId);
private: private:
GPUProcessManager(); GPUProcessManager();

View File

@ -1743,7 +1743,7 @@ CompositorBridgeParent::SetControllerForLayerTree(uint64_t aLayersId,
aController)); aController));
} }
/*static*/ APZCTreeManager* /*static*/ already_AddRefed<APZCTreeManager>
CompositorBridgeParent::GetAPZCTreeManager(uint64_t aLayersId) CompositorBridgeParent::GetAPZCTreeManager(uint64_t aLayersId)
{ {
EnsureLayerTreeMapReady(); EnsureLayerTreeMapReady();
@ -1753,7 +1753,11 @@ CompositorBridgeParent::GetAPZCTreeManager(uint64_t aLayersId)
return nullptr; return nullptr;
} }
LayerTreeState* lts = &cit->second; LayerTreeState* lts = &cit->second;
return (lts->mParent ? lts->mParent->mApzcTreeManager.get() : nullptr);
RefPtr<APZCTreeManager> apzctm = lts->mParent
? lts->mParent->mApzcTreeManager.get()
: nullptr;
return apzctm.forget();
} }
float float

View File

@ -48,6 +48,7 @@ class CancelableRunnable;
namespace gfx { namespace gfx {
class DrawTarget; class DrawTarget;
class GPUProcessManager;
} // namespace gfx } // namespace gfx
namespace ipc { namespace ipc {
@ -66,6 +67,7 @@ class LayerTransactionParent;
class PAPZParent; class PAPZParent;
class CrossProcessCompositorBridgeParent; class CrossProcessCompositorBridgeParent;
class CompositorThreadHolder; class CompositorThreadHolder;
class InProcessCompositorSession;
struct ScopedLayerTreeRegistration struct ScopedLayerTreeRegistration
{ {
@ -208,6 +210,8 @@ class CompositorBridgeParent final : public PCompositorBridgeParent,
{ {
friend class CompositorVsyncScheduler; friend class CompositorVsyncScheduler;
friend class CompositorThreadHolder; friend class CompositorThreadHolder;
friend class InProcessCompositorSession;
friend class gfx::GPUProcessManager;
public: public:
explicit CompositorBridgeParent(widget::CompositorWidgetProxy* aWidget, explicit CompositorBridgeParent(widget::CompositorWidgetProxy* aWidget,
@ -400,12 +404,6 @@ public:
static void SetControllerForLayerTree(uint64_t aLayersId, static void SetControllerForLayerTree(uint64_t aLayersId,
GeckoContentController* aController); GeckoContentController* aController);
/**
* This returns a reference to the APZCTreeManager to which
* pan/zoom-related events can be sent.
*/
static APZCTreeManager* GetAPZCTreeManager(uint64_t aLayersId);
/** /**
* A new child process has been configured to push transactions * A new child process has been configured to push transactions
* directly to us. Transport is to its thread context. * directly to us. Transport is to its thread context.
@ -501,6 +499,13 @@ public:
return !!mApzcTreeManager; return !!mApzcTreeManager;
} }
private:
/**
* This returns a reference to the APZCTreeManager to which
* pan/zoom-related events can be sent.
*/
static already_AddRefed<APZCTreeManager> GetAPZCTreeManager(uint64_t aLayersId);
protected: protected:
// Protected destructor, to discourage deletion outside of Release(): // Protected destructor, to discourage deletion outside of Release():
virtual ~CompositorBridgeParent(); virtual ~CompositorBridgeParent();

View File

@ -14,8 +14,8 @@
#include "mozilla/dom/TabParent.h" #include "mozilla/dom/TabParent.h"
#include "mozilla/layers/APZCTreeManager.h" #include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/APZThreadUtils.h" #include "mozilla/layers/APZThreadUtils.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layout/RenderFrameParent.h" #include "mozilla/layout/RenderFrameParent.h"
#include "mozilla/gfx/GPUProcessManager.h"
#include "mozilla/unused.h" #include "mozilla/unused.h"
#include "Units.h" #include "Units.h"
#ifdef MOZ_WIDGET_ANDROID #ifdef MOZ_WIDGET_ANDROID
@ -356,7 +356,7 @@ RemoteContentController::GetApzcTreeManager()
// we first need it and cache the result. // we first need it and cache the result.
MutexAutoLock lock(mMutex); MutexAutoLock lock(mMutex);
if (!mApzcTreeManager) { if (!mApzcTreeManager) {
mApzcTreeManager = CompositorBridgeParent::GetAPZCTreeManager(mLayersId); mApzcTreeManager = GPUProcessManager::Get()->GetAPZCTreeManagerForLayers(mLayersId);
} }
RefPtr<APZCTreeManager> apzcTreeManager(mApzcTreeManager); RefPtr<APZCTreeManager> apzcTreeManager(mApzcTreeManager);
return apzcTreeManager.forget(); return apzcTreeManager.forget();