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_host_impl.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" |
11 #include "content/common/frame_messages.h" | 11 #include "content/common/frame_messages.h" |
12 #include "content/common/gpu/gpu_messages.h" | 12 #include "content/common/gpu/gpu_messages.h" |
13 #include "third_party/WebKit/public/web/WebInputEvent.h" | 13 #include "third_party/WebKit/public/web/WebInputEvent.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 CrossProcessFrameConnector::CrossProcessFrameConnector( | 17 CrossProcessFrameConnector::CrossProcessFrameConnector( |
18 RenderFrameHostImpl* frame_proxy_in_parent_renderer) | 18 RenderFrameProxyHost* frame_proxy_in_parent_renderer) |
19 : frame_proxy_in_parent_renderer_(frame_proxy_in_parent_renderer), | 19 : frame_proxy_in_parent_renderer_(frame_proxy_in_parent_renderer), |
20 view_(NULL), | 20 view_(NULL), |
21 device_scale_factor_(1) { | 21 device_scale_factor_(1) { |
22 frame_proxy_in_parent_renderer->set_cross_process_frame_connector(this); | |
23 } | 22 } |
24 | 23 |
25 CrossProcessFrameConnector::~CrossProcessFrameConnector() { | 24 CrossProcessFrameConnector::~CrossProcessFrameConnector() { |
26 if (view_) | 25 if (view_) |
27 view_->set_cross_process_frame_connector(NULL); | 26 view_->set_cross_process_frame_connector(NULL); |
28 } | 27 } |
29 | 28 |
30 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) { | 29 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) { |
31 bool handled = true; | 30 bool handled = true; |
32 | 31 |
(...skipping 23 matching lines...) Expand all Loading... |
56 // Attach ourselves to the new view and size it appropriately. | 55 // Attach ourselves to the new view and size it appropriately. |
57 if (view_) { | 56 if (view_) { |
58 view_->set_cross_process_frame_connector(this); | 57 view_->set_cross_process_frame_connector(this); |
59 SetDeviceScaleFactor(device_scale_factor_); | 58 SetDeviceScaleFactor(device_scale_factor_); |
60 SetSize(child_frame_rect_); | 59 SetSize(child_frame_rect_); |
61 } | 60 } |
62 } | 61 } |
63 | 62 |
64 void CrossProcessFrameConnector::RenderProcessGone() { | 63 void CrossProcessFrameConnector::RenderProcessGone() { |
65 frame_proxy_in_parent_renderer_->Send(new FrameMsg_ChildFrameProcessGone( | 64 frame_proxy_in_parent_renderer_->Send(new FrameMsg_ChildFrameProcessGone( |
66 frame_proxy_in_parent_renderer_->routing_id())); | 65 frame_proxy_in_parent_renderer_->GetRoutingID())); |
67 } | 66 } |
68 | 67 |
69 void CrossProcessFrameConnector::ChildFrameBuffersSwapped( | 68 void CrossProcessFrameConnector::ChildFrameBuffersSwapped( |
70 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& gpu_params, | 69 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& gpu_params, |
71 int gpu_host_id) { | 70 int gpu_host_id) { |
72 | 71 |
73 FrameMsg_BuffersSwapped_Params params; | 72 FrameMsg_BuffersSwapped_Params params; |
74 params.size = gpu_params.size; | 73 params.size = gpu_params.size; |
75 params.mailbox = gpu_params.mailbox; | 74 params.mailbox = gpu_params.mailbox; |
76 params.gpu_route_id = gpu_params.route_id; | 75 params.gpu_route_id = gpu_params.route_id; |
77 params.gpu_host_id = gpu_host_id; | 76 params.gpu_host_id = gpu_host_id; |
78 | 77 |
79 frame_proxy_in_parent_renderer_->Send( | 78 frame_proxy_in_parent_renderer_->Send(new FrameMsg_BuffersSwapped( |
80 new FrameMsg_BuffersSwapped( | 79 frame_proxy_in_parent_renderer_->GetRoutingID(), params)); |
81 frame_proxy_in_parent_renderer_->routing_id(), | |
82 params)); | |
83 } | 80 } |
84 | 81 |
85 void CrossProcessFrameConnector::ChildFrameCompositorFrameSwapped( | 82 void CrossProcessFrameConnector::ChildFrameCompositorFrameSwapped( |
86 uint32 output_surface_id, | 83 uint32 output_surface_id, |
87 int host_id, | 84 int host_id, |
88 int route_id, | 85 int route_id, |
89 scoped_ptr<cc::CompositorFrame> frame) { | 86 scoped_ptr<cc::CompositorFrame> frame) { |
90 FrameMsg_CompositorFrameSwapped_Params params; | 87 FrameMsg_CompositorFrameSwapped_Params params; |
91 frame->AssignTo(¶ms.frame); | 88 frame->AssignTo(¶ms.frame); |
92 params.output_surface_id = output_surface_id; | 89 params.output_surface_id = output_surface_id; |
93 params.producing_route_id = route_id; | 90 params.producing_route_id = route_id; |
94 params.producing_host_id = host_id; | 91 params.producing_host_id = host_id; |
95 frame_proxy_in_parent_renderer_->Send(new FrameMsg_CompositorFrameSwapped( | 92 frame_proxy_in_parent_renderer_->Send(new FrameMsg_CompositorFrameSwapped( |
96 frame_proxy_in_parent_renderer_->routing_id(), params)); | 93 frame_proxy_in_parent_renderer_->GetRoutingID(), params)); |
97 } | 94 } |
98 | 95 |
99 void CrossProcessFrameConnector::OnBuffersSwappedACK( | 96 void CrossProcessFrameConnector::OnBuffersSwappedACK( |
100 const FrameHostMsg_BuffersSwappedACK_Params& params) { | 97 const FrameHostMsg_BuffersSwappedACK_Params& params) { |
101 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 98 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
102 ack_params.mailbox = params.mailbox; | 99 ack_params.mailbox = params.mailbox; |
103 ack_params.sync_point = params.sync_point; | 100 ack_params.sync_point = params.sync_point; |
104 RenderWidgetHostImpl::AcknowledgeBufferPresent(params.gpu_route_id, | 101 RenderWidgetHostImpl::AcknowledgeBufferPresent(params.gpu_route_id, |
105 params.gpu_host_id, | 102 params.gpu_host_id, |
106 ack_params); | 103 ack_params); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 135 } |
139 | 136 |
140 void CrossProcessFrameConnector::OnForwardInputEvent( | 137 void CrossProcessFrameConnector::OnForwardInputEvent( |
141 const blink::WebInputEvent* event) { | 138 const blink::WebInputEvent* event) { |
142 if (!view_) | 139 if (!view_) |
143 return; | 140 return; |
144 | 141 |
145 RenderWidgetHostImpl* child_widget = | 142 RenderWidgetHostImpl* child_widget = |
146 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); | 143 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); |
147 RenderWidgetHostImpl* parent_widget = | 144 RenderWidgetHostImpl* parent_widget = |
148 frame_proxy_in_parent_renderer_->render_view_host(); | 145 frame_proxy_in_parent_renderer_->GetRenderViewHost(); |
149 | 146 |
150 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { | 147 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { |
151 if (!parent_widget->GetLastKeyboardEvent()) | 148 if (!parent_widget->GetLastKeyboardEvent()) |
152 return; | 149 return; |
153 NativeWebKeyboardEvent keyboard_event( | 150 NativeWebKeyboardEvent keyboard_event( |
154 *parent_widget->GetLastKeyboardEvent()); | 151 *parent_widget->GetLastKeyboardEvent()); |
155 child_widget->ForwardKeyboardEvent(keyboard_event); | 152 child_widget->ForwardKeyboardEvent(keyboard_event); |
156 return; | 153 return; |
157 } | 154 } |
158 | 155 |
(...skipping 19 matching lines...) Expand all Loading... |
178 } | 175 } |
179 } | 176 } |
180 | 177 |
181 void CrossProcessFrameConnector::SetSize(gfx::Rect frame_rect) { | 178 void CrossProcessFrameConnector::SetSize(gfx::Rect frame_rect) { |
182 child_frame_rect_ = frame_rect; | 179 child_frame_rect_ = frame_rect; |
183 if (view_) | 180 if (view_) |
184 view_->SetSize(frame_rect.size()); | 181 view_->SetSize(frame_rect.size()); |
185 } | 182 } |
186 | 183 |
187 } // namespace content | 184 } // namespace content |
OLD | NEW |