Commit ae26a2e4 authored by Marijn Kruisselbrink's avatar Marijn Kruisselbrink Committed by Commit Bot

Revert "synthetic gesture: Allow high-frequency dispatch."

This reverts commit 581a728b.

Reason for revert: Causing significant test flakiness in telemetry.internal.actions.scroll_unittest.ScrollActionTest.testScrollDistanceSlowWheel.

Original change's description:
> synthetic gesture: Allow high-frequency dispatch.
> 
> For synthesized scroll/drag/pinch gestures, dispatch the events
> at a high frequency (120Hz) so that there's at least one event in
> each frame. Dispatching events at a lower frequency (60Hz) means
> the timer can go out of sync with begin-frame, and so there can
> be frames where there was to event dispatch. Our telemetry code
> reports this as jank, which is incorrect. Dispatching at a higher
> frequency for the scroll/drag/pinch gestures resolves this issue.
> 
> BUG=783034
> 
> Change-Id: I1102f76ed743231cbb10fdb872e8c66f895fa223
> Reviewed-on: https://chromium-review.googlesource.com/c/1255152
> Reviewed-by: Victor Miura <vmiura@chromium.org>
> Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
> Reviewed-by: Lan Wei <lanwei@chromium.org>
> Commit-Queue: Sadrul Chowdhury <sadrul@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#596507}

TBR=sadrul@chromium.org,vmiura@chromium.org,lanwei@chromium.org,nzolghadr@chromium.org

