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 f37ec19ffa63c05d5d0d9437495f846648e3396b..bbd154f13a40952fa4fe7e1d8784d1a1876bbbd2 100644 |
| --- a/content/browser/renderer_host/render_widget_host_impl.cc |
| +++ b/content/browser/renderer_host/render_widget_host_impl.cc |
| @@ -2565,6 +2565,53 @@ void RenderWidgetHostImpl::DetachDelegate() { |
| delegate_ = NULL; |
| } |
| +void RenderWidgetHostImpl::ComputeTouchLatency( |
| + const ui::LatencyInfo& latency_info) { |
| + ui::LatencyInfo::LatencyComponent ui_component; |
| + ui::LatencyInfo::LatencyComponent rwh_component; |
| + ui::LatencyInfo::LatencyComponent acked_component; |
| + |
| + if (!latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, |
| + 0, |
| + &ui_component) || |
| + !latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, |
| + GetLatencyComponentId(), |
| + &rwh_component)) |
| + return; |
| + |
| + DCHECK(ui_component.event_count == 1); |
| + DCHECK(rwh_component.event_count == 1); |
| + |
| + base::TimeDelta ui_delta = |
| + rwh_component.event_time - ui_component.event_time; |
| + rendering_stats_.touch_ui_count++; |
| + rendering_stats_.total_touch_ui_latency += ui_delta; |
| + UMA_HISTOGRAM_CUSTOM_COUNTS( |
| + "Event.Latency.Browser.TouchUI", |
| + ui_delta.InMicroseconds(), |
| + 0, |
| + 20000, |
| + 100); |
| + |
| + latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ACKED_COMPONENT, |
|
sadrul
2013/06/27 17:44:01
Check return value of FindLatency
Yufeng Shen (Slow to review)
2013/06/27 19:01:03
Done.
|
| + 0, |
| + &acked_component); |
| + base::TimeDelta acked_delta = |
| + acked_component.event_time - rwh_component.event_time; |
| + rendering_stats_.touch_acked_count++; |
| + rendering_stats_.total_touch_acked_latency += acked_delta; |
| + UMA_HISTOGRAM_CUSTOM_COUNTS( |
| + "Event.Latency.Browser.TouchAcked", |
| + acked_delta.InMicroseconds(), |
| + 0, |
| + 1000000, |
| + 100); |
| + |
| + if (CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kEnableGpuBenchmarking)) |
| + Send(new ViewMsg_SetBrowserRenderingStats(routing_id_, rendering_stats_)); |
| +} |
| + |
| void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { |
| ui::LatencyInfo::LatencyMap::const_iterator l = |
| latency_info.latency_components.find(std::make_pair( |