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

Side by Side Diff: content/renderer/input/render_widget_input_handler.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: Renamed ReadOrFail to TryRead. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/input/render_widget_input_handler.h" 5 #include "content/renderer/input/render_widget_input_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 WebInputEvent::DispatchType dispatch_type, 117 WebInputEvent::DispatchType dispatch_type,
118 double event_timestamp, 118 double event_timestamp,
119 const ui::LatencyInfo& latency_info) { 119 const ui::LatencyInfo& latency_info) {
120 enum { 120 enum {
121 PASSIVE_LISTENER_UMA_ENUM_PASSIVE, 121 PASSIVE_LISTENER_UMA_ENUM_PASSIVE,
122 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE, 122 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE,
123 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED, 123 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED,
124 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE, 124 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE,
125 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, 125 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED,
126 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING, 126 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING,
127 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPONSIVEN ESS,
127 PASSIVE_LISTENER_UMA_ENUM_COUNT 128 PASSIVE_LISTENER_UMA_ENUM_COUNT
128 }; 129 };
129 130
130 int enum_value; 131 int enum_value;
131 switch (dispatch_type) { 132 switch (dispatch_type) {
132 case WebInputEvent::ListenersForcedNonBlockingDueToFling: 133 case WebInputEvent::ListenersForcedNonBlockingDueToFling:
133 enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING; 134 enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING;
134 break; 135 break;
136 case WebInputEvent::ListenersForcedNonBlockingDueToMainThreadResponsiveness:
137 enum_value =
138 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPO NSIVENESS;
139 break;
135 case WebInputEvent::ListenersNonBlockingPassive: 140 case WebInputEvent::ListenersNonBlockingPassive:
136 enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE; 141 enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE;
137 break; 142 break;
138 case WebInputEvent::EventNonBlocking: 143 case WebInputEvent::EventNonBlocking:
139 enum_value = PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE; 144 enum_value = PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE;
140 break; 145 break;
141 case WebInputEvent::Blocking: 146 case WebInputEvent::Blocking:
142 if (result == WebInputEventResult::HandledApplication) 147 if (result == WebInputEventResult::HandledApplication)
143 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED; 148 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED;
144 else if (result == WebInputEventResult::HandledSuppressed) 149 else if (result == WebInputEventResult::HandledSuppressed)
(...skipping 14 matching lines...) Expand all
159 base::TimeTicks now = base::TimeTicks::Now(); 164 base::TimeTicks now = base::TimeTicks::Now();
160 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency", 165 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency",
161 GetEventLatencyMicros(event_timestamp, now), 166 GetEventLatencyMicros(event_timestamp, now),
162 1, 10000000, 100); 167 1, 10000000, 100);
163 } else if (enum_value == 168 } else if (enum_value ==
164 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING) { 169 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING) {
165 base::TimeTicks now = base::TimeTicks::Now(); 170 base::TimeTicks now = base::TimeTicks::Now();
166 UMA_HISTOGRAM_CUSTOM_COUNTS( 171 UMA_HISTOGRAM_CUSTOM_COUNTS(
167 "Event.PassiveListeners.ForcedNonBlockingLatencyDueToFling", 172 "Event.PassiveListeners.ForcedNonBlockingLatencyDueToFling",
168 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100); 173 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100);
174 } else if (
175 enum_value ==
176 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPONS IVENESS) {
177 base::TimeTicks now = base::TimeTicks::Now();
178 UMA_HISTOGRAM_CUSTOM_COUNTS(
179 "Event.PassiveListeners."
180 "ForcedNonBlockingLatencyDueToUnresponsiveMainThread",
181 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100);
Ilya Sherman 2016/12/16 00:46:02 How valuable is it to have 100 buckets for these h
tdresser 2016/12/16 13:32:43 Reduced to 50 buckets. At some point I'll need to
169 } 182 }
170 } 183 }
171 } 184 }
172 185
173 } // namespace 186 } // namespace
174 187
175 RenderWidgetInputHandler::RenderWidgetInputHandler( 188 RenderWidgetInputHandler::RenderWidgetInputHandler(
176 RenderWidgetInputHandlerDelegate* delegate, 189 RenderWidgetInputHandlerDelegate* delegate,
177 RenderWidget* widget) 190 RenderWidget* widget)
178 : delegate_(delegate), 191 : delegate_(delegate),
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 // it can be bundled in the event ack. 458 // it can be bundled in the event ack.
446 if (handling_event_overscroll_) { 459 if (handling_event_overscroll_) {
447 *handling_event_overscroll_ = std::move(params); 460 *handling_event_overscroll_ = std::move(params);
448 return; 461 return;
449 } 462 }
450 463
451 delegate_->OnDidOverscroll(*params); 464 delegate_->OnDidOverscroll(*params);
452 } 465 }
453 466
454 } // namespace content 467 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698