Change-Id: I1e4d64dfc3b98a547c38f8f82a2dcd45141fd66b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 783034, 892036
Reviewed-on: https://chromium-review.googlesource.com/c/1261972Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596748}
parent 79205a19
...@@ -52,8 +52,4 @@ std::unique_ptr<SyntheticGesture> SyntheticGesture::Create( ...@@ -52,8 +52,4 @@ std::unique_ptr<SyntheticGesture> SyntheticGesture::Create(
} }
} }
bool SyntheticGesture::AllowHighFrequencyDispatch() const {
return true;
}
} // namespace content } // namespace content
...@@ -51,12 +51,6 @@ class CONTENT_EXPORT SyntheticGesture { ...@@ -51,12 +51,6 @@ class CONTENT_EXPORT SyntheticGesture {
virtual Result ForwardInputEvents( virtual Result ForwardInputEvents(
const base::TimeTicks& timestamp, SyntheticGestureTarget* target) = 0; const base::TimeTicks& timestamp, SyntheticGestureTarget* target) = 0;
// Returns whether the gesture events can be dispatched at high frequency
// (e.g. at 120Hz), instead of the regular frequence (at 60Hz). Some gesture
// interact differently depending on how long they take (e.g. the TAP gesture
// generates a click only if its duration is longer than a threshold).
virtual bool AllowHighFrequencyDispatch() const;
protected: protected:
DISALLOW_COPY_AND_ASSIGN(SyntheticGesture); DISALLOW_COPY_AND_ASSIGN(SyntheticGesture);
}; };
......
...@@ -40,10 +40,11 @@ void SyntheticGestureController::QueueSyntheticGesture( ...@@ -40,10 +40,11 @@ void SyntheticGestureController::QueueSyntheticGesture(
StartGesture(*pending_gesture_queue_.FrontGesture()); StartGesture(*pending_gesture_queue_.FrontGesture());
} }
void SyntheticGestureController::StartTimer(bool high_frequency) { void SyntheticGestureController::StartTimer() {
// TODO(sad): Change the interval to allow sending multiple events per begin
// frame.
dispatch_timer_.Start( dispatch_timer_.Start(
FROM_HERE, FROM_HERE, base::TimeDelta::FromMicroseconds(16666),
base::TimeDelta::FromMicroseconds(high_frequency ? 8333 : 16666),
base::BindRepeating( base::BindRepeating(
[](base::WeakPtr<SyntheticGestureController> weak_ptr) { [](base::WeakPtr<SyntheticGestureController> weak_ptr) {
if (weak_ptr) if (weak_ptr)
...@@ -89,7 +90,7 @@ void SyntheticGestureController::StartGesture(const SyntheticGesture& gesture) { ...@@ -89,7 +90,7 @@ void SyntheticGestureController::StartGesture(const SyntheticGesture& gesture) {
"SyntheticGestureController::running", "SyntheticGestureController::running",
&gesture); &gesture);
if (!dispatch_timer_.IsRunning()) if (!dispatch_timer_.IsRunning())
StartTimer(gesture.AllowHighFrequencyDispatch()); StartTimer();
} }
void SyntheticGestureController::StopGesture( void SyntheticGestureController::StopGesture(
......
...@@ -52,7 +52,7 @@ class CONTENT_EXPORT SyntheticGestureController { ...@@ -52,7 +52,7 @@ class CONTENT_EXPORT SyntheticGestureController {
private: private:
friend class SyntheticGestureControllerTestBase; friend class SyntheticGestureControllerTestBase;
void StartTimer(bool high_frequency); void StartTimer();
void StartGesture(const SyntheticGesture& gesture); void StartGesture(const SyntheticGesture& gesture);
void StopGesture(const SyntheticGesture& gesture, void StopGesture(const SyntheticGesture& gesture,
OnGestureCompleteCallback completion_callback, OnGestureCompleteCallback completion_callback,
......
...@@ -47,10 +47,6 @@ SyntheticGesture::Result SyntheticPointerAction::ForwardInputEvents( ...@@ -47,10 +47,6 @@ SyntheticGesture::Result SyntheticPointerAction::ForwardInputEvents(
: SyntheticGesture::GESTURE_RUNNING; : SyntheticGesture::GESTURE_RUNNING;
} }
bool SyntheticPointerAction::AllowHighFrequencyDispatch() const {
return false;
}
SyntheticPointerAction::GestureState SyntheticPointerAction::GestureState
SyntheticPointerAction::ForwardTouchOrMouseInputEvents( SyntheticPointerAction::ForwardTouchOrMouseInputEvents(
const base::TimeTicks& timestamp, const base::TimeTicks& timestamp,
......
...@@ -24,7 +24,6 @@ class CONTENT_EXPORT SyntheticPointerAction : public SyntheticGesture { ...@@ -24,7 +24,6 @@ class CONTENT_EXPORT SyntheticPointerAction : public SyntheticGesture {
SyntheticGesture::Result ForwardInputEvents( SyntheticGesture::Result ForwardInputEvents(
const base::TimeTicks& timestamp, const base::TimeTicks& timestamp,
SyntheticGestureTarget* target) override; SyntheticGestureTarget* target) override;
bool AllowHighFrequencyDispatch() const override;
private: private:
enum GestureState { UNINITIALIZED, RUNNING, INVALID, DONE }; enum GestureState { UNINITIALIZED, RUNNING, INVALID, DONE };
......
...@@ -46,10 +46,6 @@ SyntheticGesture::Result SyntheticTapGesture::ForwardInputEvents( ...@@ -46,10 +46,6 @@ SyntheticGesture::Result SyntheticTapGesture::ForwardInputEvents(
: SyntheticGesture::GESTURE_RUNNING; : SyntheticGesture::GESTURE_RUNNING;
} }
bool SyntheticTapGesture::AllowHighFrequencyDispatch() const {
return false;
}
void SyntheticTapGesture::ForwardTouchOrMouseInputEvents( void SyntheticTapGesture::ForwardTouchOrMouseInputEvents(
const base::TimeTicks& timestamp, SyntheticGestureTarget* target) { const base::TimeTicks& timestamp, SyntheticGestureTarget* target) {
switch (state_) { switch (state_) {
......
...@@ -22,7 +22,6 @@ class CONTENT_EXPORT SyntheticTapGesture : public SyntheticGesture { ...@@ -22,7 +22,6 @@ class CONTENT_EXPORT SyntheticTapGesture : public SyntheticGesture {
SyntheticGesture::Result ForwardInputEvents( SyntheticGesture::Result ForwardInputEvents(
const base::TimeTicks& timestamp, const base::TimeTicks& timestamp,
SyntheticGestureTarget* target) override; SyntheticGestureTarget* target) override;
bool AllowHighFrequencyDispatch() const override;
private: private:
enum GestureState { enum GestureState {
......
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