From 419b25a2312eef98555cefe7836e4f1e827d6940 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 9 Mar 2016 22:57:14 -0500 Subject: [PATCH] Bug 1253860 - Stop APZC from reprocessing stale metrics on unrelated layer tree updates. r=botond MozReview-Commit-ID: 5JM83cngdVy --- gfx/layers/apz/src/AsyncPanZoomController.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 32fd424aafe4..583dfc5aa901 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -3254,6 +3254,16 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri ReentrantMonitorAutoEnter lock(mMonitor); bool isDefault = mFrameMetrics.IsDefault(); + if (!aThisLayerTreeUpdated && !isDefault) { + // No new information here, skip it. Note that this is not just an + // optimization; it's correctness too. In the case where we get one of these + // stale aLayerMetrics *after* a call to UpdateScrollOffset, processing the + // stale aLayerMetrics would clobber the more up-to-date information from + // UpdateScrollOffset. + MOZ_ASSERT(aLayerMetrics == mLastContentPaintMetrics); + APZC_LOG("%p NotifyLayersUpdated short-circuit\n", this); + return; + } mLastContentPaintMetrics = aLayerMetrics; mFrameMetrics.SetScrollParentId(aLayerMetrics.GetScrollParentId());