Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: content/browser/renderer_host/input/synthetic_gesture_controller.cc

Issue 2910513006: input: Immediately start timer for synthetic event dispatch. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/input/synthetic_gesture_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/input/synthetic_gesture_controller.cc
diff --git a/content/browser/renderer_host/input/synthetic_gesture_controller.cc b/content/browser/renderer_host/input/synthetic_gesture_controller.cc
index f6503e866ac3489c5720c08e95d871f65081a688..3c5dcdc066d67ad6ac8bb35c2ccf37913c9f2b68 100644
--- a/content/browser/renderer_host/input/synthetic_gesture_controller.cc
+++ b/content/browser/renderer_host/input/synthetic_gesture_controller.cc
@@ -40,27 +40,6 @@ void SyntheticGestureController::QueueSyntheticGesture(
StartGesture(*pending_gesture_queue_.FrontGesture());
}
-void SyntheticGestureController::RequestBeginFrame() {
- DCHECK(!dispatch_timer_.IsRunning());
- delegate_->RequestBeginFrameForSynthesizedInput(
- base::BindOnce(&SyntheticGestureController::OnBeginFrame,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
-void SyntheticGestureController::OnBeginFrame() {
- // In order to make sure we get consistent results across runs, we attempt to
- // start the timer at a fixed offset from the vsync. Starting the timer
- // shortly after a begin-frame is likely to produce latency close to the worst
- // cases. We feel 2 milliseconds is a good offset for this.
- constexpr base::TimeDelta kSynthesizedDispatchDelay =
- base::TimeDelta::FromMilliseconds(2);
- base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
- FROM_HERE,
- base::BindOnce(&SyntheticGestureController::StartTimer,
- weak_ptr_factory_.GetWeakPtr()),
- kSynthesizedDispatchDelay);
-}
-
void SyntheticGestureController::StartTimer() {
// TODO(sad): Change the interval to allow sending multiple events per begin
// frame.
@@ -111,7 +90,7 @@ void SyntheticGestureController::StartGesture(const SyntheticGesture& gesture) {
"SyntheticGestureController::running",
&gesture);
if (!dispatch_timer_.IsRunning())
- RequestBeginFrame();
+ StartTimer();
}
void SyntheticGestureController::StopGesture(
« no previous file with comments | « content/browser/renderer_host/input/synthetic_gesture_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698