Commit b12cd2ca authored by skyostil's avatar skyostil Committed by Commit bot

scheduler: Reset pending input event count on navigation

When a navigation happens, we should reset the number of pending input
events in the user model to avoid waiting for an acknowledgement which
may never arrive.

This is a speculative mitigation for crbug.com/652294.

BUG=652294

Review-Url: https://codereview.chromium.org/2476263002
Cr-Commit-Position: refs/heads/master@{#430281}
parent d8274d90
......@@ -196,6 +196,7 @@ void UserModel::Reset(base::TimeTicks now) {
last_reset_time_ = now;
is_gesture_active_ = false;
is_gesture_expected_ = false;
pending_input_event_count_ = 0;
}
void UserModel::AsValueInto(base::trace_event::TracedValue* state) const {
......
......@@ -252,5 +252,15 @@ TEST_F(UserModelTest, IsGestureExpectedToContinue_LongAfterGestureStarted) {
EXPECT_EQ(base::TimeDelta(), prediction_valid_duration);
}
TEST_F(UserModelTest, ResetPendingInputCount) {
user_model_->DidStartProcessingInputEvent(
blink::WebInputEvent::Type::GestureScrollBegin, clock_->NowTicks());
EXPECT_EQ(priority_escalation_after_input_duration(),
user_model_->TimeLeftInUserGesture(clock_->NowTicks()));
user_model_->Reset(clock_->NowTicks());
EXPECT_EQ(base::TimeDelta(),
user_model_->TimeLeftInUserGesture(clock_->NowTicks()));
}
} // namespace scheduler
} // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment