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 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1455 // This trace event is used in | 1455 // This trace event is used in |
1456 // chrome/browser/extensions/api/cast_streaming/performance_test.cc | 1456 // chrome/browser/extensions/api/cast_streaming/performance_test.cc |
1457 UNSHIPPED_TRACE_EVENT0("test_fps", | 1457 UNSHIPPED_TRACE_EVENT0("test_fps", |
1458 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); | 1458 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); |
1459 ViewHostMsg_SwapCompositorFrame::Param param; | 1459 ViewHostMsg_SwapCompositorFrame::Param param; |
1460 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1460 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
1461 return false; | 1461 return false; |
1462 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 1462 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
1463 uint32 output_surface_id = param.a; | 1463 uint32 output_surface_id = param.a; |
1464 param.b.AssignTo(frame.get()); | 1464 param.b.AssignTo(frame.get()); |
1465 std::vector<IPC::Message> messages_to_deliver_with_frame; | |
1466 messages_to_deliver_with_frame.swap(param.c); | |
1465 | 1467 |
1466 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) | 1468 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) |
1467 AddLatencyInfoComponentIds(&frame->metadata.latency_info[i]); | 1469 AddLatencyInfoComponentIds(&frame->metadata.latency_info[i]); |
1468 | 1470 |
1469 input_router_->OnViewUpdated( | 1471 input_router_->OnViewUpdated( |
1470 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); | 1472 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); |
1471 | 1473 |
1472 if (view_) { | 1474 if (view_) { |
1473 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); | 1475 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); |
1474 view_->DidReceiveRendererFrame(); | 1476 view_->DidReceiveRendererFrame(); |
1475 } else { | 1477 } else { |
1476 cc::CompositorFrameAck ack; | 1478 cc::CompositorFrameAck ack; |
1477 if (frame->gl_frame_data) { | 1479 if (frame->gl_frame_data) { |
1478 ack.gl_frame_data = frame->gl_frame_data.Pass(); | 1480 ack.gl_frame_data = frame->gl_frame_data.Pass(); |
1479 ack.gl_frame_data->sync_point = 0; | 1481 ack.gl_frame_data->sync_point = 0; |
1480 } else if (frame->delegated_frame_data) { | 1482 } else if (frame->delegated_frame_data) { |
1481 cc::TransferableResource::ReturnResources( | 1483 cc::TransferableResource::ReturnResources( |
1482 frame->delegated_frame_data->resource_list, | 1484 frame->delegated_frame_data->resource_list, |
1483 &ack.resources); | 1485 &ack.resources); |
1484 } else if (frame->software_frame_data) { | 1486 } else if (frame->software_frame_data) { |
1485 ack.last_software_frame_id = frame->software_frame_data->id; | 1487 ack.last_software_frame_id = frame->software_frame_data->id; |
1486 } | 1488 } |
1487 SendSwapCompositorFrameAck(routing_id_, output_surface_id, | 1489 SendSwapCompositorFrameAck(routing_id_, output_surface_id, |
1488 process_->GetID(), ack); | 1490 process_->GetID(), ack); |
1489 } | 1491 } |
1492 | |
1493 RenderProcessHost* rph = GetProcess(); | |
1494 for (std::vector<IPC::Message>::const_iterator i = | |
1495 messages_to_deliver_with_frame.begin(); | |
1496 i != messages_to_deliver_with_frame.end(); | |
1497 ++i) { | |
1498 rph->OnMessageReceived(*i); | |
Tom Sepez
2014/07/02 17:56:04
You should check if the message was handled, calli
jam
2014/07/02 20:10:54
In general, not handling IPCs is not considered an
mkosiba (inactive)
2014/07/03 15:47:32
Done.
| |
1499 } | |
1500 messages_to_deliver_with_frame.clear(); | |
1501 | |
1490 return true; | 1502 return true; |
1491 } | 1503 } |
1492 | 1504 |
1493 void RenderWidgetHostImpl::OnFlingingStopped() { | 1505 void RenderWidgetHostImpl::OnFlingingStopped() { |
1494 if (view_) | 1506 if (view_) |
1495 view_->DidStopFlinging(); | 1507 view_->DidStopFlinging(); |
1496 } | 1508 } |
1497 | 1509 |
1498 void RenderWidgetHostImpl::OnUpdateRect( | 1510 void RenderWidgetHostImpl::OnUpdateRect( |
1499 const ViewHostMsg_UpdateRect_Params& params) { | 1511 const ViewHostMsg_UpdateRect_Params& params) { |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2368 } | 2380 } |
2369 } | 2381 } |
2370 | 2382 |
2371 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { | 2383 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { |
2372 if (view_) | 2384 if (view_) |
2373 return view_->PreferredReadbackFormat(); | 2385 return view_->PreferredReadbackFormat(); |
2374 return SkBitmap::kARGB_8888_Config; | 2386 return SkBitmap::kARGB_8888_Config; |
2375 } | 2387 } |
2376 | 2388 |
2377 } // namespace content | 2389 } // namespace content |
OLD | NEW |