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

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

Issue 2581243004: Pass main thread responsiveness threshold via Finch (Closed)
Patch Set: Use EXPECT_FALSE/TRUE - avoids compile error. Created 3 years, 10 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 fdee19fadac822824efadd15e71a0ccce5565386..383b87a4980efda1bd1f77d213ac830b6082f5e9 100644
--- a/content/renderer/input/main_thread_event_queue.cc
+++ b/content/renderer/input/main_thread_event_queue.cc
@@ -4,7 +4,9 @@
#include "content/renderer/input/main_thread_event_queue.h"
+#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h"
+#include "base/strings/string_number_conversions.h"
#include "content/common/input/event_with_latency_info.h"
#include "content/common/input_messages.h"
@@ -73,7 +75,26 @@ MainThreadEventQueue::MainThreadEventQueue(
handle_raf_aligned_mouse_input_(
base::FeatureList::IsEnabled(features::kRafAlignedMouseInputEvents)),
main_task_runner_(main_task_runner),
- renderer_scheduler_(renderer_scheduler) {}
+ renderer_scheduler_(renderer_scheduler) {
+ if (enable_non_blocking_due_to_main_thread_responsiveness_flag_) {
+ std::string group = base::FieldTrialList::FindFullName(
+ "MainThreadResponsivenessScrollIntervention");
+
+ // The group name will be of the form Enabled$THRESHOLD_MS. Trim the prefix
+ // "Enabled", and parse the threshold.
+ int threshold_ms = 0;
+ std::string prefix = "Enabled";
+ group.erase(0, prefix.length());
+ base::StringToInt(group, &threshold_ms);
+
+ if (threshold_ms <= 0) {
+ enable_non_blocking_due_to_main_thread_responsiveness_flag_ = false;
+ } else {
+ main_thread_responsiveness_threshold_ =
+ base::TimeDelta::FromMilliseconds(threshold_ms);
+ }
+ }
+}
MainThreadEventQueue::~MainThreadEventQueue() {}
@@ -123,7 +144,8 @@ bool MainThreadEventQueue::HandleEvent(
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();
+ renderer_scheduler_->MainThreadSeemsUnresponsive(
+ main_thread_responsiveness_threshold_);
if (passive_due_to_unresponsive_main) {
touch_event->dispatchType = blink::WebInputEvent::
ListenersForcedNonBlockingDueToMainThreadResponsiveness;
« 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