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;
void SetContentController(GeckoContentController* aController) override;
uint64_t RootLayerTreeId() const override;
APZCTreeManager* GetAPZCTreeManager() const override;
already_AddRefed<APZCTreeManager> GetAPZCTreeManager() const override;
void Shutdown() override;
private:
@ -101,7 +101,7 @@ InProcessCompositorSession::RootLayerTreeId() const
return mCompositorBridgeParent->RootLayerTreeId();
}
APZCTreeManager*
already_AddRefed<APZCTreeManager>
InProcessCompositorSession::GetAPZCTreeManager() const
{
return mCompositorBridgeParent->GetAPZCTreeManager(RootLayerTreeId());

View File

@ -46,7 +46,7 @@ public:
virtual uint64_t RootLayerTreeId() const = 0;
// 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.
CompositorBridgeChild* GetCompositorBridgeChild();

View File

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

View File

@ -11,6 +11,7 @@
namespace mozilla {
namespace layers {
class APZCTreeManager;
class CompositorSession;
class ClientLayerManager;
} // namespace layers
@ -24,6 +25,8 @@ namespace gfx {
// to the compositor via CompositorBridgeParent.
class GPUProcessManager final
{
typedef layers::APZCTreeManager APZCTreeManager;
public:
static void Initialize();
static void Shutdown();
@ -40,6 +43,10 @@ public:
int aSurfaceWidth,
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:
GPUProcessManager();

View File

@ -1743,7 +1743,7 @@ CompositorBridgeParent::SetControllerForLayerTree(uint64_t aLayersId,
aController));
}
/*static*/ APZCTreeManager*
/*static*/ already_AddRefed<APZCTreeManager>
CompositorBridgeParent::GetAPZCTreeManager(uint64_t aLayersId)
{
EnsureLayerTreeMapReady();
@ -1753,7 +1753,11 @@ CompositorBridgeParent::GetAPZCTreeManager(uint64_t aLayersId)
return nullptr;
}
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

View File

@ -48,6 +48,7 @@ class CancelableRunnable;
namespace gfx {
class DrawTarget;
class GPUProcessManager;
} // namespace gfx
namespace ipc {
@ -66,6 +67,7 @@ class LayerTransactionParent;
class PAPZParent;
class CrossProcessCompositorBridgeParent;
class CompositorThreadHolder;
class InProcessCompositorSession;
struct ScopedLayerTreeRegistration
{
@ -208,6 +210,8 @@ class CompositorBridgeParent final : public PCompositorBridgeParent,
{
friend class CompositorVsyncScheduler;
friend class CompositorThreadHolder;
friend class InProcessCompositorSession;
friend class gfx::GPUProcessManager;
public:
explicit CompositorBridgeParent(widget::CompositorWidgetProxy* aWidget,
@ -400,12 +404,6 @@ public:
static void SetControllerForLayerTree(uint64_t aLayersId,
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
* directly to us. Transport is to its thread context.
@ -501,6 +499,13 @@ public:
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 destructor, to discourage deletion outside of Release():
virtual ~CompositorBridgeParent();

View File

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