Bug 947337 - Track the last metrics actually sent to Gecko after coming out of the throttler. r=botond

This commit is contained in:
Kartikaya Gupta 2014-01-21 16:26:57 -05:00
parent d1075d4513
commit 942438d756
2 changed files with 29 additions and 9 deletions

View File

@ -1370,6 +1370,19 @@ void AsyncPanZoomController::RequestContentRepaint(FrameMetrics& aFrameMetrics)
}
SendAsyncScrollEvent();
mPaintThrottler.PostTask(
FROM_HERE,
NewRunnableMethod(this,
&AsyncPanZoomController::DispatchRepaintRequest,
aFrameMetrics),
GetFrameTime());
aFrameMetrics.mPresShellId = mLastContentPaintMetrics.mPresShellId;
mLastPaintRequestMetrics = aFrameMetrics;
}
void
AsyncPanZoomController::DispatchRepaintRequest(const FrameMetrics& aFrameMetrics) {
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
APZC_LOG_FM(aFrameMetrics, "%p requesting content repaint", this);
@ -1377,15 +1390,9 @@ void AsyncPanZoomController::RequestContentRepaint(FrameMetrics& aFrameMetrics)
LogRendertraceRect(GetGuid(), "requested displayport", "yellow",
aFrameMetrics.mDisplayPort + aFrameMetrics.mScrollOffset);
mPaintThrottler.PostTask(
FROM_HERE,
NewRunnableMethod(controller.get(),
&GeckoContentController::RequestContentRepaint,
aFrameMetrics),
GetFrameTime());
controller->RequestContentRepaint(aFrameMetrics);
mLastDispatchedPaintMetrics = aFrameMetrics;
}
aFrameMetrics.mPresShellId = mLastContentPaintMetrics.mPresShellId;
mLastPaintRequestMetrics = aFrameMetrics;
}
void
@ -1553,15 +1560,18 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
}
if (aIsFirstPaint || isDefault) {
// Initialize our internal state to something sane when the content
// that was just painted is something we knew nothing about previously
mPaintThrottler.ClearHistory();
mPaintThrottler.SetMaxDurations(gNumPaintDurationSamples);
mX.CancelTouch();
mY.CancelTouch();
SetState(NOTHING);
mFrameMetrics = aLayerMetrics;
mLastDispatchedPaintMetrics = aLayerMetrics;
ShareCompositorFrameMetrics();
SetState(NOTHING);
} else {
// If we're not taking the aLayerMetrics wholesale we still need to pull
// in some things into our local mFrameMetrics because these things are

View File

@ -484,6 +484,11 @@ protected:
*/
void RequestContentRepaint(FrameMetrics& aFrameMetrics);
/**
* Actually send the next pending paint request to gecko.
*/
void DispatchRepaintRequest(const FrameMetrics& aFrameMetrics);
/**
* Advances a fling by an interpolated amount based on the passed in |aDelta|.
* This should be called whenever sampling the content transform for this
@ -635,6 +640,11 @@ private:
// that we're not requesting a paint of the same thing that's already drawn.
// If we don't do this check, we don't get a ShadowLayersUpdated back.
FrameMetrics mLastPaintRequestMetrics;
// The last metrics that we actually sent to Gecko. This allows us to transform
// inputs into a coordinate space that Gecko knows about. This assumes the pipe
// through which input events and repaint requests are sent to Gecko operates
// in a FIFO manner.
FrameMetrics mLastDispatchedPaintMetrics;
nsTArray<MultiTouchInput> mTouchQueue;