| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1785 view_->DidReceiveRendererFrame(); | 1785 view_->DidReceiveRendererFrame(); |
| 1786 } | 1786 } |
| 1787 #endif // OS_MACOSX | 1787 #endif // OS_MACOSX |
| 1788 | 1788 |
| 1789 bool RenderWidgetHostImpl::OnSwapCompositorFrame( | 1789 bool RenderWidgetHostImpl::OnSwapCompositorFrame( |
| 1790 const IPC::Message& message) { | 1790 const IPC::Message& message) { |
| 1791 ViewHostMsg_SwapCompositorFrame::Param param; | 1791 ViewHostMsg_SwapCompositorFrame::Param param; |
| 1792 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) | 1792 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, ¶m)) |
| 1793 return false; | 1793 return false; |
| 1794 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 1794 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
| 1795 param.a.AssignTo(frame.get()); | 1795 uint32 output_surface_id = param.a; |
| 1796 param.b.AssignTo(frame.get()); |
| 1796 | 1797 |
| 1797 if (view_) { | 1798 if (view_) { |
| 1798 view_->OnSwapCompositorFrame(frame.Pass()); | 1799 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); |
| 1799 view_->DidReceiveRendererFrame(); | 1800 view_->DidReceiveRendererFrame(); |
| 1800 } else { | 1801 } else { |
| 1801 cc::CompositorFrameAck ack; | 1802 cc::CompositorFrameAck ack; |
| 1802 if (frame->gl_frame_data) { | 1803 if (frame->gl_frame_data) { |
| 1803 ack.gl_frame_data = frame->gl_frame_data.Pass(); | 1804 ack.gl_frame_data = frame->gl_frame_data.Pass(); |
| 1804 ack.gl_frame_data->sync_point = 0; | 1805 ack.gl_frame_data->sync_point = 0; |
| 1805 } else if (frame->delegated_frame_data) { | 1806 } else if (frame->delegated_frame_data) { |
| 1806 ack.resources.swap(frame->delegated_frame_data->resource_list); | 1807 ack.resources.swap(frame->delegated_frame_data->resource_list); |
| 1807 } else if (frame->software_frame_data) { | 1808 } else if (frame->software_frame_data) { |
| 1808 ack.last_software_frame_id = frame->software_frame_data->id; | 1809 ack.last_software_frame_id = frame->software_frame_data->id; |
| 1809 } | 1810 } |
| 1810 SendSwapCompositorFrameAck(routing_id_, process_->GetID(), ack); | 1811 SendSwapCompositorFrameAck(routing_id_, process_->GetID(), |
| 1812 output_surface_id, ack); |
| 1811 } | 1813 } |
| 1812 return true; | 1814 return true; |
| 1813 } | 1815 } |
| 1814 | 1816 |
| 1815 void RenderWidgetHostImpl::OnOverscrolled( | 1817 void RenderWidgetHostImpl::OnOverscrolled( |
| 1816 gfx::Vector2dF accumulated_overscroll, | 1818 gfx::Vector2dF accumulated_overscroll, |
| 1817 gfx::Vector2dF current_fling_velocity) { | 1819 gfx::Vector2dF current_fling_velocity) { |
| 1818 if (view_) | 1820 if (view_) |
| 1819 view_->OnOverscrolled(accumulated_overscroll, current_fling_velocity); | 1821 view_->OnOverscrolled(accumulated_overscroll, current_fling_velocity); |
| 1820 } | 1822 } |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2549 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { | 2551 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { |
| 2550 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 2552 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 2551 if (ui_shim) { | 2553 if (ui_shim) { |
| 2552 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, | 2554 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, |
| 2553 params)); | 2555 params)); |
| 2554 } | 2556 } |
| 2555 } | 2557 } |
| 2556 | 2558 |
| 2557 // static | 2559 // static |
| 2558 void RenderWidgetHostImpl::SendSwapCompositorFrameAck( | 2560 void RenderWidgetHostImpl::SendSwapCompositorFrameAck( |
| 2559 int32 route_id, int renderer_host_id, const cc::CompositorFrameAck& ack) { | 2561 int32 route_id, |
| 2562 uint32 output_surface_id, |
| 2563 int renderer_host_id, |
| 2564 const cc::CompositorFrameAck& ack) { |
| 2560 RenderProcessHost* host = RenderProcessHost::FromID(renderer_host_id); | 2565 RenderProcessHost* host = RenderProcessHost::FromID(renderer_host_id); |
| 2561 if (host) | 2566 if (!host) |
| 2562 host->Send(new ViewMsg_SwapCompositorFrameAck(route_id, ack)); | 2567 return; |
| 2568 host->Send(new ViewMsg_SwapCompositorFrameAck( |
| 2569 route_id, output_surface_id, ack)); |
| 2563 } | 2570 } |
| 2564 | 2571 |
| 2565 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { | 2572 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { |
| 2566 if (!is_threaded_compositing_enabled_) | 2573 if (!is_threaded_compositing_enabled_) |
| 2567 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); | 2574 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); |
| 2568 } | 2575 } |
| 2569 | 2576 |
| 2570 #if defined(USE_AURA) | 2577 #if defined(USE_AURA) |
| 2571 | 2578 |
| 2572 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { | 2579 void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 int process_id = (b->first.second >> 32) & 0xffffffff; | 2690 int process_id = (b->first.second >> 32) & 0xffffffff; |
| 2684 RenderWidgetHost* rwh = | 2691 RenderWidgetHost* rwh = |
| 2685 RenderWidgetHost::FromID(process_id, routing_id); | 2692 RenderWidgetHost::FromID(process_id, routing_id); |
| 2686 if (!rwh) | 2693 if (!rwh) |
| 2687 continue; | 2694 continue; |
| 2688 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info); | 2695 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info); |
| 2689 } | 2696 } |
| 2690 } | 2697 } |
| 2691 | 2698 |
| 2692 } // namespace content | 2699 } // namespace content |
| OLD | NEW |