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 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 // This trace event is used in | 1464 // This trace event is used in |
1465 // chrome/browser/extensions/api/cast_streaming/performance_test.cc | 1465 // chrome/browser/extensions/api/cast_streaming/performance_test.cc |
1466 UNSHIPPED_TRACE_EVENT0("test_fps", | 1466 UNSHIPPED_TRACE_EVENT0("test_fps", |
1467 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); | 1467 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); |
1468 ViewHostMsg_SwapCompositorFrame::Param param; | 1468 ViewHostMsg_SwapCompositorFrame::Param param; |
1469 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1469 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
1470 return false; | 1470 return false; |
1471 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 1471 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
1472 uint32 output_surface_id = param.a; | 1472 uint32 output_surface_id = param.a; |
1473 param.b.AssignTo(frame.get()); | 1473 param.b.AssignTo(frame.get()); |
| 1474 std::vector<IPC::Message> messages_to_deliver_with_frame; |
| 1475 messages_to_deliver_with_frame.swap(param.c); |
1474 | 1476 |
1475 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) | 1477 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) |
1476 AddLatencyInfoComponentIds(&frame->metadata.latency_info[i]); | 1478 AddLatencyInfoComponentIds(&frame->metadata.latency_info[i]); |
1477 | 1479 |
1478 input_router_->OnViewUpdated( | 1480 input_router_->OnViewUpdated( |
1479 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); | 1481 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); |
1480 | 1482 |
1481 if (view_) { | 1483 if (view_) { |
1482 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); | 1484 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); |
1483 view_->DidReceiveRendererFrame(); | 1485 view_->DidReceiveRendererFrame(); |
1484 } else { | 1486 } else { |
1485 cc::CompositorFrameAck ack; | 1487 cc::CompositorFrameAck ack; |
1486 if (frame->gl_frame_data) { | 1488 if (frame->gl_frame_data) { |
1487 ack.gl_frame_data = frame->gl_frame_data.Pass(); | 1489 ack.gl_frame_data = frame->gl_frame_data.Pass(); |
1488 ack.gl_frame_data->sync_point = 0; | 1490 ack.gl_frame_data->sync_point = 0; |
1489 } else if (frame->delegated_frame_data) { | 1491 } else if (frame->delegated_frame_data) { |
1490 cc::TransferableResource::ReturnResources( | 1492 cc::TransferableResource::ReturnResources( |
1491 frame->delegated_frame_data->resource_list, | 1493 frame->delegated_frame_data->resource_list, |
1492 &ack.resources); | 1494 &ack.resources); |
1493 } else if (frame->software_frame_data) { | 1495 } else if (frame->software_frame_data) { |
1494 ack.last_software_frame_id = frame->software_frame_data->id; | 1496 ack.last_software_frame_id = frame->software_frame_data->id; |
1495 } | 1497 } |
1496 SendSwapCompositorFrameAck(routing_id_, output_surface_id, | 1498 SendSwapCompositorFrameAck(routing_id_, output_surface_id, |
1497 process_->GetID(), ack); | 1499 process_->GetID(), ack); |
1498 } | 1500 } |
| 1501 |
| 1502 RenderProcessHost* rph = GetProcess(); |
| 1503 for (std::vector<IPC::Message>::const_iterator i = |
| 1504 messages_to_deliver_with_frame.begin(); |
| 1505 i != messages_to_deliver_with_frame.end(); |
| 1506 ++i) { |
| 1507 rph->OnMessageReceived(*i); |
| 1508 } |
| 1509 messages_to_deliver_with_frame.clear(); |
| 1510 |
1499 return true; | 1511 return true; |
1500 } | 1512 } |
1501 | 1513 |
1502 void RenderWidgetHostImpl::OnFlingingStopped() { | 1514 void RenderWidgetHostImpl::OnFlingingStopped() { |
1503 if (view_) | 1515 if (view_) |
1504 view_->DidStopFlinging(); | 1516 view_->DidStopFlinging(); |
1505 } | 1517 } |
1506 | 1518 |
1507 void RenderWidgetHostImpl::OnUpdateRect( | 1519 void RenderWidgetHostImpl::OnUpdateRect( |
1508 const ViewHostMsg_UpdateRect_Params& params) { | 1520 const ViewHostMsg_UpdateRect_Params& params) { |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2319 } | 2331 } |
2320 } | 2332 } |
2321 | 2333 |
2322 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { | 2334 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { |
2323 if (view_) | 2335 if (view_) |
2324 return view_->PreferredReadbackFormat(); | 2336 return view_->PreferredReadbackFormat(); |
2325 return SkBitmap::kARGB_8888_Config; | 2337 return SkBitmap::kARGB_8888_Config; |
2326 } | 2338 } |
2327 | 2339 |
2328 } // namespace content | 2340 } // namespace content |
OLD | NEW |