| 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 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 void RenderWidgetHostImpl::OnRequestMove(const gfx::Rect& pos) { | 1537 void RenderWidgetHostImpl::OnRequestMove(const gfx::Rect& pos) { |
| 1538 if (view_) { | 1538 if (view_) { |
| 1539 view_->SetBounds(pos); | 1539 view_->SetBounds(pos); |
| 1540 Send(new ViewMsg_Move_ACK(routing_id_)); | 1540 Send(new ViewMsg_Move_ACK(routing_id_)); |
| 1541 } | 1541 } |
| 1542 } | 1542 } |
| 1543 | 1543 |
| 1544 #if defined(OS_MACOSX) | 1544 #if defined(OS_MACOSX) |
| 1545 void RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped( | 1545 void RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped( |
| 1546 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params) { | 1546 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params) { |
| 1547 // This trace event is used in |
| 1548 // chrome/browser/extensions/api/cast_streaming/performance_test.cc |
| 1547 TRACE_EVENT0("renderer_host", | 1549 TRACE_EVENT0("renderer_host", |
| 1548 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); | 1550 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped"); |
| 1551 // This trace event is used in |
| 1552 // chrome/browser/extensions/api/cast_streaming/performance_test.cc |
| 1553 UNSHIPPED_TRACE_EVENT0("test_fps", |
| 1554 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); |
| 1549 if (!ui::LatencyInfo::Verify(params.latency_info, | 1555 if (!ui::LatencyInfo::Verify(params.latency_info, |
| 1550 "ViewHostMsg_CompositorSurfaceBuffersSwapped")) | 1556 "ViewHostMsg_CompositorSurfaceBuffersSwapped")) |
| 1551 return; | 1557 return; |
| 1552 if (!view_) { | 1558 if (!view_) { |
| 1553 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1559 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 1554 ack_params.sync_point = 0; | 1560 ack_params.sync_point = 0; |
| 1555 RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, | 1561 RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, |
| 1556 params.gpu_process_host_id, | 1562 params.gpu_process_host_id, |
| 1557 ack_params); | 1563 ack_params); |
| 1558 return; | 1564 return; |
| 1559 } | 1565 } |
| 1560 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; | 1566 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params; |
| 1561 gpu_params.surface_id = params.surface_id; | 1567 gpu_params.surface_id = params.surface_id; |
| 1562 gpu_params.surface_handle = params.surface_handle; | 1568 gpu_params.surface_handle = params.surface_handle; |
| 1563 gpu_params.route_id = params.route_id; | 1569 gpu_params.route_id = params.route_id; |
| 1564 gpu_params.size = params.size; | 1570 gpu_params.size = params.size; |
| 1565 gpu_params.scale_factor = params.scale_factor; | 1571 gpu_params.scale_factor = params.scale_factor; |
| 1566 gpu_params.latency_info = params.latency_info; | 1572 gpu_params.latency_info = params.latency_info; |
| 1567 for (size_t i = 0; i < gpu_params.latency_info.size(); i++) | 1573 for (size_t i = 0; i < gpu_params.latency_info.size(); i++) |
| 1568 AddLatencyInfoComponentIds(&gpu_params.latency_info[i]); | 1574 AddLatencyInfoComponentIds(&gpu_params.latency_info[i]); |
| 1569 view_->AcceleratedSurfaceBuffersSwapped(gpu_params, | 1575 view_->AcceleratedSurfaceBuffersSwapped(gpu_params, |
| 1570 params.gpu_process_host_id); | 1576 params.gpu_process_host_id); |
| 1571 view_->DidReceiveRendererFrame(); | 1577 view_->DidReceiveRendererFrame(); |
| 1572 } | 1578 } |
| 1573 #endif // OS_MACOSX | 1579 #endif // OS_MACOSX |
| 1574 | 1580 |
| 1575 bool RenderWidgetHostImpl::OnSwapCompositorFrame( | 1581 bool RenderWidgetHostImpl::OnSwapCompositorFrame( |
| 1576 const IPC::Message& message) { | 1582 const IPC::Message& message) { |
| 1583 // This trace event is used in |
| 1584 // chrome/browser/extensions/api/cast_streaming/performance_test.cc |
| 1585 UNSHIPPED_TRACE_EVENT0("test_fps", |
| 1586 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); |
| 1577 ViewHostMsg_SwapCompositorFrame::Param param; | 1587 ViewHostMsg_SwapCompositorFrame::Param param; |
| 1578 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1588 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
| 1579 return false; | 1589 return false; |
| 1580 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 1590 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
| 1581 uint32 output_surface_id = param.a; | 1591 uint32 output_surface_id = param.a; |
| 1582 param.b.AssignTo(frame.get()); | 1592 param.b.AssignTo(frame.get()); |
| 1583 | 1593 |
| 1584 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) | 1594 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) |
| 1585 AddLatencyInfoComponentIds(&frame->metadata.latency_info[i]); | 1595 AddLatencyInfoComponentIds(&frame->metadata.latency_info[i]); |
| 1586 | 1596 |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2555 } | 2565 } |
| 2556 } | 2566 } |
| 2557 | 2567 |
| 2558 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { | 2568 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { |
| 2559 if (view_) | 2569 if (view_) |
| 2560 return view_->PreferredReadbackFormat(); | 2570 return view_->PreferredReadbackFormat(); |
| 2561 return SkBitmap::kARGB_8888_Config; | 2571 return SkBitmap::kARGB_8888_Config; |
| 2562 } | 2572 } |
| 2563 | 2573 |
| 2564 } // namespace content | 2574 } // namespace content |
| OLD | NEW |