Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_impl.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc |
| index 7cd8d8dd8b15f052b8997656a346a248f1a51e5d..1daed380a6d3f64f90539a7ba7df72c0198c4d1b 100644 |
| --- a/content/browser/renderer_host/render_widget_host_impl.cc |
| +++ b/content/browser/renderer_host/render_widget_host_impl.cc |
| @@ -1143,10 +1143,16 @@ void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( |
| NULL)) |
| latency_info = NewInputLatencyInfo(); |
| - latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_INJECTED_RWH_COMPONENT, |
| - GetLatencyComponentId(), |
| - ++last_input_number_); |
| - latency_info.MergeWith(ui_latency); |
| + WebKit::WebInputEvent::Type type = gesture_event.type; |
| + if (type == WebKit::WebInputEvent::GestureScrollBegin || |
| + type == WebKit::WebInputEvent::GestureScrollUpdate || |
| + type == WebKit::WebInputEvent::GestureScrollUpdateWithoutPropagation) { |
| + latency_info.AddLatencyNumber( |
| + ui::INPUT_EVENT_LATENCY_INJECTED_RWH_COMPONENT, |
| + GetLatencyComponentId(), |
| + ++last_input_number_); |
| + latency_info.MergeWith(ui_latency); |
|
Rick Byers
2013/07/10 01:36:30
Why do we need two different LatencyInfo objects h
Yufeng Shen (Slow to review)
2013/07/10 15:12:04
right. it is just that it happens to be coded this
Rick Byers
2013/07/10 15:31:35
Ok, I see. But now that you're only conditionally
|
| + } |
| if (!IsInOverscrollGesture() && |
| !gesture_event_filter_->ShouldForward( |
| @@ -2654,16 +2660,40 @@ void RenderWidgetHostImpl::ComputeTouchLatency( |
| } |
| void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { |
| - ui::LatencyInfo::LatencyMap::const_iterator l = |
| - latency_info.latency_components.find(std::make_pair( |
| - ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, GetLatencyComponentId())); |
| - if (l == latency_info.latency_components.end()) |
| + ui::LatencyInfo::LatencyComponent rwh_component; |
| + if (!latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, |
| + GetLatencyComponentId(), |
| + &rwh_component)) |
| return; |
| - rendering_stats_.input_event_count += l->second.event_count; |
| + rendering_stats_.input_event_count += rwh_component.event_count; |
| rendering_stats_.total_input_latency += |
| - l->second.event_count * |
| - (latency_info.swap_timestamp - l->second.event_time); |
| + rwh_component.event_count * |
| + (latency_info.swap_timestamp - rwh_component.event_time); |
| + |
| + ui::LatencyInfo::LatencyComponent original_component; |
| + if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
| + 0, |
| + &original_component) && |
| + latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_INJECTED_RWH_COMPONENT, |
| + GetLatencyComponentId(), |
| + NULL)) { |
| + // This UMA metric tracks the time from when the original touch event is |
| + // created (averaged if there are multiple) to when the scroll gesture |
| + // results in final frame swap. |
| + base::TimeDelta delta = |
| + latency_info.swap_timestamp - original_component.event_time; |
| + UMA_HISTOGRAM_CUSTOM_COUNTS( |
| + "Event.Latency.Browser.TouchToScroll", |
| + delta.InMicroseconds(), |
| + 0, |
| + 1000000, |
| + 100); |
| + rendering_stats_.scroll_event_count += original_component.event_count; |
| + rendering_stats_.total_scroll_latency += |
| + original_component.event_count * |
| + (latency_info.swap_timestamp - original_component.event_time); |
| + } |
| if (CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kEnableGpuBenchmarking)) |