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

Unified Diff: content/renderer/input/main_thread_event_queue.cc

Issue 2233543002: Make first TouchStart and first TouchMove events on a flinging layer non-blocking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: set non_blocking to true Created 4 years, 4 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
Index: content/renderer/input/main_thread_event_queue.cc
diff --git a/content/renderer/input/main_thread_event_queue.cc b/content/renderer/input/main_thread_event_queue.cc
index 772d3be1c6bc31a979561586ac353b966ba1780a..84b340ef0b450ada334b7023ca2a630c079ae1cc 100644
--- a/content/renderer/input/main_thread_event_queue.cc
+++ b/content/renderer/input/main_thread_event_queue.cc
@@ -41,7 +41,8 @@ MainThreadEventQueue::MainThreadEventQueue(
: routing_id_(routing_id),
client_(client),
is_flinging_(false),
- main_task_runner_(main_task_runner) {}
+ main_task_runner_(main_task_runner),
+ waiting_for_first_touch_move_(false) {}
MainThreadEventQueue::~MainThreadEventQueue() {}
@@ -71,12 +72,28 @@ bool MainThreadEventQueue::HandleEvent(
blink::WebTouchEvent& touch_event =
static_cast<blink::WebTouchEvent&>(cloned_event->event());
touch_event.dispatchedDuringFling = is_flinging_;
+ bool touch_start_or_first_touch_move = false;
+ if (event->type == blink::WebInputEvent::TouchStart) {
+ waiting_for_first_touch_move_ = true;
+ touch_start_or_first_touch_move = true;
+ } else if (event->type == blink::WebInputEvent::TouchMove) {
+ touch_start_or_first_touch_move = waiting_for_first_touch_move_;
+ waiting_for_first_touch_move_ = false;
+ }
+ touch_event.touchStartOrFirstTouchMove = touch_start_or_first_touch_move;
dtapuska 2016/08/12 14:40:00 Why is this populated here? Can't it be sent from
// Adjust the |dispatchType| on the event since the compositor
// determined all event listeners are passive.
if (non_blocking) {
touch_event.dispatchType =
blink::WebInputEvent::ListenersNonBlockingPassive;
}
+ if (is_flinging_ && touch_start_or_first_touch_move &&
+ touch_event.dispatchType == blink::WebInputEvent::Blocking) {
+ touch_event.dispatchType =
+ blink::WebInputEvent::ListenersForcedNonBlockingPassiveDueToFling;
+ cloned_event->setDispatchType(DISPATCH_TYPE_NON_BLOCKING);
+ non_blocking = true;
+ }
}
if (is_wheel && non_blocking) {
// Adjust the |dispatchType| on the event since the compositor
« no previous file with comments | « content/renderer/input/main_thread_event_queue.h ('k') | content/renderer/input/main_thread_event_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698