| 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 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 // This trace event is used in | 1447 // This trace event is used in |
| 1448 // chrome/browser/extensions/api/cast_streaming/performance_test.cc | 1448 // chrome/browser/extensions/api/cast_streaming/performance_test.cc |
| 1449 UNSHIPPED_TRACE_EVENT0("test_fps", | 1449 UNSHIPPED_TRACE_EVENT0("test_fps", |
| 1450 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); | 1450 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); |
| 1451 ViewHostMsg_SwapCompositorFrame::Param param; | 1451 ViewHostMsg_SwapCompositorFrame::Param param; |
| 1452 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1452 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
| 1453 return false; | 1453 return false; |
| 1454 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 1454 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
| 1455 uint32 output_surface_id = param.a; | 1455 uint32 output_surface_id = param.a; |
| 1456 param.b.AssignTo(frame.get()); | 1456 param.b.AssignTo(frame.get()); |
| 1457 std::vector<IPC::Message> messages_to_deliver_with_frame; |
| 1458 messages_to_deliver_with_frame.swap(param.c); |
| 1457 | 1459 |
| 1458 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) | 1460 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) |
| 1459 AddLatencyInfoComponentIds(&frame->metadata.latency_info[i]); | 1461 AddLatencyInfoComponentIds(&frame->metadata.latency_info[i]); |
| 1460 | 1462 |
| 1461 input_router_->OnViewUpdated( | 1463 input_router_->OnViewUpdated( |
| 1462 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); | 1464 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata)); |
| 1463 | 1465 |
| 1464 if (view_) { | 1466 if (view_) { |
| 1465 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); | 1467 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); |
| 1466 view_->DidReceiveRendererFrame(); | 1468 view_->DidReceiveRendererFrame(); |
| 1467 } else { | 1469 } else { |
| 1468 cc::CompositorFrameAck ack; | 1470 cc::CompositorFrameAck ack; |
| 1469 if (frame->gl_frame_data) { | 1471 if (frame->gl_frame_data) { |
| 1470 ack.gl_frame_data = frame->gl_frame_data.Pass(); | 1472 ack.gl_frame_data = frame->gl_frame_data.Pass(); |
| 1471 ack.gl_frame_data->sync_point = 0; | 1473 ack.gl_frame_data->sync_point = 0; |
| 1472 } else if (frame->delegated_frame_data) { | 1474 } else if (frame->delegated_frame_data) { |
| 1473 cc::TransferableResource::ReturnResources( | 1475 cc::TransferableResource::ReturnResources( |
| 1474 frame->delegated_frame_data->resource_list, | 1476 frame->delegated_frame_data->resource_list, |
| 1475 &ack.resources); | 1477 &ack.resources); |
| 1476 } else if (frame->software_frame_data) { | 1478 } else if (frame->software_frame_data) { |
| 1477 ack.last_software_frame_id = frame->software_frame_data->id; | 1479 ack.last_software_frame_id = frame->software_frame_data->id; |
| 1478 } | 1480 } |
| 1479 SendSwapCompositorFrameAck(routing_id_, output_surface_id, | 1481 SendSwapCompositorFrameAck(routing_id_, output_surface_id, |
| 1480 process_->GetID(), ack); | 1482 process_->GetID(), ack); |
| 1481 } | 1483 } |
| 1484 |
| 1485 RenderProcessHost* rph = GetProcess(); |
| 1486 for (std::vector<IPC::Message>::const_iterator i = |
| 1487 messages_to_deliver_with_frame.begin(); |
| 1488 i != messages_to_deliver_with_frame.end(); |
| 1489 ++i) { |
| 1490 rph->OnMessageReceived(*i); |
| 1491 } |
| 1492 messages_to_deliver_with_frame.clear(); |
| 1493 |
| 1482 return true; | 1494 return true; |
| 1483 } | 1495 } |
| 1484 | 1496 |
| 1485 void RenderWidgetHostImpl::OnFlingingStopped() { | 1497 void RenderWidgetHostImpl::OnFlingingStopped() { |
| 1486 if (view_) | 1498 if (view_) |
| 1487 view_->DidStopFlinging(); | 1499 view_->DidStopFlinging(); |
| 1488 } | 1500 } |
| 1489 | 1501 |
| 1490 void RenderWidgetHostImpl::OnUpdateRect( | 1502 void RenderWidgetHostImpl::OnUpdateRect( |
| 1491 const ViewHostMsg_UpdateRect_Params& params) { | 1503 const ViewHostMsg_UpdateRect_Params& params) { |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2305 } | 2317 } |
| 2306 } | 2318 } |
| 2307 | 2319 |
| 2308 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { | 2320 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { |
| 2309 if (view_) | 2321 if (view_) |
| 2310 return view_->PreferredReadbackFormat(); | 2322 return view_->PreferredReadbackFormat(); |
| 2311 return SkBitmap::kARGB_8888_Config; | 2323 return SkBitmap::kARGB_8888_Config; |
| 2312 } | 2324 } |
| 2313 | 2325 |
| 2314 } // namespace content | 2326 } // namespace content |
| OLD | NEW |