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/renderer/render_frame_proxy.h" | 5 #include "content/renderer/render_frame_proxy.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "content/child/webmessageportchannel_impl.h" | 10 #include "content/child/webmessageportchannel_impl.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 void RenderFrameProxy::DidCommitCompositorFrame() { | 142 void RenderFrameProxy::DidCommitCompositorFrame() { |
143 if (compositing_helper_.get()) | 143 if (compositing_helper_.get()) |
144 compositing_helper_->DidCommitCompositorFrame(); | 144 compositing_helper_->DidCommitCompositorFrame(); |
145 } | 145 } |
146 | 146 |
147 bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) { | 147 bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) { |
148 bool handled = true; | 148 bool handled = true; |
149 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxy, msg) | 149 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxy, msg) |
150 IPC_MESSAGE_HANDLER(FrameMsg_DeleteProxy, OnDeleteProxy) | 150 IPC_MESSAGE_HANDLER(FrameMsg_DeleteProxy, OnDeleteProxy) |
151 IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone) | 151 IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone) |
152 IPC_MESSAGE_HANDLER(FrameMsg_BuffersSwapped, OnBuffersSwapped) | |
153 IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped, | 152 IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped, |
154 OnCompositorFrameSwapped(msg)) | 153 OnCompositorFrameSwapped(msg)) |
155 IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener) | 154 IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener) |
156 IPC_MESSAGE_UNHANDLED(handled = false) | 155 IPC_MESSAGE_UNHANDLED(handled = false) |
157 IPC_END_MESSAGE_MAP() | 156 IPC_END_MESSAGE_MAP() |
158 | 157 |
159 // If |handled| is true, |this| may have been deleted. | 158 // If |handled| is true, |this| may have been deleted. |
160 if (handled) | 159 if (handled) |
161 return true; | 160 return true; |
162 | 161 |
(...skipping 19 matching lines...) Expand all Loading... |
182 render_frame->set_render_frame_proxy(NULL); | 181 render_frame->set_render_frame_proxy(NULL); |
183 | 182 |
184 delete this; | 183 delete this; |
185 } | 184 } |
186 | 185 |
187 void RenderFrameProxy::OnChildFrameProcessGone() { | 186 void RenderFrameProxy::OnChildFrameProcessGone() { |
188 if (compositing_helper_.get()) | 187 if (compositing_helper_.get()) |
189 compositing_helper_->ChildFrameGone(); | 188 compositing_helper_->ChildFrameGone(); |
190 } | 189 } |
191 | 190 |
192 void RenderFrameProxy::OnBuffersSwapped( | |
193 const FrameMsg_BuffersSwapped_Params& params) { | |
194 if (!compositing_helper_.get()) { | |
195 compositing_helper_ = | |
196 ChildFrameCompositingHelper::CreateForRenderFrameProxy(this); | |
197 compositing_helper_->EnableCompositing(true); | |
198 } | |
199 compositing_helper_->OnBuffersSwapped( | |
200 params.size, | |
201 params.mailbox, | |
202 params.gpu_route_id, | |
203 params.gpu_host_id, | |
204 web_frame()->view()->deviceScaleFactor()); | |
205 } | |
206 | |
207 void RenderFrameProxy::OnCompositorFrameSwapped(const IPC::Message& message) { | 191 void RenderFrameProxy::OnCompositorFrameSwapped(const IPC::Message& message) { |
208 FrameMsg_CompositorFrameSwapped::Param param; | 192 FrameMsg_CompositorFrameSwapped::Param param; |
209 if (!FrameMsg_CompositorFrameSwapped::Read(&message, ¶m)) | 193 if (!FrameMsg_CompositorFrameSwapped::Read(&message, ¶m)) |
210 return; | 194 return; |
211 | 195 |
212 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 196 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
213 param.a.frame.AssignTo(frame.get()); | 197 param.a.frame.AssignTo(frame.get()); |
214 | 198 |
215 if (!compositing_helper_.get()) { | 199 if (!compositing_helper_.get()) { |
216 compositing_helper_ = | 200 compositing_helper_ = |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 RenderViewImpl* source_view = | 265 RenderViewImpl* source_view = |
282 RenderViewImpl::FromWebView(source_frame->view()); | 266 RenderViewImpl::FromWebView(source_frame->view()); |
283 if (source_view) | 267 if (source_view) |
284 params.source_routing_id = source_view->routing_id(); | 268 params.source_routing_id = source_view->routing_id(); |
285 } | 269 } |
286 | 270 |
287 Send(new ViewHostMsg_RouteMessageEvent(render_view_->GetRoutingID(), params)); | 271 Send(new ViewHostMsg_RouteMessageEvent(render_view_->GetRoutingID(), params)); |
288 } | 272 } |
289 | 273 |
290 } // namespace | 274 } // namespace |
OLD | NEW |