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

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

Issue 2890603002: input: Delay the dispatch of synthesized input event. (Closed)
Patch Set: tot merge 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 | « no previous file | 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 51c28aa406042f57fed6562efd9c550582f7a982..9c5fdeaa7aa8ed6a4d47a17b5630378aed63b0f3 100644
--- a/content/browser/renderer_host/input/synthetic_gesture_controller.cc
+++ b/content/browser/renderer_host/input/synthetic_gesture_controller.cc
@@ -39,9 +39,17 @@ void SyntheticGestureController::QueueSyntheticGesture(
}
void SyntheticGestureController::OnBeginFrame() {
- // TODO(sad): Instead of dispatching the events immediately, dispatch after an
- // offset.
- DispatchNextEvent();
+ constexpr base::TimeDelta kSynthesizedDispatchDelay =
+ base::TimeDelta::FromMilliseconds(2);
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE,
+ base::BindOnce(
+ [](base::WeakPtr<SyntheticGestureController> weak_ptr) {
+ if (weak_ptr)
+ weak_ptr->DispatchNextEvent(base::TimeTicks::Now());
+ },
+ weak_ptr_factory_.GetWeakPtr()),
+ kSynthesizedDispatchDelay);
}
bool SyntheticGestureController::DispatchNextEvent(base::TimeTicks timestamp) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698