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

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: Fix build. Created 4 years, 1 month 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 WebInputEvent::DispatchType dispatch_type, 116 WebInputEvent::DispatchType dispatch_type,
117 double event_timestamp, 117 double event_timestamp,
118 const ui::LatencyInfo& latency_info) { 118 const ui::LatencyInfo& latency_info) {
119 enum { 119 enum {
120 PASSIVE_LISTENER_UMA_ENUM_PASSIVE, 120 PASSIVE_LISTENER_UMA_ENUM_PASSIVE,
121 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE, 121 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE,
122 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED, 122 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED,
123 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE, 123 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE,
124 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, 124 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED,
125 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING, 125 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING,
126 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPONSIVEN ESS,
126 PASSIVE_LISTENER_UMA_ENUM_COUNT 127 PASSIVE_LISTENER_UMA_ENUM_COUNT
127 }; 128 };
128 129
129 int enum_value; 130 int enum_value;
130 switch (dispatch_type) { 131 switch (dispatch_type) {
131 case WebInputEvent::ListenersForcedNonBlockingDueToFling: 132 case WebInputEvent::ListenersForcedNonBlockingDueToFling:
132 enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING; 133 enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING;
133 break; 134 break;
135 case WebInputEvent::ListenersForcedNonBlockingDueToMainThreadResponsiveness:
136 enum_value =
137 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPO NSIVENESS;
138 break;
134 case WebInputEvent::ListenersNonBlockingPassive: 139 case WebInputEvent::ListenersNonBlockingPassive:
135 enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE; 140 enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE;
136 break; 141 break;
137 case WebInputEvent::EventNonBlocking: 142 case WebInputEvent::EventNonBlocking:
138 enum_value = PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE; 143 enum_value = PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE;
139 break; 144 break;
140 case WebInputEvent::Blocking: 145 case WebInputEvent::Blocking:
141 if (result == WebInputEventResult::HandledApplication) 146 if (result == WebInputEventResult::HandledApplication)
142 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED; 147 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED;
143 else if (result == WebInputEventResult::HandledSuppressed) 148 else if (result == WebInputEventResult::HandledSuppressed)
(...skipping 14 matching lines...) Expand all
158 base::TimeTicks now = base::TimeTicks::Now(); 163 base::TimeTicks now = base::TimeTicks::Now();
159 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency", 164 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency",
160 GetEventLatencyMicros(event_timestamp, now), 165 GetEventLatencyMicros(event_timestamp, now),
161 1, 10000000, 100); 166 1, 10000000, 100);
162 } else if (enum_value == 167 } else if (enum_value ==
163 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING) { 168 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING) {
164 base::TimeTicks now = base::TimeTicks::Now(); 169 base::TimeTicks now = base::TimeTicks::Now();
165 UMA_HISTOGRAM_CUSTOM_COUNTS( 170 UMA_HISTOGRAM_CUSTOM_COUNTS(
166 "Event.PassiveListeners.ForcedNonBlockingLatencyDueToFling", 171 "Event.PassiveListeners.ForcedNonBlockingLatencyDueToFling",
167 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100); 172 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100);
173 } else if (
174 enum_value ==
175 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPONS IVENESS) {
176 base::TimeTicks now = base::TimeTicks::Now();
177 UMA_HISTOGRAM_CUSTOM_COUNTS(
178 "Event.PassiveListeners."
179 "ForcedNonBlockingLatencyDueToUnresponsiveMainThread",
180 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100);
168 } 181 }
169 } 182 }
170 } 183 }
171 184
172 } // namespace 185 } // namespace
173 186
174 RenderWidgetInputHandler::RenderWidgetInputHandler( 187 RenderWidgetInputHandler::RenderWidgetInputHandler(
175 RenderWidgetInputHandlerDelegate* delegate, 188 RenderWidgetInputHandlerDelegate* delegate,
176 RenderWidget* widget) 189 RenderWidget* widget)
177 : delegate_(delegate), 190 : delegate_(delegate),
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 // it can be bundled in the event ack. 482 // it can be bundled in the event ack.
470 if (handling_event_overscroll_) { 483 if (handling_event_overscroll_) {
471 *handling_event_overscroll_ = std::move(params); 484 *handling_event_overscroll_ = std::move(params);
472 return; 485 return;
473 } 486 }
474 487
475 delegate_->OnDidOverscroll(*params); 488 delegate_->OnDidOverscroll(*params);
476 } 489 }
477 490
478 } // namespace content 491 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698