Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/frame_host/cross_process_frame_connector.h" | |
| 6 | |
| 7 #include "content/browser/frame_host/render_frame_host_impl.h" | |
| 8 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | |
| 9 #include "content/browser/renderer_host/render_widget_host_impl.h" | |
| 10 #include "content/common/frame_messages.h" | |
| 11 #include "content/common/gpu/gpu_messages.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 CrossProcessFrameConnector::CrossProcessFrameConnector( | |
| 16 RenderFrameHostImpl* frame_proxy_to_parent_renderer) : | |
|
nasko
2013/12/16 23:16:32
style: The colon should be on next line, 4 spaces
awong
2013/12/17 00:44:14
Done.
| |
| 17 frame_proxy_to_parent_renderer_(frame_proxy_to_parent_renderer), | |
| 18 child_frame_widget_(0) { | |
| 19 frame_proxy_to_parent_renderer->SetCrossProcessFrameConnector(this); | |
| 20 } | |
| 21 | |
| 22 CrossProcessFrameConnector::~CrossProcessFrameConnector() { | |
| 23 } | |
| 24 | |
| 25 // static | |
| 26 CrossProcessFrameConnector* | |
| 27 CrossProcessFrameConnector::CreateCrossProcessFrameConnector( | |
| 28 RenderFrameHostImpl* frame_proxy_to_parent_renderer) { | |
| 29 return new CrossProcessFrameConnector(frame_proxy_to_parent_renderer); | |
| 30 } | |
| 31 | |
| 32 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message &msg) { | |
|
awong
2013/12/14 02:25:14
& should associate left to be consistent with rest
awong
2013/12/17 00:44:14
Done.
| |
| 33 bool handled = true; | |
| 34 bool msg_is_ok = true; | |
| 35 | |
| 36 IPC_BEGIN_MESSAGE_MAP_EX(CrossProcessFrameConnector, msg, msg_is_ok) | |
| 37 IPC_MESSAGE_HANDLER(FrameHostMsg_BuffersSwappedACK, OnBuffersSwappedACK) | |
| 38 IPC_MESSAGE_UNHANDLED(handled = false) | |
| 39 IPC_END_MESSAGE_MAP_EX() | |
| 40 | |
| 41 return handled; | |
| 42 } | |
| 43 | |
| 44 void CrossProcessFrameConnector::SetView(RenderWidgetHostViewChildFrame* view) { | |
| 45 if (view) { | |
| 46 child_frame_widget_ = | |
|
nasko
2013/12/16 23:16:32
style: Two spaces indentation for nested blocks.
awong
2013/12/17 00:44:14
rewrote function.
| |
| 47 RenderWidgetHostImpl::From(view->GetRenderWidgetHost()); | |
| 48 view->SetCrossProcessFrameConnector(this); | |
| 49 return; | |
| 50 } | |
| 51 child_frame_widget_ = 0; | |
| 52 } | |
| 53 | |
| 54 void CrossProcessFrameConnector::ChildFrameBuffersSwapped( | |
| 55 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | |
| 56 int gpu_host_id) { | |
| 57 frame_proxy_to_parent_renderer_->Send( | |
| 58 new FrameMsg_ChildFrameBuffersSwapped( | |
| 59 frame_proxy_to_parent_renderer_->routing_id(), | |
| 60 params.size, | |
| 61 params.mailbox_name, | |
| 62 params.route_id, | |
| 63 gpu_host_id)); | |
| 64 } | |
| 65 | |
| 66 void CrossProcessFrameConnector::ChildFrameCompositorFrameSwapped( | |
| 67 uint32 output_surface_id, | |
| 68 scoped_ptr<cc::CompositorFrame> frame) { | |
| 69 } | |
| 70 | |
| 71 gfx::Rect CrossProcessFrameConnector::ChildFrameRect() { | |
| 72 return child_frame_rect_; | |
| 73 } | |
| 74 | |
| 75 void CrossProcessFrameConnector::OnBuffersSwappedACK(std::string mailbox_name, | |
| 76 int route_id, | |
|
nasko
2013/12/16 23:16:32
style: The latter arguments should be aligned with
awong
2013/12/17 00:44:14
Done.
| |
| 77 int gpu_host_id, | |
| 78 uint32 sync_point) { | |
| 79 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | |
| 80 ack_params.mailbox_name = mailbox_name; | |
| 81 ack_params.sync_point = sync_point; | |
| 82 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | |
| 83 gpu_host_id, | |
| 84 ack_params); | |
| 85 | |
| 86 // TODO(kenrb): Special case stuff for Win + Mac. | |
| 87 } | |
| 88 | |
| 89 void CrossProcessFrameConnector::Destroy() { | |
| 90 if (child_frame_widget_ && child_frame_widget_->GetView()) | |
| 91 static_cast<RenderWidgetHostViewChildFrame*>(child_frame_widget_-> | |
| 92 GetView())->SetCrossProcessFrameConnector(NULL); | |
| 93 delete this; | |
| 94 } | |
| 95 | |
| 96 } // namespace content | |
| OLD | NEW |