Bug 1388466 - Sync focus sequence numbers when the compositor is reset. r?kats draft
authorRyan Hunt <rhunt@eqrion.net>
Thu, 10 Aug 2017 15:07:35 -0500
changeset 644307 e3d7e48fd3c6b8a2e84f8b18fc78f0a29f47005d
parent 644278 21f357e2d9f5cf1afab8934a7e2821026c1bb1a4
child 725569 5d7e35fae7d85aaaf2824172f87c2ee7f8e1659d
push id73391
push userbmo:rhunt@eqrion.net
push dateThu, 10 Aug 2017 20:07:48 +0000
reviewerskats
bugs1388466
milestone57.0a1
Bug 1388466 - Sync focus sequence numbers when the compositor is reset. r?kats When a compositor is recreated, either from a driver reset or a GPU process crash, the focus sequence number in content persists, and when APZ is recreated, content will have a higher sequence number. There are two ways of handling this: either resetting all of content's focus sequence numbers to zero to match the new focus state, or updating the new focus state to the latest sequence number in content. This commit does the latter by detecting when the focus state was newly created and syncing it's sequence number to content if content is ahead. MozReview-Commit-ID: GkIp7AWyaFw
gfx/layers/apz/src/FocusState.cpp
--- a/gfx/layers/apz/src/FocusState.cpp
+++ b/gfx/layers/apz/src/FocusState.cpp
@@ -98,16 +98,24 @@ FocusState::Update(uint64_t aRootLayerTr
 
         // This is the global focus target
         mFocusHorizontalTarget = target.mData.mScrollTargets.mHorizontal;
         mFocusVerticalTarget = target.mData.mScrollTargets.mVertical;
 
         // Mark what sequence number this target has so we can determine whether
         // it is stale or not
         mLastContentProcessedEvent = target.mSequenceNumber;
+
+        // If this focus state was just created and content has experienced more
+        // events then us, then assume we were recreated and sync focus sequence
+        // numbers.
+        if (mLastAPZProcessedEvent == 1 &&
+            mLastContentProcessedEvent > mLastAPZProcessedEvent) {
+          mLastAPZProcessedEvent = mLastContentProcessedEvent;
+        }
         return;
       }
       case FocusTarget::eNone: {
         FS_LOG("Setting target to nil (reached a nil target)\n");
 
         // Mark what sequence number this target has for debugging purposes so
         // we can always accurately report on whether we are stale or not
         mLastContentProcessedEvent = target.mSequenceNumber;