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 630bf703cef26fbd458c980e16e0880e9fa3cd72..106b870e19bb0a7349beba06a60c1e5ff2ba23f4 100644 |
| --- a/content/browser/renderer_host/render_widget_host_impl.cc |
| +++ b/content/browser/renderer_host/render_widget_host_impl.cc |
| @@ -1114,8 +1114,9 @@ void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( |
| // In Aura, gesture event will carry its original touch event's |
| // INPUT_EVENT_LATENCY_RWH_COMPONENT. For non-aura platform, we add the |
| // INPUT_EVENT_LATENCY_RWH_COMPONENT right here. |
| - if (!ui_latency.HasLatencyComponent(ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, |
| - GetLatencyComponentId())) |
| + if (!ui_latency.FindLatency(ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, |
| + GetLatencyComponentId(), |
| + NULL)) |
| latency_info = NewInputLatencyInfo(); |
| latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_INJECTED_RWH_COMPONENT, |
| @@ -1296,8 +1297,9 @@ void RenderWidgetHostImpl::SendInputEvent(const WebInputEvent& input_event, |
| int event_size, |
| const ui::LatencyInfo& latency_info, |
| bool is_keyboard_shortcut) { |
| - DCHECK(latency_info.HasLatencyComponent(ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, |
| - GetLatencyComponentId())); |
| + DCHECK(latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, |
| + GetLatencyComponentId(), |
| + NULL)); |
| input_event_start_time_ = TimeTicks::Now(); |
| Send(new InputMsg_HandleInputEvent( |
| routing_id_, &input_event, latency_info, is_keyboard_shortcut)); |
| @@ -2584,6 +2586,55 @@ 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); |
| + |
| + if(!latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ACKED_COMPONENT, |
|
sadrul
2013/06/27 22:40:12
ifspace(
Yufeng Shen (Slow to review)
2013/06/27 23:44:07
Done.
|
| + 0, |
| + &acked_component)) |
| + return; |
|
sadrul
2013/06/27 22:40:12
Do you not want to send the IPC below in this case
Yufeng Shen (Slow to review)
2013/06/27 23:44:07
right, done.
|
| + DCHECK(acked_component.event_count == 1); |
| + 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_)); |
|
sadrul
2013/06/27 22:40:12
I don't know what this does. I will leave this par
|
| +} |
| + |
| void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { |
| ui::LatencyInfo::LatencyMap::const_iterator l = |
| latency_info.latency_components.find(std::make_pair( |