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

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: 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 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 WebInputEvent::DispatchType dispatch_type, 122 WebInputEvent::DispatchType dispatch_type,
123 double event_timestamp, 123 double event_timestamp,
124 const ui::LatencyInfo& latency_info) { 124 const ui::LatencyInfo& latency_info) {
125 enum { 125 enum {
126 PASSIVE_LISTENER_UMA_ENUM_PASSIVE, 126 PASSIVE_LISTENER_UMA_ENUM_PASSIVE,
127 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE, 127 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE,
128 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED, 128 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED,
129 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE, 129 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE,
130 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, 130 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED,
131 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING, 131 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING,
132 // TODO - add UMAs.
dtapuska 2016/08/23 16:18:29 Is this TODO still necessary?
tdresser 2016/08/23 17:25:33 Done.
133 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPONSIVEN ESS,
132 PASSIVE_LISTENER_UMA_ENUM_COUNT 134 PASSIVE_LISTENER_UMA_ENUM_COUNT
133 }; 135 };
134 136
135 int enum_value; 137 int enum_value;
136 switch (dispatch_type) { 138 switch (dispatch_type) {
137 case WebInputEvent::ListenersForcedNonBlockingDueToFling: 139 case WebInputEvent::ListenersForcedNonBlockingDueToFling:
138 enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING; 140 enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING;
139 break; 141 break;
142 case WebInputEvent::ListenersForcedNonBlockingDueToMainThreadResponsiveness:
143 enum_value =
144 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPO NSIVENESS;
145 break;
140 case WebInputEvent::ListenersNonBlockingPassive: 146 case WebInputEvent::ListenersNonBlockingPassive:
141 enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE; 147 enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE;
142 break; 148 break;
143 case WebInputEvent::EventNonBlocking: 149 case WebInputEvent::EventNonBlocking:
144 enum_value = PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE; 150 enum_value = PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE;
145 break; 151 break;
146 case WebInputEvent::Blocking: 152 case WebInputEvent::Blocking:
147 if (result == WebInputEventResult::HandledApplication) 153 if (result == WebInputEventResult::HandledApplication)
148 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED; 154 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED;
149 else if (result == WebInputEventResult::HandledSuppressed) 155 else if (result == WebInputEventResult::HandledSuppressed)
(...skipping 14 matching lines...) Expand all
164 base::TimeTicks now = base::TimeTicks::Now(); 170 base::TimeTicks now = base::TimeTicks::Now();
165 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency", 171 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency",
166 GetEventLatencyMicros(event_timestamp, now), 172 GetEventLatencyMicros(event_timestamp, now),
167 1, 10000000, 100); 173 1, 10000000, 100);
168 } else if (enum_value == 174 } else if (enum_value ==
169 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING) { 175 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING) {
170 base::TimeTicks now = base::TimeTicks::Now(); 176 base::TimeTicks now = base::TimeTicks::Now();
171 UMA_HISTOGRAM_CUSTOM_COUNTS( 177 UMA_HISTOGRAM_CUSTOM_COUNTS(
172 "Event.PassiveListeners.ForcedNonBlockingLatencyDueToFling", 178 "Event.PassiveListeners.ForcedNonBlockingLatencyDueToFling",
173 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100); 179 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100);
180 } else if (
181 enum_value ==
182 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPONS IVENESS) {
183 base::TimeTicks now = base::TimeTicks::Now();
184 UMA_HISTOGRAM_CUSTOM_COUNTS(
185 "Event.PassiveListeners."
186 "ForcedNonBlockingLatencyDueToUnresponsiveMainThread",
187 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100);
174 } 188 }
175 } 189 }
176 } 190 }
177 191
178 } // namespace 192 } // namespace
179 193
180 RenderWidgetInputHandler::RenderWidgetInputHandler( 194 RenderWidgetInputHandler::RenderWidgetInputHandler(
181 RenderWidgetInputHandlerDelegate* delegate, 195 RenderWidgetInputHandlerDelegate* delegate,
182 RenderWidget* widget) 196 RenderWidget* widget)
183 : delegate_(delegate), 197 : delegate_(delegate),
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 if (pending_input_event_ack_) { 566 if (pending_input_event_ack_) {
553 TRACE_EVENT_ASYNC_END0("input", 567 TRACE_EVENT_ASYNC_END0("input",
554 "RenderWidgetInputHandler::ThrottledInputEventAck", 568 "RenderWidgetInputHandler::ThrottledInputEventAck",
555 pending_input_event_ack_.get()); 569 pending_input_event_ack_.get());
556 delegate_->OnInputEventAck(std::move(pending_input_event_ack_)); 570 delegate_->OnInputEventAck(std::move(pending_input_event_ack_));
557 } 571 }
558 total_input_handling_time_this_frame_ = base::TimeDelta(); 572 total_input_handling_time_this_frame_ = base::TimeDelta();
559 } 573 }
560 574
561 } // namespace content 575 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698