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
--- 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;