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

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

Issue 2273703002: Force events to be non blocking if main thread is unresponsive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 years 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 35005e6ab4d0df0844ba7d07e6a448df57694d12..fe67fb2466804494a736e32a1b1aba62e2d960eb 100644
--- a/content/renderer/input/main_thread_event_queue.cc
+++ b/content/renderer/input/main_thread_event_queue.cc
@@ -70,6 +70,9 @@ MainThreadEventQueue::MainThreadEventQueue(
last_touch_start_forced_nonblocking_due_to_fling_(false),
enable_fling_passive_listener_flag_(base::FeatureList::IsEnabled(
features::kPassiveEventListenersDueToFling)),
+ enable_non_blocking_due_to_main_thread_responsiveness_flag_(
+ base::FeatureList::IsEnabled(
+ features::kMainThreadBusyScrollIntervention)),
handle_raf_aligned_touch_input_(
base::FeatureList::IsEnabled(features::kRafAlignedTouchInputEvents)),
handle_raf_aligned_mouse_input_(
@@ -121,10 +124,22 @@ bool MainThreadEventQueue::HandleEvent(
last_touch_start_forced_nonblocking_due_to_fling_ = true;
}
}
+
// If handling rAF aligned touch input ACK non-cancelable events right
// away.
if (!non_blocking && IsRafAlignedEvent(*touch_event))
non_blocking = true;
+
+ if (enable_non_blocking_due_to_main_thread_responsiveness_flag_ &&
+ touch_event->dispatchType == blink::WebInputEvent::Blocking) {
+ bool passive_due_to_unresponsive_main =
+ renderer_scheduler_->MainThreadSeemsUnresponsive();
+ if (passive_due_to_unresponsive_main) {
+ touch_event->dispatchType = blink::WebInputEvent::
+ ListenersForcedNonBlockingDueToMainThreadResponsiveness;
+ non_blocking = true;
+ }
+ }
}
if (is_wheel && non_blocking) {
// Adjust the |dispatchType| on the event since the compositor

Powered by Google App Engine
This is Rietveld 408576698