Bug 1298980 - Initialize AsyncPanZoomController global state in GPU Process. r=kats

MozReview-Commit-ID: EjDgxzF5HmZ

--HG--
extra : rebase_source : 79cb8dd3b0a6de115d9cb8126b56ca9e6053f8d4
This commit is contained in:
Ryan Hunt 2016-08-31 16:00:00 -04:00
parent 42b6caf0b9
commit f98462b4c1
4 changed files with 19 additions and 3 deletions

View File

@ -12,6 +12,7 @@
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/ipc/ProcessChild.h"
#include "mozilla/layers/APZThreadUtils.h"
#include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/ImageBridgeParent.h"
@ -65,6 +66,7 @@ GPUParent::Init(base::ProcessId aParentPid,
}
CompositorThreadHolder::Start();
APZThreadUtils::SetControllerThread(CompositorThreadHolder::Loop());
APZCTreeManager::InitializeGlobalState();
VRManager::ManagerInit();
LayerTreeOwnerTracker::Initialize();
mozilla::ipc::SetThisProcessName("GPU Process");

View File

@ -100,7 +100,6 @@ APZCTreeManager::APZCTreeManager()
mRetainedTouchIdentifier(-1),
mApzcTreeLog("apzctree")
{
MOZ_ASSERT(NS_IsMainThread());
AsyncPanZoomController::InitializeGlobalState();
mApzcTreeLog.ConditionOnPrefFunction(gfxPrefs::APZPrintTree);
}
@ -109,6 +108,13 @@ APZCTreeManager::~APZCTreeManager()
{
}
/*static*/ void
APZCTreeManager::InitializeGlobalState()
{
MOZ_ASSERT(NS_IsMainThread());
AsyncPanZoomController::InitializeGlobalState();
}
AsyncPanZoomController*
APZCTreeManager::NewAPZCInstance(uint64_t aLayersId,
GeckoContentController* aController)

View File

@ -92,6 +92,14 @@ class APZCTreeManager : public IAPZCTreeManager {
public:
APZCTreeManager();
/**
* Initializes the global state used in AsyncPanZoomController.
* This is normally called when it is first needed in the constructor
* of APZCTreeManager, but can be called manually to force it to be
* initialized earlier.
*/
static void InitializeGlobalState();
/**
* Rebuild the hit-testing tree based on the layer update that just came up.
* Preserve nodes and APZC instances where possible, but retire those whose

View File

@ -659,13 +659,13 @@ private:
/*static*/ void
AsyncPanZoomController::InitializeGlobalState()
{
MOZ_ASSERT(NS_IsMainThread());
static bool sInitialized = false;
if (sInitialized)
return;
sInitialized = true;
MOZ_ASSERT(NS_IsMainThread());
gZoomAnimationFunction = new ComputedTimingFunction();
gZoomAnimationFunction->Init(
nsTimingFunction(NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE));