mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1002754 - Don't store a pointer to the cross-process compositor parent as it may go bad; pull it on demand instead. r=rbarker, r=botond
This commit is contained in:
parent
c4938d1cf0
commit
57614b5dab
@ -200,7 +200,9 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
||||
apzc = new AsyncPanZoomController(aLayersId, this, state->mController,
|
||||
AsyncPanZoomController::USE_GESTURE_DETECTOR);
|
||||
apzc->SetCompositorParent(aCompositor);
|
||||
apzc->SetCrossProcessCompositorParent(state->mCrossProcessParent);
|
||||
if (state->mCrossProcessParent != nullptr) {
|
||||
apzc->ShareFrameMetricsAcrossProcesses();
|
||||
}
|
||||
} else {
|
||||
// If there was already an APZC for the layer clear the tree pointers
|
||||
// so that it doesn't continue pointing to APZCs that should no longer
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <algorithm> // for max, min
|
||||
#include "AnimationCommon.h" // for ComputedTimingFunction
|
||||
#include "AsyncPanZoomController.h" // for AsyncPanZoomController, etc
|
||||
#include "Compositor.h" // for Compositor
|
||||
#include "CompositorParent.h" // for CompositorParent
|
||||
#include "FrameMetrics.h" // for FrameMetrics, etc
|
||||
#include "GestureEventListener.h" // for GestureEventListener
|
||||
@ -460,10 +461,10 @@ AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
|
||||
GeckoContentController* aGeckoContentController,
|
||||
GestureBehavior aGestures)
|
||||
: mLayersId(aLayersId),
|
||||
mCrossProcessCompositorParent(nullptr),
|
||||
mPaintThrottler(GetFrameTime()),
|
||||
mGeckoContentController(aGeckoContentController),
|
||||
mRefPtrMonitor("RefPtrMonitor"),
|
||||
mSharingFrameMetricsAcrossProcesses(false),
|
||||
mMonitor("AsyncPanZoomController"),
|
||||
mTouchActionPropertyEnabled(gfxPrefs::TouchActionEnabled()),
|
||||
mContentResponseTimeoutTask(nullptr),
|
||||
@ -492,9 +493,7 @@ AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
|
||||
}
|
||||
|
||||
AsyncPanZoomController::~AsyncPanZoomController() {
|
||||
|
||||
PCompositorParent* compositor =
|
||||
(mCrossProcessCompositorParent ? mCrossProcessCompositorParent : mCompositorParent.get());
|
||||
PCompositorParent* compositor = GetSharedFrameMetricsCompositor();
|
||||
|
||||
// Only send the release message if the SharedFrameMetrics has been created.
|
||||
if (compositor && mSharedFrameMetricsBuffer) {
|
||||
@ -507,6 +506,19 @@ AsyncPanZoomController::~AsyncPanZoomController() {
|
||||
MOZ_COUNT_DTOR(AsyncPanZoomController);
|
||||
}
|
||||
|
||||
PCompositorParent*
|
||||
AsyncPanZoomController::GetSharedFrameMetricsCompositor()
|
||||
{
|
||||
Compositor::AssertOnCompositorThread();
|
||||
|
||||
if (mSharingFrameMetricsAcrossProcesses) {
|
||||
const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(mLayersId);
|
||||
// |state| may be null here if the CrossProcessCompositorParent has already been destroyed.
|
||||
return state ? state->mCrossProcessParent : nullptr;
|
||||
}
|
||||
return mCompositorParent.get();
|
||||
}
|
||||
|
||||
already_AddRefed<GeckoContentController>
|
||||
AsyncPanZoomController::GetGeckoContentController() {
|
||||
MonitorAutoLock lock(mRefPtrMonitor);
|
||||
@ -1394,8 +1406,8 @@ void AsyncPanZoomController::SetCompositorParent(CompositorParent* aCompositorPa
|
||||
mCompositorParent = aCompositorParent;
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::SetCrossProcessCompositorParent(PCompositorParent* aCrossProcessCompositorParent) {
|
||||
mCrossProcessCompositorParent = aCrossProcessCompositorParent;
|
||||
void AsyncPanZoomController::ShareFrameMetricsAcrossProcesses() {
|
||||
mSharingFrameMetricsAcrossProcesses = true;
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::ScrollBy(const CSSPoint& aOffset) {
|
||||
@ -2204,8 +2216,7 @@ void AsyncPanZoomController::UpdateSharedCompositorFrameMetrics()
|
||||
|
||||
void AsyncPanZoomController::ShareCompositorFrameMetrics() {
|
||||
|
||||
PCompositorParent* compositor =
|
||||
(mCrossProcessCompositorParent ? mCrossProcessCompositorParent : mCompositorParent.get());
|
||||
PCompositorParent* compositor = GetSharedFrameMetricsCompositor();
|
||||
|
||||
// Only create the shared memory buffer if it hasn't already been created,
|
||||
// we are using progressive tile painting, and we have a
|
||||
|
@ -185,12 +185,11 @@ public:
|
||||
void SetCompositorParent(CompositorParent* aCompositorParent);
|
||||
|
||||
/**
|
||||
* The platform implementation must set the cross process compositor if
|
||||
* there is one associated with the layer tree. The cross process compositor
|
||||
* allows the APZC to share its FrameMetrics with the content process.
|
||||
* The shared FrameMetrics is used in progressive paint updates.
|
||||
* Inform this APZC that it will be sharing its FrameMetrics with a cross-process
|
||||
* compositor so that the associated content process can access it. This is only
|
||||
* relevant when progressive painting is enabled.
|
||||
*/
|
||||
void SetCrossProcessCompositorParent(PCompositorParent* aCrossProcessCompositorParent);
|
||||
void ShareFrameMetricsAcrossProcesses();
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// These methods can be called from any thread.
|
||||
@ -653,7 +652,6 @@ private:
|
||||
|
||||
uint64_t mLayersId;
|
||||
nsRefPtr<CompositorParent> mCompositorParent;
|
||||
PCompositorParent* mCrossProcessCompositorParent;
|
||||
TaskThrottler mPaintThrottler;
|
||||
|
||||
/* Access to the following two fields is protected by the mRefPtrMonitor,
|
||||
@ -667,6 +665,12 @@ private:
|
||||
already_AddRefed<GeckoContentController> GetGeckoContentController();
|
||||
already_AddRefed<GestureEventListener> GetGestureEventListener();
|
||||
|
||||
// If we are sharing our frame metrics with content across processes
|
||||
bool mSharingFrameMetricsAcrossProcesses;
|
||||
/* Utility function to get the Compositor with which we share the FrameMetrics.
|
||||
This function is only callable from the compositor thread. */
|
||||
PCompositorParent* GetSharedFrameMetricsCompositor();
|
||||
|
||||
protected:
|
||||
// Both |mFrameMetrics| and |mLastContentPaintMetrics| are protected by the
|
||||
// monitor. Do not read from or modify either of them without locking.
|
||||
|
Loading…
Reference in New Issue
Block a user