From 3afaab9b6726f4be0f8c441fe22f0ab5a2db66be Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 23 May 2016 00:28:51 -0700 Subject: [PATCH] Remove ContentParent use of CompositorBridgeParent. (bug 1274149 part 5, r=mattwoodrow) --- dom/ipc/ContentParent.cpp | 10 ++++----- gfx/ipc/GPUProcessManager.cpp | 21 +++++++++++++++++++ gfx/ipc/GPUProcessManager.h | 28 +++++++++++++++++++++++++ gfx/layers/ipc/CompositorBridgeParent.h | 27 ++++++++++++------------ 4 files changed, 68 insertions(+), 18 deletions(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index fb6b8159f9bd..45cb646f44ea 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -86,7 +86,6 @@ #include "mozilla/ipc/InputStreamUtils.h" #include "mozilla/jsipc/CrossProcessObjectWrappers.h" #include "mozilla/layers/PAPZParent.h" -#include "mozilla/layers/CompositorBridgeParent.h" #include "mozilla/layers/CompositorThread.h" #include "mozilla/layers/ImageBridgeParent.h" #include "mozilla/layers/SharedBufferManagerParent.h" @@ -1941,7 +1940,8 @@ ContentParent::AllocateLayerTreeId(ContentParent* aContent, TabParent* aTopLevel, const TabId& aTabId, uint64_t* aId) { - *aId = GPUProcessManager::Get()->AllocateLayerTreeId(); + GPUProcessManager* gpu = GPUProcessManager::Get(); + *aId = gpu->AllocateLayerTreeId(); if (!gfxPlatform::AsyncPanZoomEnabled()) { return true; @@ -1951,8 +1951,7 @@ ContentParent::AllocateLayerTreeId(ContentParent* aContent, return false; } - return CompositorBridgeParent::UpdateRemoteContentController(*aId, aContent, - aTabId, aTopLevel); + return gpu->UpdateRemoteContentController(*aId, aContent, aTabId, aTopLevel); } bool @@ -3334,7 +3333,8 @@ PCompositorBridgeParent* ContentParent::AllocPCompositorBridgeParent(mozilla::ipc::Transport* aTransport, base::ProcessId aOtherProcess) { - return CompositorBridgeParent::Create(aTransport, aOtherProcess, mSubprocess); + return GPUProcessManager::Get()->CreateTabCompositorBridge( + aTransport, aOtherProcess, mSubprocess); } gfx::PVRManagerParent* diff --git a/gfx/ipc/GPUProcessManager.cpp b/gfx/ipc/GPUProcessManager.cpp index 50db8a4b9389..bf3a86c681c3 100644 --- a/gfx/ipc/GPUProcessManager.cpp +++ b/gfx/ipc/GPUProcessManager.cpp @@ -60,6 +60,14 @@ GPUProcessManager::CreateTopLevelCompositor(widget::CompositorWidgetProxy* aProx aSurfaceHeight); } +PCompositorBridgeParent* +GPUProcessManager::CreateTabCompositorBridge(ipc::Transport* aTransport, + base::ProcessId aOtherProcess, + ipc::GeckoChildProcessHost* aSubprocess) +{ + return CompositorBridgeParent::Create(aTransport, aOtherProcess, aSubprocess); +} + already_AddRefed GPUProcessManager::GetAPZCTreeManagerForLayers(uint64_t aLayersId) { @@ -96,5 +104,18 @@ GPUProcessManager::SwapLayerTreeObservers(uint64_t aLayer, uint64_t aOtherLayer) CompositorBridgeParent::SwapLayerTreeObservers(aLayer, aOtherLayer); } +bool +GPUProcessManager::UpdateRemoteContentController(uint64_t aLayersId, + dom::ContentParent* aContentParent, + const dom::TabId& aTabId, + dom::TabParent* aBrowserParent) +{ + return CompositorBridgeParent::UpdateRemoteContentController( + aLayersId, + aContentParent, + aTabId, + aBrowserParent); +} + } // namespace gfx } // namespace mozilla diff --git a/gfx/ipc/GPUProcessManager.h b/gfx/ipc/GPUProcessManager.h index e612e17557c1..f2582869c327 100644 --- a/gfx/ipc/GPUProcessManager.h +++ b/gfx/ipc/GPUProcessManager.h @@ -7,7 +7,10 @@ #define _include_mozilla_gfx_ipc_GPUProcessManager_h_ #include "base/basictypes.h" +#include "base/process.h" #include "Units.h" +#include "mozilla/dom/ipc/IdType.h" +#include "mozilla/ipc/Transport.h" namespace mozilla { namespace layers { @@ -15,10 +18,18 @@ class APZCTreeManager; class CompositorSession; class ClientLayerManager; class CompositorUpdateObserver; +class PCompositorBridgeParent; } // namespace layers namespace widget { class CompositorWidgetProxy; } // namespace widget +namespace dom { +class ContentParent; +class TabParent; +} // namespace dom +namespace ipc { +class GeckoChildProcessHost; +} // namespace ipc namespace gfx { // The GPUProcessManager is a singleton responsible for creating GPU-bound @@ -45,6 +56,11 @@ public: int aSurfaceWidth, int aSurfaceHeight); + layers::PCompositorBridgeParent* CreateTabCompositorBridge( + ipc::Transport* aTransport, + base::ProcessId aOtherProcess, + ipc::GeckoChildProcessHost* aSubprocess); + // This returns a reference to the APZCTreeManager to which // pan/zoom-related events can be sent. already_AddRefed GetAPZCTreeManagerForLayers(uint64_t aLayersId); @@ -64,6 +80,18 @@ public: void RequestNotifyLayerTreeCleared(uint64_t aLayersId, CompositorUpdateObserver* aObserver); void SwapLayerTreeObservers(uint64_t aLayer, uint64_t aOtherLayer); + // Creates a new RemoteContentController for aTabId. Should only be called on + // the main thread. + // + // aLayersId The layers id for the browser corresponding to aTabId. + // aContentParent The ContentParent for the process that the TabChild for + // aTabId lives in. + // aBrowserParent The toplevel TabParent for aTabId. + bool UpdateRemoteContentController(uint64_t aLayersId, + dom::ContentParent* aContentParent, + const dom::TabId& aTabId, + dom::TabParent* aBrowserParent); + private: GPUProcessManager(); diff --git a/gfx/layers/ipc/CompositorBridgeParent.h b/gfx/layers/ipc/CompositorBridgeParent.h index c9c64a9c0402..c07ad2f4f3ec 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.h +++ b/gfx/layers/ipc/CompositorBridgeParent.h @@ -464,19 +464,6 @@ public: void ForceComposeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect = nullptr); - /** - * Creates a new RemoteContentController for aTabId. Should only be called on - * the main thread. - * - * aLayersId The layers id for the browser corresponding to aTabId. - * aContentParent The ContentParent for the process that the TabChild for - * aTabId lives in. - * aBrowserParent The toplevel TabParent for aTabId. - */ - static bool UpdateRemoteContentController(uint64_t aLayersId, - dom::ContentParent* aContentParent, - const dom::TabId& aTabId, - dom::TabParent* aBrowserParent); bool AsyncPanZoomEnabled() const { return !!mApzcTreeManager; } @@ -506,6 +493,20 @@ private: static void RequestNotifyLayerTreeCleared(uint64_t aLayersId, CompositorUpdateObserver* aObserver); static void SwapLayerTreeObservers(uint64_t aLayer, uint64_t aOtherLayer); + /** + * Creates a new RemoteContentController for aTabId. Should only be called on + * the main thread. + * + * aLayersId The layers id for the browser corresponding to aTabId. + * aContentParent The ContentParent for the process that the TabChild for + * aTabId lives in. + * aBrowserParent The toplevel TabParent for aTabId. + */ + static bool UpdateRemoteContentController(uint64_t aLayersId, + dom::ContentParent* aContentParent, + const dom::TabId& aTabId, + dom::TabParent* aBrowserParent); + protected: // Protected destructor, to discourage deletion outside of Release(): virtual ~CompositorBridgeParent();