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 06aa4dd1a62230a234903d7d2d8f8b2aa1b2a322..45d8aaf2c466e0dc0fe100b91564e8157e64a033 100644 |
| --- a/content/browser/renderer_host/render_widget_host_impl.cc |
| +++ b/content/browser/renderer_host/render_widget_host_impl.cc |
| @@ -1498,6 +1498,7 @@ void RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped( |
| gpu_params.size = params.size; |
| gpu_params.scale_factor = params.scale_factor; |
| gpu_params.latency_info = params.latency_info; |
| + FixMissingLatencyInfoComponentIds(gpu_params.latency_info); |
| view_->AcceleratedSurfaceBuffersSwapped(gpu_params, |
| params.gpu_process_host_id); |
| view_->DidReceiveRendererFrame(); |
| @@ -1513,6 +1514,9 @@ bool RenderWidgetHostImpl::OnSwapCompositorFrame( |
| uint32 output_surface_id = param.a; |
| param.b.AssignTo(frame.get()); |
| + for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) |
| + FixMissingLatencyInfoComponentIds(frame->metadata.latency_info[i]); |
| + |
| input_router_->OnViewUpdated( |
| GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); |
| @@ -1677,9 +1681,17 @@ void RenderWidgetHostImpl::DidUpdateBackingStore( |
| // Now paint the view. Watch out: it might be destroyed already. |
| if (view_ && !is_accelerated_compositing_active_) { |
| + |
| + std::vector<ui::LatencyInfo> latency_info; |
| + for (size_t i = 0; i < params.latency_info.size(); i++) { |
| + ui::LatencyInfo info = params.latency_info[i]; |
| + FixMissingLatencyInfoComponentIds(info); |
| + latency_info.push_back(info); |
| + } |
| + |
| view_being_painted_ = true; |
| view_->DidUpdateBackingStore(params.scroll_rect, params.scroll_delta, |
| - params.copy_rects, params.latency_info); |
| + params.copy_rects, latency_info); |
| view_->DidReceiveRendererFrame(); |
| view_being_painted_ = false; |
| } |
| @@ -2512,4 +2524,27 @@ void RenderWidgetHostImpl::CompositorFrameDrawn( |
| } |
| } |
| +void RenderWidgetHostImpl::FixMissingLatencyInfoComponentIds( |
| + ui::LatencyInfo& latency_info) { |
| + ui::LatencyInfo::LatencyMap::iterator lc = |
| + latency_info.latency_components.begin(); |
| + while (lc != latency_info.latency_components.end()) { |
| + ui::LatencyComponentType component_type = lc->first.first; |
| + if (component_type == ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT) { |
| + // If the component's ID is 0, patch it with the correct value. |
| + if (lc->first.second == 0) { |
|
jam
2014/01/17 01:27:27
i think we should always set it if it's coming fro
|
| + // Generate a new component entry |
| + ui::LatencyInfo::LatencyMap::key_type key = |
| + std::make_pair(component_type, GetLatencyComponentId()); |
| + latency_info.latency_components[key] = lc->second; |
| + |
| + // Remove the old entry |
| + latency_info.latency_components.erase(lc++); |
| + continue; |
| + } |
| + } |
| + ++lc; |
| + } |
| +} |
| + |
| } // namespace content |