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

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: fling intervetion 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 ee2a34918d69a96861d89c6cf1935c2be2e93f48..c7ff94751142c429d1c2f31ffef54a3686e6b7c1 100644
--- a/content/renderer/input/main_thread_event_queue.cc
+++ b/content/renderer/input/main_thread_event_queue.cc
@@ -41,6 +41,7 @@ MainThreadEventQueue::MainThreadEventQueue(
: routing_id_(routing_id),
client_(client),
is_flinging_(false),
+ is_last_touch_start_force_passive_(false),
main_task_runner_(main_task_runner) {}
MainThreadEventQueue::~MainThreadEventQueue() {}
@@ -57,10 +58,6 @@ bool MainThreadEventQueue::HandleEvent(
bool non_blocking = original_dispatch_type == DISPATCH_TYPE_NON_BLOCKING ||
ack_result == INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING;
-
- InputEventDispatchType dispatch_type =
- non_blocking ? DISPATCH_TYPE_NON_BLOCKING : DISPATCH_TYPE_BLOCKING;
-
bool is_wheel = event->type == blink::WebInputEvent::MouseWheel;
bool is_touch = blink::WebInputEvent::isTouchEventType(event->type);
@@ -74,6 +71,23 @@ bool MainThreadEventQueue::HandleEvent(
touch_event->dispatchType =
blink::WebInputEvent::ListenersNonBlockingPassive;
}
+
+ if (base::FeatureList::IsEnabled(
+ features::kPassiveEventListenersDueToFling) &&
tdresser 2016/08/17 14:32:27 Let's read this flag once, and store the result in
lanwei 2016/08/18 12:31:47 Done.
+ is_flinging_ && touch_event->touchStartOrFirstTouchMove &&
+ touch_event->dispatchType == blink::WebInputEvent::Blocking) {
+ // If the touch start is forced to be passive due to fling, its following
+ // touch move should also be passive.
+ if (touch_event->type == blink::WebInputEvent::TouchStart ||
+ is_last_touch_start_force_passive_) {
+ touch_event->dispatchType =
+ blink::WebInputEvent::ListenersForcedNonBlockingPassiveDueToFling;
+ non_blocking = true;
+ is_last_touch_start_force_passive_ = true;
tdresser 2016/08/17 14:32:27 This variable name is a bit confusing, as the tens
lanwei 2016/08/18 12:31:47 Done.
+ }
+ } else if (touch_event->type == blink::WebInputEvent::TouchStart) {
+ is_last_touch_start_force_passive_ = false;
+ }
}
if (is_wheel && non_blocking) {
// Adjust the |dispatchType| on the event since the compositor
@@ -82,6 +96,8 @@ bool MainThreadEventQueue::HandleEvent(
->dispatchType = blink::WebInputEvent::ListenersNonBlockingPassive;
}
+ InputEventDispatchType dispatch_type =
+ non_blocking ? DISPATCH_TYPE_NON_BLOCKING : DISPATCH_TYPE_BLOCKING;
std::unique_ptr<EventWithDispatchType> event_with_dispatch_type(
new EventWithDispatchType(std::move(event), latency, dispatch_type));

Powered by Google App Engine
This is Rietveld 408576698