Chromium Code Reviews| Index: content/browser/frame_host/cross_process_frame_connector.cc |
| diff --git a/content/browser/frame_host/cross_process_frame_connector.cc b/content/browser/frame_host/cross_process_frame_connector.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4eca22911a1f736fdadbfb107b3ab2598626c397 |
| --- /dev/null |
| +++ b/content/browser/frame_host/cross_process_frame_connector.cc |
| @@ -0,0 +1,96 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/frame_host/cross_process_frame_connector.h" |
| + |
| +#include "content/browser/frame_host/render_frame_host_impl.h" |
| +#include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| +#include "content/browser/renderer_host/render_widget_host_impl.h" |
| +#include "content/common/frame_messages.h" |
| +#include "content/common/gpu/gpu_messages.h" |
| + |
| +namespace content { |
| + |
| +CrossProcessFrameConnector::CrossProcessFrameConnector( |
| + 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.
|
| + frame_proxy_to_parent_renderer_(frame_proxy_to_parent_renderer), |
| + child_frame_widget_(0) { |
| + frame_proxy_to_parent_renderer->SetCrossProcessFrameConnector(this); |
| +} |
| + |
| +CrossProcessFrameConnector::~CrossProcessFrameConnector() { |
| +} |
| + |
| +// static |
| +CrossProcessFrameConnector* |
| + CrossProcessFrameConnector::CreateCrossProcessFrameConnector( |
| + RenderFrameHostImpl* frame_proxy_to_parent_renderer) { |
| + return new CrossProcessFrameConnector(frame_proxy_to_parent_renderer); |
| +} |
| + |
| +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.
|
| + bool handled = true; |
| + bool msg_is_ok = true; |
| + |
| + IPC_BEGIN_MESSAGE_MAP_EX(CrossProcessFrameConnector, msg, msg_is_ok) |
| + IPC_MESSAGE_HANDLER(FrameHostMsg_BuffersSwappedACK, OnBuffersSwappedACK) |
| + IPC_MESSAGE_UNHANDLED(handled = false) |
| + IPC_END_MESSAGE_MAP_EX() |
| + |
| + return handled; |
| +} |
| + |
| +void CrossProcessFrameConnector::SetView(RenderWidgetHostViewChildFrame* view) { |
| + if (view) { |
| + 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.
|
| + RenderWidgetHostImpl::From(view->GetRenderWidgetHost()); |
| + view->SetCrossProcessFrameConnector(this); |
| + return; |
| + } |
| + child_frame_widget_ = 0; |
| +} |
| + |
| +void CrossProcessFrameConnector::ChildFrameBuffersSwapped( |
| + const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| + int gpu_host_id) { |
| + frame_proxy_to_parent_renderer_->Send( |
| + new FrameMsg_ChildFrameBuffersSwapped( |
| + frame_proxy_to_parent_renderer_->routing_id(), |
| + params.size, |
| + params.mailbox_name, |
| + params.route_id, |
| + gpu_host_id)); |
| +} |
| + |
| +void CrossProcessFrameConnector::ChildFrameCompositorFrameSwapped( |
| + uint32 output_surface_id, |
| + scoped_ptr<cc::CompositorFrame> frame) { |
| +} |
| + |
| +gfx::Rect CrossProcessFrameConnector::ChildFrameRect() { |
| + return child_frame_rect_; |
| +} |
| + |
| +void CrossProcessFrameConnector::OnBuffersSwappedACK(std::string mailbox_name, |
| + 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.
|
| + int gpu_host_id, |
| + uint32 sync_point) { |
| + AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| + ack_params.mailbox_name = mailbox_name; |
| + ack_params.sync_point = sync_point; |
| + RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| + gpu_host_id, |
| + ack_params); |
| + |
| + // TODO(kenrb): Special case stuff for Win + Mac. |
| +} |
| + |
| +void CrossProcessFrameConnector::Destroy() { |
| + if (child_frame_widget_ && child_frame_widget_->GetView()) |
| + static_cast<RenderWidgetHostViewChildFrame*>(child_frame_widget_-> |
| + GetView())->SetCrossProcessFrameConnector(NULL); |
| + delete this; |
| +} |
| + |
| +} // namespace content |