diff options
author | miletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-11 03:32:38 +0000 |
---|---|---|
committer | miletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-11 03:32:38 +0000 |
commit | 70a03cc2c0b9debfc491412e9eeafe85e42ff758 (patch) | |
tree | 9f027b71392aae235550b72d30ac624e9f8104dd /content | |
parent | efd37ff98539ec2e13e45cf72f7688629af66cc0 (diff) | |
download | chromium_src-70a03cc2c0b9debfc491412e9eeafe85e42ff758.zip chromium_src-70a03cc2c0b9debfc491412e9eeafe85e42ff758.tar.gz chromium_src-70a03cc2c0b9debfc491412e9eeafe85e42ff758.tar.bz2 |
Report LatencyInfo through trace buffer
This CL is the first step in converting to use trace event to
collect LatencyInfo. Changes are:
1. Each LatencyInfo will have at most one BEGIN/TERMINATED component.
When the BEGIN component is added, an ASYNC_BEGIN trace event is issued.
When the TERMINATED component is added, an ASYNC_END trace event is issued,
and the LatencyInfo is dumped into the trace buffer.
2. BEGIN component is added to event's LatencyInfo when the event reaches RWH.
3. If events cause renderering to be schedueld in renderer, then the
INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT
is added when actual frame swap happens. Accordingly, swap_timestamp_ is
removed.
4. If events do not cause rendering to be scheduled in renderer, then
4.1) INPUT_EVENT_LATENCY_TERMINATED_MOUSE/GESTURE_COMPONENT
is added when the mouse/gesture events are acked from renderer.
4.2) If the acked touch event become gesture event, touch event's
LatencInfo are copied into gesture event's LatencyInfo.
4.3) If the acked touch event does not become gesture event,
INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT
is then added to the touch event's LatencyInfo.
This CL is only adding the ability to dump LatencyInfo to trace buffer but don't
change the current way LatencyInfo is used so all the telemetry tests are not
affected. The complete migration will be in followup CLs.
BUG=BUG=246034
TEST=1. telemetry smoothness test still works.
2. Do trace recording with category "benchmark", check that latencyinfo are
dumped to "InputLatency";
Review URL: https://codereview.chromium.org/25022003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
19 files changed, 110 insertions, 69 deletions
diff --git a/content/browser/aura/software_browser_compositor_output_surface.cc b/content/browser/aura/software_browser_compositor_output_surface.cc index 1f92582..f196c63 100644 --- a/content/browser/aura/software_browser_compositor_output_surface.cc +++ b/content/browser/aura/software_browser_compositor_output_surface.cc @@ -19,7 +19,8 @@ SoftwareBrowserCompositorOutputSurface::SoftwareBrowserCompositorOutputSurface( void SoftwareBrowserCompositorOutputSurface::SwapBuffers( cc::CompositorFrame* frame) { ui::LatencyInfo latency_info = frame->metadata.latency_info; - latency_info.swap_timestamp = base::TimeTicks::HighResNow(); + latency_info.AddLatencyNumber( + ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); } diff --git a/content/browser/renderer_host/compositing_iosurface_mac.mm b/content/browser/renderer_host/compositing_iosurface_mac.mm index a9ca707..07bd795 100644 --- a/content/browser/renderer_host/compositing_iosurface_mac.mm +++ b/content/browser/renderer_host/compositing_iosurface_mac.mm @@ -497,7 +497,8 @@ bool CompositingIOSurfaceMac::DrawIOSurface( } } - latency_info_.swap_timestamp = base::TimeTicks::HighResNow(); + latency_info_.AddLatencyNumber( + ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); RenderWidgetHostImpl::CompositorFrameDrawn(latency_info_); latency_info_.Clear(); diff --git a/content/browser/renderer_host/input/gesture_event_filter.cc b/content/browser/renderer_host/input/gesture_event_filter.cc index a3b15a7..8639043 100644 --- a/content/browser/renderer_host/input/gesture_event_filter.cc +++ b/content/browser/renderer_host/input/gesture_event_filter.cc @@ -251,7 +251,8 @@ bool GestureEventFilter::ShouldForwardForCoalescing( } void GestureEventFilter::ProcessGestureAck(InputEventAckState ack_result, - WebInputEvent::Type type) { + WebInputEvent::Type type, + const ui::LatencyInfo& latency) { if (IsGestureEventTypeAsync(type)) return; @@ -264,7 +265,9 @@ void GestureEventFilter::ProcessGestureAck(InputEventAckState ack_result, // Ack'ing an event may enqueue additional gesture events. By ack'ing the // event before the forwarding of queued events below, such additional events // can be coalesced with existing queued events prior to dispatch. - client_->OnGestureEventAck(GetGestureEventAwaitingAck(), ack_result); + GestureEventWithLatencyInfo event_with_latency = GetGestureEventAwaitingAck(); + event_with_latency.latency.AddNewLatencyFrom(latency); + client_->OnGestureEventAck(event_with_latency, ack_result); const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); if (type == WebInputEvent::GestureFlingCancel) { diff --git a/content/browser/renderer_host/input/gesture_event_filter.h b/content/browser/renderer_host/input/gesture_event_filter.h index 063260a..832dba0 100644 --- a/content/browser/renderer_host/input/gesture_event_filter.h +++ b/content/browser/renderer_host/input/gesture_event_filter.h @@ -74,7 +74,8 @@ class CONTENT_EXPORT GestureEventFilter { // with state |ack_result| and event |type|. May send events if the queue is // not empty. void ProcessGestureAck(InputEventAckState ack_result, - WebKit::WebInputEvent::Type type); + WebKit::WebInputEvent::Type type, + const ui::LatencyInfo& latency); // Sets the state of the |fling_in_progress_| field to indicate that a fling // is definitely not in progress. diff --git a/content/browser/renderer_host/input/gesture_event_filter_unittest.cc b/content/browser/renderer_host/input/gesture_event_filter_unittest.cc index 87a29d3..1c209ba 100644 --- a/content/browser/renderer_host/input/gesture_event_filter_unittest.cc +++ b/content/browser/renderer_host/input/gesture_event_filter_unittest.cc @@ -103,7 +103,7 @@ class GestureEventFilterTest : public testing::Test, void SendInputEventACK(WebInputEvent::Type type, InputEventAckState ack) { - filter()->ProcessGestureAck(ack, type); + filter()->ProcessGestureAck(ack, type, ui::LatencyInfo()); } void RunUntilIdle() { diff --git a/content/browser/renderer_host/input/immediate_input_router.cc b/content/browser/renderer_host/input/immediate_input_router.cc index b87cffc..dfc5187 100644 --- a/content/browser/renderer_host/input/immediate_input_router.cc +++ b/content/browser/renderer_host/input/immediate_input_router.cc @@ -311,7 +311,7 @@ void ImmediateInputRouter::OnTouchEventAck( void ImmediateInputRouter::OnGestureEventAck( const GestureEventWithLatencyInfo& event, InputEventAckState ack_result) { - ack_handler_->OnGestureEventAck(event.event, ack_result); + ack_handler_->OnGestureEventAck(event, ack_result); } bool ImmediateInputRouter::SendSelectRange(scoped_ptr<IPC::Message> message) { @@ -390,7 +390,8 @@ void ImmediateInputRouter::FilterAndSendWebInputEvent( // it is never sent to the renderer, and so it won't receive any ACKs. // So send the ACK to the gesture event filter immediately, and mark it // as having been processed. - ProcessGestureAck(input_event.type, INPUT_EVENT_ACK_STATE_CONSUMED); + ProcessGestureAck(input_event.type, INPUT_EVENT_ACK_STATE_CONSUMED, + latency_info); } else if (WebInputEvent::isTouchEventType(input_event.type)) { // During an overscroll gesture initiated by touch-scrolling, the // touch-events do not reset or contribute to the overscroll gesture. @@ -483,11 +484,11 @@ void ImmediateInputRouter::ProcessInputEventAck( } else if (WebInputEvent::isKeyboardEventType(type)) { ProcessKeyboardAck(event_type, ack_result); } else if (type == WebInputEvent::MouseWheel) { - ProcessWheelAck(ack_result); + ProcessWheelAck(ack_result, latency_info); } else if (WebInputEvent::isTouchEventType(type)) { ProcessTouchAck(ack_result, latency_info); } else if (WebInputEvent::isGestureEventType(type)) { - ProcessGestureAck(event_type, ack_result); + ProcessGestureAck(event_type, ack_result, latency_info); } // WARNING: |this| may be deleted at this point. @@ -526,13 +527,16 @@ void ImmediateInputRouter::ProcessKeyboardAck( } } -void ImmediateInputRouter::ProcessWheelAck(InputEventAckState ack_result) { - mouse_wheel_pending_ = false; - +void ImmediateInputRouter::ProcessWheelAck(InputEventAckState ack_result, + const ui::LatencyInfo& latency) { + // TODO(miletus): Add renderer side latency to each uncoalesced mouse + // wheel event and add terminal component to each of them. + current_wheel_event_.latency.AddNewLatencyFrom(latency); // Process the unhandled wheel event here before calling // ForwardWheelEventWithLatencyInfo() since it will mutate // current_wheel_event_. - ack_handler_->OnWheelEventAck(current_wheel_event_.event, ack_result); + ack_handler_->OnWheelEventAck(current_wheel_event_, ack_result); + mouse_wheel_pending_ = false; // Now send the next (coalesced) mouse wheel event. if (!coalesced_mouse_wheel_events_.empty()) { @@ -544,16 +548,17 @@ void ImmediateInputRouter::ProcessWheelAck(InputEventAckState ack_result) { } void ImmediateInputRouter::ProcessGestureAck(WebInputEvent::Type type, - InputEventAckState ack_result) { + InputEventAckState ack_result, + const ui::LatencyInfo& latency) { // |gesture_event_filter_| will forward to OnGestureEventAck when appropriate. - gesture_event_filter_->ProcessGestureAck(ack_result, type); + gesture_event_filter_->ProcessGestureAck(ack_result, type, latency); } void ImmediateInputRouter::ProcessTouchAck( InputEventAckState ack_result, - const ui::LatencyInfo& latency_info) { + const ui::LatencyInfo& latency) { // |touch_event_queue_| will forward to OnTouchEventAck when appropriate. - touch_event_queue_->ProcessTouchAck(ack_result, latency_info); + touch_event_queue_->ProcessTouchAck(ack_result, latency); } void ImmediateInputRouter::HandleGestureScroll( diff --git a/content/browser/renderer_host/input/immediate_input_router.h b/content/browser/renderer_host/input/immediate_input_router.h index 5a8546e..5f4f7fb 100644 --- a/content/browser/renderer_host/input/immediate_input_router.h +++ b/content/browser/renderer_host/input/immediate_input_router.h @@ -126,19 +126,21 @@ private: // Called by ProcessInputEventAck() to process a wheel event ack message. // This could result in a task being posted to allow additional wheel // input messages to be coalesced. - void ProcessWheelAck(InputEventAckState ack_result); + void ProcessWheelAck(InputEventAckState ack_result, + const ui::LatencyInfo& latency); // Called by ProcessInputEventAck() to process a gesture event ack message. // This validates the gesture for suppression of touchpad taps and sends one // previously queued coalesced gesture if it exists. void ProcessGestureAck(WebKit::WebInputEvent::Type, - InputEventAckState ack_result); + InputEventAckState ack_result, + const ui::LatencyInfo& latency); // Called on ProcessInputEventAck() to process a touch event ack message. // This can result in a gesture event being generated and sent back to the // renderer. void ProcessTouchAck(InputEventAckState ack_result, - const ui::LatencyInfo& latency_info); + const ui::LatencyInfo& latency); void HandleGestureScroll( const GestureEventWithLatencyInfo& gesture_event); diff --git a/content/browser/renderer_host/input/input_ack_handler.h b/content/browser/renderer_host/input/input_ack_handler.h index 3e09b07..7917bff 100644 --- a/content/browser/renderer_host/input/input_ack_handler.h +++ b/content/browser/renderer_host/input/input_ack_handler.h @@ -21,11 +21,11 @@ class CONTENT_EXPORT InputAckHandler { // Called upon event ack receipt from the renderer. virtual void OnKeyboardEventAck(const NativeWebKeyboardEvent& event, InputEventAckState ack_result) = 0; - virtual void OnWheelEventAck(const WebKit::WebMouseWheelEvent& event, + virtual void OnWheelEventAck(const MouseWheelEventWithLatencyInfo& event, InputEventAckState ack_result) = 0; virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, InputEventAckState ack_result) = 0; - virtual void OnGestureEventAck(const WebKit::WebGestureEvent& event, + virtual void OnGestureEventAck(const GestureEventWithLatencyInfo& event, InputEventAckState ack_result) = 0; enum UnexpectedEventAckType { diff --git a/content/browser/renderer_host/input/mock_input_ack_handler.cc b/content/browser/renderer_host/input/mock_input_ack_handler.cc index cda0005..2219b00 100644 --- a/content/browser/renderer_host/input/mock_input_ack_handler.cc +++ b/content/browser/renderer_host/input/mock_input_ack_handler.cc @@ -34,16 +34,16 @@ void MockInputAckHandler::OnKeyboardEventAck( } void MockInputAckHandler::OnWheelEventAck( - const WebMouseWheelEvent& event, - InputEventAckState ack_result) { + const MouseWheelEventWithLatencyInfo& event, + InputEventAckState ack_result) { VLOG(1) << __FUNCTION__ << " called!"; - acked_wheel_event_ = event; + acked_wheel_event_ = event.event; RecordAckCalled(ack_result); } void MockInputAckHandler::OnTouchEventAck( const TouchEventWithLatencyInfo& event, - InputEventAckState ack_result) { + InputEventAckState ack_result) { VLOG(1) << __FUNCTION__ << " called!"; acked_touch_event_ = event; RecordAckCalled(ack_result); @@ -54,10 +54,10 @@ void MockInputAckHandler::OnTouchEventAck( } void MockInputAckHandler::OnGestureEventAck( - const WebGestureEvent& event, - InputEventAckState ack_result) { + const GestureEventWithLatencyInfo& event, + InputEventAckState ack_result) { VLOG(1) << __FUNCTION__ << " called!"; - acked_gesture_event_ = event; + acked_gesture_event_ = event.event; RecordAckCalled(ack_result); } diff --git a/content/browser/renderer_host/input/mock_input_ack_handler.h b/content/browser/renderer_host/input/mock_input_ack_handler.h index 4a51f9d..890cde9 100644 --- a/content/browser/renderer_host/input/mock_input_ack_handler.h +++ b/content/browser/renderer_host/input/mock_input_ack_handler.h @@ -20,11 +20,11 @@ class MockInputAckHandler : public InputAckHandler { // InputAckHandler virtual void OnKeyboardEventAck(const NativeWebKeyboardEvent& event, InputEventAckState ack_result) OVERRIDE; - virtual void OnWheelEventAck(const WebKit::WebMouseWheelEvent& event, + virtual void OnWheelEventAck(const MouseWheelEventWithLatencyInfo& event, InputEventAckState ack_result) OVERRIDE; virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, InputEventAckState ack_result) OVERRIDE; - virtual void OnGestureEventAck(const WebKit::WebGestureEvent& event, + virtual void OnGestureEventAck(const GestureEventWithLatencyInfo& event, InputEventAckState ack_result) OVERRIDE; virtual void OnUnexpectedEventAck(UnexpectedEventAckType type) OVERRIDE; diff --git a/content/browser/renderer_host/input/touch_event_queue.cc b/content/browser/renderer_host/input/touch_event_queue.cc index 7447c7f..9620b50 100644 --- a/content/browser/renderer_host/input/touch_event_queue.cc +++ b/content/browser/renderer_host/input/touch_event_queue.cc @@ -71,11 +71,11 @@ class CoalescedWebTouchEvent { return coalesced_event_; } - WebTouchEventWithLatencyList::const_iterator begin() const { + WebTouchEventWithLatencyList::iterator begin() { return events_.begin(); } - WebTouchEventWithLatencyList::const_iterator end() const { + WebTouchEventWithLatencyList::iterator end() { return events_.end(); } @@ -243,14 +243,10 @@ void TouchEventQueue::PopTouchEventToClient( base::AutoReset<CoalescedWebTouchEvent*> dispatching_touch_ack(&dispatching_touch_ack_, acked_event.get()); - base::TimeTicks now = base::TimeTicks::HighResNow(); - for (WebTouchEventWithLatencyList::const_iterator iter = acked_event->begin(), + for (WebTouchEventWithLatencyList::iterator iter = acked_event->begin(), end = acked_event->end(); iter != end; ++iter) { - ui::LatencyInfo* latency = const_cast<ui::LatencyInfo*>(&(iter->latency)); - latency->AddNewLatencyFrom(renderer_latency_info); - latency->AddLatencyNumberWithTimestamp( - ui::INPUT_EVENT_LATENCY_ACKED_COMPONENT, 0, 0, now, 1); + iter->latency.AddNewLatencyFrom(renderer_latency_info); client_->OnTouchEventAck((*iter), ack_result); } } diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index c0a44a2..ae4c609 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -1120,7 +1120,8 @@ void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( GetLatencyComponentId(), original_component.sequence_number, original_component.event_time, - original_component.event_count); + original_component.event_count, + true); } } @@ -1164,10 +1165,10 @@ ui::LatencyInfo RenderWidgetHostImpl::CreateRWHLatencyInfoIfNotExist( info = *original; // In Aura, gesture event will already carry its original touch event's // INPUT_EVENT_LATENCY_RWH_COMPONENT. - if (!info.FindLatency(ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, + if (!info.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, GetLatencyComponentId(), NULL)) { - info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, + info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, GetLatencyComponentId(), ++last_input_number_); } @@ -2187,33 +2188,53 @@ void RenderWidgetHostImpl::OnKeyboardEventAck( } void RenderWidgetHostImpl::OnWheelEventAck( - const WebKit::WebMouseWheelEvent& wheel_event, + const MouseWheelEventWithLatencyInfo& wheel_event, InputEventAckState ack_result) { + if (!wheel_event.latency.FindLatency( + ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { + // MouseWheelEvent latency ends when it is acked but does not cause any + // rendering scheduled. + ui::LatencyInfo latency = wheel_event.latency; + latency.AddLatencyNumber( + ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0); + } const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); if (overscroll_controller_) - overscroll_controller_->ReceivedEventACK(wheel_event, processed); - + overscroll_controller_->ReceivedEventACK(wheel_event.event, processed); if (!processed && !is_hidden() && view_) - view_->UnhandledWheelEvent(wheel_event); + view_->UnhandledWheelEvent(wheel_event.event); } void RenderWidgetHostImpl::OnGestureEventAck( - const WebKit::WebGestureEvent& event, + const GestureEventWithLatencyInfo& event, InputEventAckState ack_result) { + if (!event.latency.FindLatency( + ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { + // GestureEvent latency ends when it is acked but does not cause any + // rendering scheduled. + ui::LatencyInfo latency = event.latency; + latency.AddLatencyNumber( + ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0 ,0); + } const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); if (overscroll_controller_) - overscroll_controller_->ReceivedEventACK(event, processed); + overscroll_controller_->ReceivedEventACK(event.event, processed); if (view_) - view_->GestureEventAck(event.type, ack_result); + view_->GestureEventAck(event.event.type, ack_result); } void RenderWidgetHostImpl::OnTouchEventAck( const TouchEventWithLatencyInfo& event, InputEventAckState ack_result) { - ComputeTouchLatency(event.latency); + TouchEventWithLatencyInfo touch_event = event; + // TouchEvent latency does not end when acked since it could later on + // become gesture events. + touch_event.latency.AddLatencyNumber( + ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, 0); + ComputeTouchLatency(touch_event.latency); if (view_) - view_->ProcessAckedTouchEvent(event, ack_result); + view_->ProcessAckedTouchEvent(touch_event, ack_result); } void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { @@ -2484,7 +2505,7 @@ void RenderWidgetHostImpl::ComputeTouchLatency( if (!latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &ui_component) || - !latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, + !latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, GetLatencyComponentId(), &rwh_component)) return; @@ -2503,7 +2524,7 @@ void RenderWidgetHostImpl::ComputeTouchLatency( 20000, 100); - if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ACKED_COMPONENT, + if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, &acked_component)) { DCHECK(acked_component.event_count == 1); @@ -2526,15 +2547,20 @@ void RenderWidgetHostImpl::ComputeTouchLatency( void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { ui::LatencyInfo::LatencyComponent rwh_component; - if (!latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, + ui::LatencyInfo::LatencyComponent swap_component; + if (!latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, GetLatencyComponentId(), - &rwh_component)) + &rwh_component) || + !latency_info.FindLatency( + ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, + 0, &swap_component)) { return; + } rendering_stats_.input_event_count += rwh_component.event_count; rendering_stats_.total_input_latency += rwh_component.event_count * - (latency_info.swap_timestamp - rwh_component.event_time); + (swap_component.event_time - rwh_component.event_time); ui::LatencyInfo::LatencyComponent original_component; if (latency_info.FindLatency( @@ -2545,7 +2571,7 @@ void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { // 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; + swap_component.event_time - original_component.event_time; for (size_t i = 0; i < original_component.event_count; i++) { UMA_HISTOGRAM_CUSTOM_COUNTS( "Event.Latency.TouchToScrollUpdateSwap", @@ -2557,7 +2583,7 @@ void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { rendering_stats_.scroll_update_count += original_component.event_count; rendering_stats_.total_scroll_update_latency += original_component.event_count * - (latency_info.swap_timestamp - original_component.event_time); + (swap_component.event_time - original_component.event_time); } if (CommandLine::ForCurrentProcess()->HasSwitch( @@ -2576,7 +2602,7 @@ void RenderWidgetHostImpl::CompositorFrameDrawn( latency_info.latency_components.begin(); b != latency_info.latency_components.end(); ++b) { - if (b->first.first != ui::INPUT_EVENT_LATENCY_RWH_COMPONENT) + if (b->first.first != ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT) continue; // Matches with GetLatencyComponentId int routing_id = b->first.second & 0xffffffff; diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 3db49c1..820f5e0 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -750,11 +750,11 @@ class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, // InputAckHandler virtual void OnKeyboardEventAck(const NativeWebKeyboardEvent& event, InputEventAckState ack_result) OVERRIDE; - virtual void OnWheelEventAck(const WebKit::WebMouseWheelEvent& event, + virtual void OnWheelEventAck(const MouseWheelEventWithLatencyInfo& event, InputEventAckState ack_result) OVERRIDE; virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, InputEventAckState ack_result) OVERRIDE; - virtual void OnGestureEventAck(const WebKit::WebGestureEvent& event, + virtual void OnGestureEventAck(const GestureEventWithLatencyInfo& event, InputEventAckState ack_result) OVERRIDE; virtual void OnUnexpectedEventAck(UnexpectedEventAckType type) OVERRIDE; diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.cc b/content/browser/renderer_host/render_widget_host_view_gtk.cc index 9c05bca..da01a1c 100644 --- a/content/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/content/browser/renderer_host/render_widget_host_view_gtk.cc @@ -1209,7 +1209,8 @@ void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) { // recorded. web_contents_switch_paint_time_ = base::TimeTicks(); } - software_latency_info_.swap_timestamp = base::TimeTicks::HighResNow(); + software_latency_info_.AddLatencyNumber( + ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); render_widget_host->FrameSwapped(software_latency_info_); software_latency_info_.Clear(); } else { diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 0405175..da0c88b 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -1902,7 +1902,8 @@ gfx::Rect RenderWidgetHostViewMac::GetScaledOpenGLPixelRect( } void RenderWidgetHostViewMac::FrameSwapped() { - software_latency_info_.swap_timestamp = base::TimeTicks::HighResNow(); + software_latency_info_.AddLatencyNumber( + ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); render_widget_host_->FrameSwapped(software_latency_info_); software_latency_info_.Clear(); } diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc index d8b04e4..886d5ca 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.cc +++ b/content/browser/renderer_host/render_widget_host_view_win.cc @@ -1396,7 +1396,8 @@ void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { web_contents_switch_paint_time_ = TimeTicks(); } - software_latency_info_.swap_timestamp = TimeTicks::HighResNow(); + software_latency_info_.AddLatencyNumber( + ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); render_widget_host_->FrameSwapped(software_latency_info_); software_latency_info_.Clear(); } else { diff --git a/content/common/content_param_traits_macros.h b/content/common/content_param_traits_macros.h index ef56f26..e422a18 100644 --- a/content/common/content_param_traits_macros.h +++ b/content/common/content_param_traits_macros.h @@ -29,7 +29,8 @@ IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(ui::LatencyInfo) IPC_STRUCT_TRAITS_MEMBER(latency_components) - IPC_STRUCT_TRAITS_MEMBER(swap_timestamp) + IPC_STRUCT_TRAITS_MEMBER(trace_id) + IPC_STRUCT_TRAITS_MEMBER(terminated) IPC_STRUCT_TRAITS_END() #endif // CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc index d1cb0a8..e0d23ae 100644 --- a/content/common/gpu/image_transport_surface.cc +++ b/content/common/gpu/image_transport_surface.cc @@ -251,7 +251,8 @@ bool PassThroughImageTransportSurface::SwapBuffers() { // crbug.com/223558. SendVSyncUpdateIfAvailable(); bool result = gfx::GLSurfaceAdapter::SwapBuffers(); - latency_info_.swap_timestamp = base::TimeTicks::HighResNow(); + latency_info_.AddLatencyNumber( + ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); if (transport_) { DCHECK(!is_swap_buffers_pending_); @@ -274,7 +275,8 @@ bool PassThroughImageTransportSurface::PostSubBuffer( int x, int y, int width, int height) { SendVSyncUpdateIfAvailable(); bool result = gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height); - latency_info_.swap_timestamp = base::TimeTicks::HighResNow(); + latency_info_.AddLatencyNumber( + ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); if (transport_) { DCHECK(!is_swap_buffers_pending_); diff --git a/content/common/input/input_param_traits_unittest.cc b/content/common/input/input_param_traits_unittest.cc index 421250a..83eb236 100644 --- a/content/common/input/input_param_traits_unittest.cc +++ b/content/common/input/input_param_traits_unittest.cc @@ -82,7 +82,7 @@ TEST_F(InputParamTraitsTest, InitializedEvents) { WebKit::WebMouseWheelEvent wheel_event; wheel_event.type = WebKit::WebInputEvent::MouseWheel; wheel_event.deltaX = 10; - latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_RWH_COMPONENT, 1, 1); + latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1, 1); events.push_back(new InputEvent(wheel_event, latency, false)); WebKit::WebMouseEvent mouse_event; |