| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame_host/cross_process_frame_connector.h" | 5 #include "content/browser/frame_host/cross_process_frame_connector.h" | 
| 6 | 6 | 
| 7 #include "content/browser/frame_host/render_frame_proxy_host.h" | 7 #include "content/browser/frame_host/render_frame_proxy_host.h" | 
| 8 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 8 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 
| 9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" | 
| 10 #include "content/browser/renderer_host/render_widget_host_impl.h" | 10 #include "content/browser/renderer_host/render_widget_host_impl.h" | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 23 | 23 | 
| 24 CrossProcessFrameConnector::~CrossProcessFrameConnector() { | 24 CrossProcessFrameConnector::~CrossProcessFrameConnector() { | 
| 25   if (view_) | 25   if (view_) | 
| 26     view_->set_cross_process_frame_connector(NULL); | 26     view_->set_cross_process_frame_connector(NULL); | 
| 27 } | 27 } | 
| 28 | 28 | 
| 29 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) { | 29 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) { | 
| 30   bool handled = true; | 30   bool handled = true; | 
| 31 | 31 | 
| 32   IPC_BEGIN_MESSAGE_MAP(CrossProcessFrameConnector, msg) | 32   IPC_BEGIN_MESSAGE_MAP(CrossProcessFrameConnector, msg) | 
| 33     IPC_MESSAGE_HANDLER(FrameHostMsg_BuffersSwappedACK, OnBuffersSwappedACK) |  | 
| 34     IPC_MESSAGE_HANDLER(FrameHostMsg_CompositorFrameSwappedACK, | 33     IPC_MESSAGE_HANDLER(FrameHostMsg_CompositorFrameSwappedACK, | 
| 35                         OnCompositorFrameSwappedACK) | 34                         OnCompositorFrameSwappedACK) | 
| 36     IPC_MESSAGE_HANDLER(FrameHostMsg_ReclaimCompositorResources, | 35     IPC_MESSAGE_HANDLER(FrameHostMsg_ReclaimCompositorResources, | 
| 37                         OnReclaimCompositorResources) | 36                         OnReclaimCompositorResources) | 
| 38     IPC_MESSAGE_HANDLER(FrameHostMsg_ForwardInputEvent, OnForwardInputEvent) | 37     IPC_MESSAGE_HANDLER(FrameHostMsg_ForwardInputEvent, OnForwardInputEvent) | 
| 39     IPC_MESSAGE_HANDLER(FrameHostMsg_InitializeChildFrame, | 38     IPC_MESSAGE_HANDLER(FrameHostMsg_InitializeChildFrame, | 
| 40                         OnInitializeChildFrame) | 39                         OnInitializeChildFrame) | 
| 41     IPC_MESSAGE_UNHANDLED(handled = false) | 40     IPC_MESSAGE_UNHANDLED(handled = false) | 
| 42   IPC_END_MESSAGE_MAP() | 41   IPC_END_MESSAGE_MAP() | 
| 43 | 42 | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 58     SetDeviceScaleFactor(device_scale_factor_); | 57     SetDeviceScaleFactor(device_scale_factor_); | 
| 59     SetSize(child_frame_rect_); | 58     SetSize(child_frame_rect_); | 
| 60   } | 59   } | 
| 61 } | 60 } | 
| 62 | 61 | 
| 63 void CrossProcessFrameConnector::RenderProcessGone() { | 62 void CrossProcessFrameConnector::RenderProcessGone() { | 
| 64   frame_proxy_in_parent_renderer_->Send(new FrameMsg_ChildFrameProcessGone( | 63   frame_proxy_in_parent_renderer_->Send(new FrameMsg_ChildFrameProcessGone( | 
| 65       frame_proxy_in_parent_renderer_->GetRoutingID())); | 64       frame_proxy_in_parent_renderer_->GetRoutingID())); | 
| 66 } | 65 } | 
| 67 | 66 | 
| 68 void CrossProcessFrameConnector::ChildFrameBuffersSwapped( |  | 
| 69     const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& gpu_params, |  | 
| 70     int gpu_host_id) { |  | 
| 71 |  | 
| 72   FrameMsg_BuffersSwapped_Params params; |  | 
| 73   params.size = gpu_params.size; |  | 
| 74   params.mailbox = gpu_params.mailbox; |  | 
| 75   params.gpu_route_id = gpu_params.route_id; |  | 
| 76   params.gpu_host_id = gpu_host_id; |  | 
| 77 |  | 
| 78   frame_proxy_in_parent_renderer_->Send(new FrameMsg_BuffersSwapped( |  | 
| 79       frame_proxy_in_parent_renderer_->GetRoutingID(), params)); |  | 
| 80 } |  | 
| 81 |  | 
| 82 void CrossProcessFrameConnector::ChildFrameCompositorFrameSwapped( | 67 void CrossProcessFrameConnector::ChildFrameCompositorFrameSwapped( | 
| 83     uint32 output_surface_id, | 68     uint32 output_surface_id, | 
| 84     int host_id, | 69     int host_id, | 
| 85     int route_id, | 70     int route_id, | 
| 86     scoped_ptr<cc::CompositorFrame> frame) { | 71     scoped_ptr<cc::CompositorFrame> frame) { | 
| 87   FrameMsg_CompositorFrameSwapped_Params params; | 72   FrameMsg_CompositorFrameSwapped_Params params; | 
| 88   frame->AssignTo(¶ms.frame); | 73   frame->AssignTo(¶ms.frame); | 
| 89   params.output_surface_id = output_surface_id; | 74   params.output_surface_id = output_surface_id; | 
| 90   params.producing_route_id = route_id; | 75   params.producing_route_id = route_id; | 
| 91   params.producing_host_id = host_id; | 76   params.producing_host_id = host_id; | 
| 92   frame_proxy_in_parent_renderer_->Send(new FrameMsg_CompositorFrameSwapped( | 77   frame_proxy_in_parent_renderer_->Send(new FrameMsg_CompositorFrameSwapped( | 
| 93       frame_proxy_in_parent_renderer_->GetRoutingID(), params)); | 78       frame_proxy_in_parent_renderer_->GetRoutingID(), params)); | 
| 94 } | 79 } | 
| 95 | 80 | 
| 96 void CrossProcessFrameConnector::OnBuffersSwappedACK( |  | 
| 97     const FrameHostMsg_BuffersSwappedACK_Params& params) { |  | 
| 98   AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |  | 
| 99   ack_params.mailbox = params.mailbox; |  | 
| 100   ack_params.sync_point = params.sync_point; |  | 
| 101   RenderWidgetHostImpl::AcknowledgeBufferPresent(params.gpu_route_id, |  | 
| 102                                                  params.gpu_host_id, |  | 
| 103                                                  ack_params); |  | 
| 104 |  | 
| 105   // TODO(kenrb): Special case stuff for Win + Mac. |  | 
| 106 } |  | 
| 107 |  | 
| 108 void CrossProcessFrameConnector::OnCompositorFrameSwappedACK( | 81 void CrossProcessFrameConnector::OnCompositorFrameSwappedACK( | 
| 109     const FrameHostMsg_CompositorFrameSwappedACK_Params& params) { | 82     const FrameHostMsg_CompositorFrameSwappedACK_Params& params) { | 
| 110   RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id, | 83   RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id, | 
| 111                                                    params.output_surface_id, | 84                                                    params.output_surface_id, | 
| 112                                                    params.producing_host_id, | 85                                                    params.producing_host_id, | 
| 113                                                    params.ack); | 86                                                    params.ack); | 
| 114 } | 87 } | 
| 115 | 88 | 
| 116 void CrossProcessFrameConnector::OnReclaimCompositorResources( | 89 void CrossProcessFrameConnector::OnReclaimCompositorResources( | 
| 117     const FrameHostMsg_ReclaimCompositorResources_Params& params) { | 90     const FrameHostMsg_ReclaimCompositorResources_Params& params) { | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 175   } | 148   } | 
| 176 } | 149 } | 
| 177 | 150 | 
| 178 void CrossProcessFrameConnector::SetSize(gfx::Rect frame_rect) { | 151 void CrossProcessFrameConnector::SetSize(gfx::Rect frame_rect) { | 
| 179   child_frame_rect_ = frame_rect; | 152   child_frame_rect_ = frame_rect; | 
| 180   if (view_) | 153   if (view_) | 
| 181     view_->SetSize(frame_rect.size()); | 154     view_->SetSize(frame_rect.size()); | 
| 182 } | 155 } | 
| 183 | 156 | 
| 184 }  // namespace content | 157 }  // namespace content | 
| OLD | NEW | 
|---|