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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 // This trace event is used in | 1394 // This trace event is used in |
1395 // chrome/browser/extensions/api/cast_streaming/performance_test.cc | 1395 // chrome/browser/extensions/api/cast_streaming/performance_test.cc |
1396 UNSHIPPED_TRACE_EVENT0("test_fps", | 1396 UNSHIPPED_TRACE_EVENT0("test_fps", |
1397 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); | 1397 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); |
1398 ViewHostMsg_SwapCompositorFrame::Param param; | 1398 ViewHostMsg_SwapCompositorFrame::Param param; |
1399 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1399 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
1400 return false; | 1400 return false; |
1401 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 1401 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
1402 uint32 output_surface_id = param.a; | 1402 uint32 output_surface_id = param.a; |
1403 param.b.AssignTo(frame.get()); | 1403 param.b.AssignTo(frame.get()); |
| 1404 std::vector<IPC::Message> messages_to_deliver_with_frame; |
| 1405 messages_to_deliver_with_frame.swap(param.c); |
1404 | 1406 |
1405 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) | 1407 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) |
1406 AddLatencyInfoComponentIds(&frame->metadata.latency_info[i]); | 1408 AddLatencyInfoComponentIds(&frame->metadata.latency_info[i]); |
1407 | 1409 |
1408 input_router_->OnViewUpdated( | 1410 input_router_->OnViewUpdated( |
1409 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); | 1411 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); |
1410 | 1412 |
1411 if (view_) { | 1413 if (view_) { |
1412 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); | 1414 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); |
1413 view_->DidReceiveRendererFrame(); | 1415 view_->DidReceiveRendererFrame(); |
1414 } else { | 1416 } else { |
1415 cc::CompositorFrameAck ack; | 1417 cc::CompositorFrameAck ack; |
1416 if (frame->gl_frame_data) { | 1418 if (frame->gl_frame_data) { |
1417 ack.gl_frame_data = frame->gl_frame_data.Pass(); | 1419 ack.gl_frame_data = frame->gl_frame_data.Pass(); |
1418 ack.gl_frame_data->sync_point = 0; | 1420 ack.gl_frame_data->sync_point = 0; |
1419 } else if (frame->delegated_frame_data) { | 1421 } else if (frame->delegated_frame_data) { |
1420 cc::TransferableResource::ReturnResources( | 1422 cc::TransferableResource::ReturnResources( |
1421 frame->delegated_frame_data->resource_list, | 1423 frame->delegated_frame_data->resource_list, |
1422 &ack.resources); | 1424 &ack.resources); |
1423 } else if (frame->software_frame_data) { | 1425 } else if (frame->software_frame_data) { |
1424 ack.last_software_frame_id = frame->software_frame_data->id; | 1426 ack.last_software_frame_id = frame->software_frame_data->id; |
1425 } | 1427 } |
1426 SendSwapCompositorFrameAck(routing_id_, output_surface_id, | 1428 SendSwapCompositorFrameAck(routing_id_, output_surface_id, |
1427 process_->GetID(), ack); | 1429 process_->GetID(), ack); |
1428 } | 1430 } |
| 1431 |
| 1432 RenderProcessHost* rph = GetProcess(); |
| 1433 for (std::vector<IPC::Message>::const_iterator i = |
| 1434 messages_to_deliver_with_frame.begin(); |
| 1435 i != messages_to_deliver_with_frame.end(); |
| 1436 ++i) { |
| 1437 rph->OnMessageReceived(*i); |
| 1438 if (i->dispatch_error()) |
| 1439 rph->OnBadMessageReceived(*i); |
| 1440 } |
| 1441 messages_to_deliver_with_frame.clear(); |
| 1442 |
1429 return true; | 1443 return true; |
1430 } | 1444 } |
1431 | 1445 |
1432 void RenderWidgetHostImpl::OnFlingingStopped() { | 1446 void RenderWidgetHostImpl::OnFlingingStopped() { |
1433 if (view_) | 1447 if (view_) |
1434 view_->DidStopFlinging(); | 1448 view_->DidStopFlinging(); |
1435 } | 1449 } |
1436 | 1450 |
1437 void RenderWidgetHostImpl::OnUpdateRect( | 1451 void RenderWidgetHostImpl::OnUpdateRect( |
1438 const ViewHostMsg_UpdateRect_Params& params) { | 1452 const ViewHostMsg_UpdateRect_Params& params) { |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 } | 2266 } |
2253 #endif | 2267 #endif |
2254 | 2268 |
2255 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2269 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2256 if (view_) | 2270 if (view_) |
2257 return view_->PreferredReadbackFormat(); | 2271 return view_->PreferredReadbackFormat(); |
2258 return kN32_SkColorType; | 2272 return kN32_SkColorType; |
2259 } | 2273 } |
2260 | 2274 |
2261 } // namespace content | 2275 } // namespace content |
OLD | NEW |