Move Alloc/DeallocLayerTreeId calls to GPUProcessManager. (bug 1274149 part 3, r=mattwoodrow)

This commit is contained in:
David Anderson 2016-05-23 00:27:57 -07:00
Родитель 44e1ee52df
Коммит 60ca648e99
6 изменённых файлов: 50 добавлений и 21 удалений

Просмотреть файл

@ -73,6 +73,7 @@
#include "mozilla/dom/time/DateCacheCleaner.h"
#include "mozilla/dom/voicemail/VoicemailParent.h"
#include "mozilla/embedding/printingui/PrintingParent.h"
#include "mozilla/gfx/GPUProcessManager.h"
#include "mozilla/hal_sandbox/PHalParent.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/BackgroundParent.h"
@ -306,6 +307,7 @@ using namespace mozilla::dom::telephony;
using namespace mozilla::dom::voicemail;
using namespace mozilla::media;
using namespace mozilla::embedding;
using namespace mozilla::gfx;
using namespace mozilla::gmp;
using namespace mozilla::hal;
using namespace mozilla::ipc;
@ -1939,7 +1941,7 @@ ContentParent::AllocateLayerTreeId(ContentParent* aContent,
TabParent* aTopLevel, const TabId& aTabId,
uint64_t* aId)
{
*aId = CompositorBridgeParent::AllocateLayerTreeId();
*aId = GPUProcessManager::Get()->AllocateLayerTreeId();
if (!gfxPlatform::AsyncPanZoomEnabled()) {
return true;
@ -1950,7 +1952,7 @@ ContentParent::AllocateLayerTreeId(ContentParent* aContent,
}
return CompositorBridgeParent::UpdateRemoteContentController(*aId, aContent,
aTabId, aTopLevel);
aTabId, aTopLevel);
}
bool
@ -1996,8 +1998,9 @@ ContentParent::RecvDeallocateLayerTreeId(const uint64_t& aId)
{
auto iter = NestedBrowserLayerIds().find(this);
if (iter != NestedBrowserLayerIds().end() &&
iter->second.find(aId) != iter->second.end()) {
CompositorBridgeParent::DeallocateLayerTreeId(aId);
iter->second.find(aId) != iter->second.end())
{
GPUProcessManager::Get()->DeallocateLayerTreeId(aId);
} else {
// You can't deallocate layer tree ids that you didn't allocate
KillHard("DeallocateLayerTreeId");

Просмотреть файл

@ -66,5 +66,17 @@ GPUProcessManager::GetAPZCTreeManagerForLayers(uint64_t aLayersId)
return CompositorBridgeParent::GetAPZCTreeManager(aLayersId);
}
uint64_t
GPUProcessManager::AllocateLayerTreeId()
{
return CompositorBridgeParent::AllocateLayerTreeId();
}
void
GPUProcessManager::DeallocateLayerTreeId(uint64_t aLayersId)
{
CompositorBridgeParent::DeallocateLayerTreeId(aLayersId);
}
} // namespace gfx
} // namespace mozilla

Просмотреть файл

@ -47,6 +47,17 @@ public:
// pan/zoom-related events can be sent.
already_AddRefed<APZCTreeManager> GetAPZCTreeManagerForLayers(uint64_t aLayersId);
// Allocate an ID that can be used to refer to a layer tree and
// associated resources that live only on the compositor thread.
//
// Must run on the content main thread.
uint64_t AllocateLayerTreeId();
// Release compositor-thread resources referred to by |aID|.
//
// Must run on the content main thread.
void DeallocateLayerTreeId(uint64_t aLayersId);
private:
GPUProcessManager();

Просмотреть файл

@ -381,20 +381,6 @@ public:
*/
static CompositorBridgeParent* GetCompositor(uint64_t id);
/**
* Allocate an ID that can be used to refer to a layer tree and
* associated resources that live only on the compositor thread.
*
* Must run on the content main thread.
*/
static uint64_t AllocateLayerTreeId();
/**
* Release compositor-thread resources referred to by |aID|.
*
* Must run on the content main thread.
*/
static void DeallocateLayerTreeId(uint64_t aId);
/**
* Set aController as the pan/zoom callback for the subtree referred
* to by aLayersId.
@ -506,6 +492,20 @@ private:
*/
static already_AddRefed<APZCTreeManager> GetAPZCTreeManager(uint64_t aLayersId);
/**
* Allocate an ID that can be used to refer to a layer tree and
* associated resources that live only on the compositor thread.
*
* Must run on the content main thread.
*/
static uint64_t AllocateLayerTreeId();
/**
* Release compositor-thread resources referred to by |aID|.
*
* Must run on the content main thread.
*/
static void DeallocateLayerTreeId(uint64_t aId);
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~CompositorBridgeParent();

Просмотреть файл

@ -25,6 +25,8 @@
namespace mozilla {
namespace layers {
using namespace mozilla::gfx;
static std::map<uint64_t, RefPtr<RemoteContentController>> sDestroyedControllers;
RemoteContentController::RemoteContentController(uint64_t aLayersId,

Просмотреть файл

@ -31,6 +31,7 @@
#include "nsView.h"
#include "nsViewportFrame.h"
#include "RenderFrameParent.h"
#include "mozilla/gfx/GPUProcessManager.h"
#include "mozilla/layers/LayerManagerComposite.h"
#include "mozilla/layers/CompositorBridgeChild.h"
#include "ClientLayerManager.h"
@ -218,10 +219,10 @@ void
RenderFrameParent::ActorDestroy(ActorDestroyReason why)
{
if (mLayersId != 0) {
if (XRE_IsContentProcess()) {
if (XRE_IsParentProcess()) {
GPUProcessManager::Get()->DeallocateLayerTreeId(mLayersId);
} else if (XRE_IsContentProcess()) {
ContentChild::GetSingleton()->SendDeallocateLayerTreeId(mLayersId);
} else {
CompositorBridgeParent::DeallocateLayerTreeId(mLayersId);
}
}