зеркало из https://github.com/mozilla/gecko-dev.git
Bug 898478 - Have AsyncPanZoomController keep a pointer to the APZCTreeManager. r=kats
This commit is contained in:
Родитель
7e518b8b1e
Коммит
0d500136ea
|
@ -118,7 +118,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
||||||
|
|
||||||
bool newApzc = (apzc == nullptr);
|
bool newApzc = (apzc == nullptr);
|
||||||
if (newApzc) {
|
if (newApzc) {
|
||||||
apzc = new AsyncPanZoomController(aLayersId, state->mController,
|
apzc = new AsyncPanZoomController(aLayersId, this, state->mController,
|
||||||
AsyncPanZoomController::USE_GESTURE_DETECTOR);
|
AsyncPanZoomController::USE_GESTURE_DETECTOR);
|
||||||
apzc->SetCompositorParent(aCompositor);
|
apzc->SetCompositorParent(aCompositor);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -200,6 +200,7 @@ AsyncPanZoomController::InitializeGlobalState()
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
|
AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
|
||||||
|
APZCTreeManager* aTreeManager,
|
||||||
GeckoContentController* aGeckoContentController,
|
GeckoContentController* aGeckoContentController,
|
||||||
GestureBehavior aGestures)
|
GestureBehavior aGestures)
|
||||||
: mLayersId(aLayersId),
|
: mLayersId(aLayersId),
|
||||||
|
@ -221,7 +222,8 @@ AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
|
||||||
mAsyncScrollTimeoutTask(nullptr),
|
mAsyncScrollTimeoutTask(nullptr),
|
||||||
mDisableNextTouchBatch(false),
|
mDisableNextTouchBatch(false),
|
||||||
mHandlingTouchQueue(false),
|
mHandlingTouchQueue(false),
|
||||||
mDelayPanning(false)
|
mDelayPanning(false),
|
||||||
|
mTreeManager(aTreeManager)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(AsyncPanZoomController);
|
MOZ_COUNT_CTOR(AsyncPanZoomController);
|
||||||
|
|
||||||
|
@ -262,6 +264,7 @@ AsyncPanZoomController::Destroy()
|
||||||
mPrevSibling = nullptr;
|
mPrevSibling = nullptr;
|
||||||
mLastChild = nullptr;
|
mLastChild = nullptr;
|
||||||
mParent = nullptr;
|
mParent = nullptr;
|
||||||
|
mTreeManager = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */float
|
/* static */float
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include "InputData.h"
|
#include "InputData.h"
|
||||||
#include "Axis.h"
|
#include "Axis.h"
|
||||||
#include "TaskThrottler.h"
|
#include "TaskThrottler.h"
|
||||||
#include "mozilla/layers/APZCTreeManager.h"
|
|
||||||
#include "gfx3DMatrix.h"
|
#include "gfx3DMatrix.h"
|
||||||
|
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
|
@ -28,6 +27,7 @@ class CompositorParent;
|
||||||
class GestureEventListener;
|
class GestureEventListener;
|
||||||
class ContainerLayer;
|
class ContainerLayer;
|
||||||
class ViewTransform;
|
class ViewTransform;
|
||||||
|
class APZCTreeManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for all panning and zooming logic. Any time a user input is
|
* Controller for all panning and zooming logic. Any time a user input is
|
||||||
|
@ -73,6 +73,7 @@ public:
|
||||||
static float GetTouchStartTolerance();
|
static float GetTouchStartTolerance();
|
||||||
|
|
||||||
AsyncPanZoomController(uint64_t aLayersId,
|
AsyncPanZoomController(uint64_t aLayersId,
|
||||||
|
APZCTreeManager* aTreeManager,
|
||||||
GeckoContentController* aController,
|
GeckoContentController* aController,
|
||||||
GestureBehavior aGestures = DEFAULT_GESTURES);
|
GestureBehavior aGestures = DEFAULT_GESTURES);
|
||||||
~AsyncPanZoomController();
|
~AsyncPanZoomController();
|
||||||
|
@ -630,6 +631,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// This is a raw pointer to avoid introducing a reference cycle between
|
||||||
|
// AsyncPanZoomController and APZCTreeManager. Since these objects don't
|
||||||
|
// live on the main thread, we can't use the cycle collector with them.
|
||||||
|
// The APZCTreeManager owns the lifetime of the APZCs, so nulling this
|
||||||
|
// pointer out in Destroy() will prevent accessing deleted memory.
|
||||||
|
APZCTreeManager* mTreeManager;
|
||||||
|
|
||||||
nsRefPtr<AsyncPanZoomController> mLastChild;
|
nsRefPtr<AsyncPanZoomController> mLastChild;
|
||||||
nsRefPtr<AsyncPanZoomController> mPrevSibling;
|
nsRefPtr<AsyncPanZoomController> mPrevSibling;
|
||||||
nsRefPtr<AsyncPanZoomController> mParent;
|
nsRefPtr<AsyncPanZoomController> mParent;
|
||||||
|
|
|
@ -45,8 +45,8 @@ class TestAPZCContainerLayer : public ContainerLayer {
|
||||||
|
|
||||||
class TestAsyncPanZoomController : public AsyncPanZoomController {
|
class TestAsyncPanZoomController : public AsyncPanZoomController {
|
||||||
public:
|
public:
|
||||||
TestAsyncPanZoomController(uint64_t aLayersId, MockContentController* mcc)
|
TestAsyncPanZoomController(uint64_t aLayersId, MockContentController* aMcc)
|
||||||
: AsyncPanZoomController(aLayersId, mcc)
|
: AsyncPanZoomController(aLayersId, nullptr, aMcc)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void SetFrameMetrics(const FrameMetrics& metrics) {
|
void SetFrameMetrics(const FrameMetrics& metrics) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче