Index: content/renderer/input/input_handler_proxy.cc |
diff --git a/content/renderer/input/input_handler_proxy.cc b/content/renderer/input/input_handler_proxy.cc |
index 0d4b17320a1986903d7c6942d404731474f9c534..ce178ec13ec1a6ae1f416291df6f62d0cae9dfbf 100644 |
--- a/content/renderer/input/input_handler_proxy.cc |
+++ b/content/renderer/input/input_handler_proxy.cc |
@@ -115,11 +115,15 @@ WebGestureEvent ObtainGestureScrollBegin(const WebGestureEvent& event) { |
return scroll_begin_event; |
} |
-void SendScrollLatencyUma(const WebInputEvent& event, |
- const ui::LatencyInfo& latency_info) { |
+void ReportInputEventLatencyUma(const WebInputEvent& event, |
+ const ui::LatencyInfo& latency_info) { |
no sievers
2014/12/05 21:27:00
DCHECK(uma_latency_reporting_enabled_);
jdduke (slow)
2014/12/05 21:31:53
Hmm, this isn't a member function, though I could
no sievers
2014/12/05 21:33:52
Oops nevermind, no big deal.
|
if (!(event.type == WebInputEvent::GestureScrollBegin || |
- event.type == WebInputEvent::GestureScrollUpdate)) |
+ event.type == WebInputEvent::GestureScrollUpdate || |
+ event.type == WebInputEvent::GesturePinchBegin || |
+ event.type == WebInputEvent::GesturePinchUpdate || |
+ event.type == WebInputEvent::GestureFlingStart)) { |
return; |
+ } |
ui::LatencyInfo::LatencyMap::const_iterator it = |
latency_info.latency_components.find(std::make_pair( |
@@ -130,17 +134,42 @@ void SendScrollLatencyUma(const WebInputEvent& event, |
base::TimeDelta delta = base::TimeTicks::HighResNow() - it->second.event_time; |
for (size_t i = 0; i < it->second.event_count; ++i) { |
- UMA_HISTOGRAM_CUSTOM_COUNTS( |
- "Event.Latency.RendererImpl.GestureScroll2", |
- delta.InMicroseconds(), |
- 1, |
- 1000000, |
- 100); |
+ switch (event.type) { |
+ case blink::WebInputEvent::GestureScrollBegin: |
+ UMA_HISTOGRAM_CUSTOM_COUNTS( |
+ "Event.Latency.RendererImpl.GestureScrollBegin", |
+ delta.InMicroseconds(), 1, 1000000, 100); |
+ break; |
+ case blink::WebInputEvent::GestureScrollUpdate: |
+ UMA_HISTOGRAM_CUSTOM_COUNTS( |
+ // So named for historical reasons. |
+ "Event.Latency.RendererImpl.GestureScroll2", |
+ delta.InMicroseconds(), 1, 1000000, 100); |
+ break; |
+ case blink::WebInputEvent::GesturePinchBegin: |
+ UMA_HISTOGRAM_CUSTOM_COUNTS( |
+ "Event.Latency.RendererImpl.GesturePinchBegin", |
+ delta.InMicroseconds(), 1, 1000000, 100); |
+ break; |
+ case blink::WebInputEvent::GesturePinchUpdate: |
+ UMA_HISTOGRAM_CUSTOM_COUNTS( |
+ "Event.Latency.RendererImpl.GesturePinchUpdate", |
+ delta.InMicroseconds(), 1, 1000000, 100); |
+ break; |
+ case blink::WebInputEvent::GestureFlingStart: |
+ UMA_HISTOGRAM_CUSTOM_COUNTS( |
+ "Event.Latency.RendererImpl.GestureFlingStart", |
+ delta.InMicroseconds(), 1, 1000000, 100); |
+ break; |
+ default: |
+ NOTREACHED(); |
+ break; |
+ } |
} |
-} // namespace |
- |
} |
+} // namespace |
+ |
namespace content { |
InputHandlerProxy::InputHandlerProxy(cc::InputHandler* input_handler, |
@@ -156,7 +185,9 @@ InputHandlerProxy::InputHandlerProxy(cc::InputHandler* input_handler, |
fling_may_be_active_on_main_thread_(false), |
disallow_horizontal_fling_scroll_(false), |
disallow_vertical_fling_scroll_(false), |
- has_fling_animation_started_(false) { |
+ has_fling_animation_started_(false), |
+ uma_latency_reporting_enabled_( |
+ base::TimeTicks::IsHighResNowFastAndReliable()) { |
DCHECK(client); |
input_handler_->BindToClient(this); |
smooth_scroll_enabled_ = CommandLine::ForCurrentProcess()->HasSwitch( |
@@ -185,7 +216,8 @@ InputHandlerProxy::HandleInputEventWithLatencyInfo( |
ui::LatencyInfo* latency_info) { |
DCHECK(input_handler_); |
- SendScrollLatencyUma(event, *latency_info); |
+ if (uma_latency_reporting_enabled_) |
+ ReportInputEventLatencyUma(event, *latency_info); |
TRACE_EVENT_FLOW_STEP0("input", |
"LatencyInfo.Flow", |