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

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: Address Dave's comments. 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 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPONSIVEN ESS,
132 PASSIVE_LISTENER_UMA_ENUM_COUNT 133 PASSIVE_LISTENER_UMA_ENUM_COUNT
133 }; 134 };
134 135
135 int enum_value; 136 int enum_value;
136 switch (dispatch_type) { 137 switch (dispatch_type) {
137 case WebInputEvent::ListenersForcedNonBlockingDueToFling: 138 case WebInputEvent::ListenersForcedNonBlockingDueToFling:
138 enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING; 139 enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING;
139 break; 140 break;
141 case WebInputEvent::ListenersForcedNonBlockingDueToMainThreadResponsiveness:
142 enum_value =
143 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPO NSIVENESS;
144 break;
140 case WebInputEvent::ListenersNonBlockingPassive: 145 case WebInputEvent::ListenersNonBlockingPassive:
141 enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE; 146 enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE;
142 break; 147 break;
143 case WebInputEvent::EventNonBlocking: 148 case WebInputEvent::EventNonBlocking:
144 enum_value = PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE; 149 enum_value = PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE;
145 break; 150 break;
146 case WebInputEvent::Blocking: 151 case WebInputEvent::Blocking:
147 if (result == WebInputEventResult::HandledApplication) 152 if (result == WebInputEventResult::HandledApplication)
148 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED; 153 enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED;
149 else if (result == WebInputEventResult::HandledSuppressed) 154 else if (result == WebInputEventResult::HandledSuppressed)
(...skipping 14 matching lines...) Expand all
164 base::TimeTicks now = base::TimeTicks::Now(); 169 base::TimeTicks now = base::TimeTicks::Now();
165 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency", 170 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency",
166 GetEventLatencyMicros(event_timestamp, now), 171 GetEventLatencyMicros(event_timestamp, now),
167 1, 10000000, 100); 172 1, 10000000, 100);
168 } else if (enum_value == 173 } else if (enum_value ==
169 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING) { 174 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING) {
170 base::TimeTicks now = base::TimeTicks::Now(); 175 base::TimeTicks now = base::TimeTicks::Now();
171 UMA_HISTOGRAM_CUSTOM_COUNTS( 176 UMA_HISTOGRAM_CUSTOM_COUNTS(
172 "Event.PassiveListeners.ForcedNonBlockingLatencyDueToFling", 177 "Event.PassiveListeners.ForcedNonBlockingLatencyDueToFling",
173 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100); 178 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100);
179 } else if (
180 enum_value ==
181 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPONS IVENESS) {
182 base::TimeTicks now = base::TimeTicks::Now();
183 UMA_HISTOGRAM_CUSTOM_COUNTS(
184 "Event.PassiveListeners."
185 "ForcedNonBlockingLatencyDueToUnresponsiveMainThread",
186 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100);
174 } 187 }
175 } 188 }
176 } 189 }
177 190
178 } // namespace 191 } // namespace
179 192
180 RenderWidgetInputHandler::RenderWidgetInputHandler( 193 RenderWidgetInputHandler::RenderWidgetInputHandler(
181 RenderWidgetInputHandlerDelegate* delegate, 194 RenderWidgetInputHandlerDelegate* delegate,
182 RenderWidget* widget) 195 RenderWidget* widget)
183 : delegate_(delegate), 196 : delegate_(delegate),
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 if (pending_input_event_ack_) { 565 if (pending_input_event_ack_) {
553 TRACE_EVENT_ASYNC_END0("input", 566 TRACE_EVENT_ASYNC_END0("input",
554 "RenderWidgetInputHandler::ThrottledInputEventAck", 567 "RenderWidgetInputHandler::ThrottledInputEventAck",
555 pending_input_event_ack_.get()); 568 pending_input_event_ack_.get());
556 delegate_->OnInputEventAck(std::move(pending_input_event_ack_)); 569 delegate_->OnInputEventAck(std::move(pending_input_event_ack_));
557 } 570 }
558 total_input_handling_time_this_frame_ = base::TimeDelta(); 571 total_input_handling_time_this_frame_ = base::TimeDelta();
559 } 572 }
560 573
561 } // namespace content 574 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698