OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1459 void RenderWidgetHostImpl::OnPaintAtSizeAck(int tag, const gfx::Size& size) { | 1459 void RenderWidgetHostImpl::OnPaintAtSizeAck(int tag, const gfx::Size& size) { |
1460 std::pair<int, gfx::Size> details = std::make_pair(tag, size); | 1460 std::pair<int, gfx::Size> details = std::make_pair(tag, size); |
1461 NotificationService::current()->Notify( | 1461 NotificationService::current()->Notify( |
1462 NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, | 1462 NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, |
1463 Source<RenderWidgetHost>(this), | 1463 Source<RenderWidgetHost>(this), |
1464 Details<std::pair<int, gfx::Size> >(&details)); | 1464 Details<std::pair<int, gfx::Size> >(&details)); |
1465 } | 1465 } |
1466 | 1466 |
1467 #if defined(OS_MACOSX) | 1467 #if defined(OS_MACOSX) |
1468 void RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped( | 1468 void RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped( |
1469 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params) { | 1469 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params) { |
jln (very slow on Chromium)
2014/01/09 23:13:27
Could you add a check of latency_info.size() for s
Yufeng Shen (Slow to review)
2014/01/10 01:14:01
I noticed that ViewHostMsg_CompositorSurfaceBuffer
| |
1470 TRACE_EVENT0("renderer_host", | 1470 TRACE_EVENT0("renderer_host", |
1471 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); | 1471 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); |
1472 if (!view_) { | 1472 if (!view_) { |
1473 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1473 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
1474 ack_params.sync_point = 0; | 1474 ack_params.sync_point = 0; |
1475 RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, | 1475 RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, |
1476 params.gpu_process_host_id, | 1476 params.gpu_process_host_id, |
1477 ack_params); | 1477 ack_params); |
1478 return; | 1478 return; |
1479 } | 1479 } |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2443 return; | 2443 return; |
2444 } | 2444 } |
2445 } | 2445 } |
2446 | 2446 |
2447 Send(new ViewMsg_WindowSnapshotCompleted( | 2447 Send(new ViewMsg_WindowSnapshotCompleted( |
2448 GetRoutingID(), snapshot_id, gfx::Size(), png)); | 2448 GetRoutingID(), snapshot_id, gfx::Size(), png)); |
2449 } | 2449 } |
2450 | 2450 |
2451 // static | 2451 // static |
2452 void RenderWidgetHostImpl::CompositorFrameDrawn( | 2452 void RenderWidgetHostImpl::CompositorFrameDrawn( |
2453 const ui::LatencyInfo& latency_info) { | 2453 const std::vector<ui::LatencyInfo>& latency_info) { |
2454 std::set<RenderWidgetHostImpl*> rwhi_set; | 2454 for (size_t i = 0; i < latency_info.size(); i++) { |
2455 | 2455 std::set<RenderWidgetHostImpl*> rwhi_set; |
2456 for (ui::LatencyInfo::LatencyMap::const_iterator b = | 2456 for (ui::LatencyInfo::LatencyMap::const_iterator b = |
2457 latency_info.latency_components.begin(); | 2457 latency_info[i].latency_components.begin(); |
2458 b != latency_info.latency_components.end(); | 2458 b != latency_info[i].latency_components.end(); |
2459 ++b) { | 2459 ++b) { |
2460 if (b->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT || | 2460 if (b->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT || |
2461 b->first.first == ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT) { | 2461 b->first.first == ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT) { |
2462 // Matches with GetLatencyComponentId | 2462 // Matches with GetLatencyComponentId |
2463 int routing_id = b->first.second & 0xffffffff; | 2463 int routing_id = b->first.second & 0xffffffff; |
2464 int process_id = (b->first.second >> 32) & 0xffffffff; | 2464 int process_id = (b->first.second >> 32) & 0xffffffff; |
2465 RenderWidgetHost* rwh = | 2465 RenderWidgetHost* rwh = |
2466 RenderWidgetHost::FromID(process_id, routing_id); | 2466 RenderWidgetHost::FromID(process_id, routing_id); |
2467 if (!rwh) { | 2467 if (!rwh) { |
2468 continue; | 2468 continue; |
2469 } | |
2470 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); | |
2471 if (rwhi_set.insert(rwhi).second) | |
2472 rwhi->FrameSwapped(latency_info[i]); | |
2469 } | 2473 } |
2470 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); | |
2471 if (rwhi_set.insert(rwhi).second) | |
2472 rwhi->FrameSwapped(latency_info); | |
2473 } | 2474 } |
2474 } | 2475 } |
2475 } | 2476 } |
2476 | 2477 |
2477 } // namespace content | 2478 } // namespace content |
OLD | NEW |