| 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 #ifndef CONTENT_BROWSER_FRAME_HOST_CROSS_PROCESS_FRAME_CONNECTOR_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_CROSS_PROCESS_FRAME_CONNECTOR_H_ |
| 7 |
| 8 #include "cc/output/compositor_frame.h" |
| 9 #include "ui/gfx/rect.h" |
| 10 |
| 11 namespace IPC { |
| 12 class Message; |
| 13 } |
| 14 |
| 15 struct FrameHostMsg_BuffersSwappedACK_Params; |
| 16 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
| 17 |
| 18 namespace content { |
| 19 class RenderFrameHostImpl; |
| 20 class RenderWidgetHostImpl; |
| 21 class RenderWidgetHostViewChildFrame; |
| 22 |
| 23 // CrossProcessFrameConnector provides the platform view abstraction for |
| 24 // RenderWidgetHostViewChildFrame allowing RWHVChildFrame to remain ignorant |
| 25 // of RenderFrameHost. |
| 26 // |
| 27 // The RenderWidgetHostView of an out-of-process child frame needs to |
| 28 // communicate with the swapped out RenderFrameHost representing this frame |
| 29 // in the process of the parent frame. For example, assume you have this page: |
| 30 // |
| 31 // ----------------- |
| 32 // | frame 1 | |
| 33 // | ----------- | |
| 34 // | | frame 2 | | |
| 35 // | ----------- | |
| 36 // ----------------- |
| 37 // |
| 38 // If frames 1 and 2 are in process A and B, there are 4 RenderFrameHosts: |
| 39 // A1 - RFH for frame 1 in process A |
| 40 // B1 - Swapped out RFH for frame 1 in process B |
| 41 // A2 - Swapped out RFH for frame 2 in process A |
| 42 // B2 - RFH for frame 2 in process B |
| 43 // |
| 44 // B2, having a parent frame in a diferent process, will have a |
| 45 // RenderWidgetHostViewChildFrame. This RenderWidgetHostViewChildFrame needs |
| 46 // to communicate with A2 so that the painting logic in process A can |
| 47 // composite B2's data with A1's. CrossProcessFrameConnector bridges between |
| 48 // B2's RenderWidgetHostViewChildFrame and A2 to allow for this communication. |
| 49 // (Note: B1 is only mentioned for completeness. It is not needed in this |
| 50 // example.) |
| 51 // |
| 52 // CrossProcessFrameConnector objects are owned by the child frame's |
| 53 // RenderFrameHostManager. When a child frame swaps, SetChildFrameView() is |
| 54 // called to update to the new view. |
| 55 // |
| 56 // TODO(kenrb): Double-check this comment's accuracy. |
| 57 class CrossProcessFrameConnector { |
| 58 public: |
| 59 // |frame_proxy_in_parent_renderer| corresponds to A2 in the example above. |
| 60 explicit CrossProcessFrameConnector( |
| 61 RenderFrameHostImpl* frame_proxy_in_parent_renderer); |
| 62 virtual ~CrossProcessFrameConnector(); |
| 63 |
| 64 bool OnMessageReceived(const IPC::Message &msg); |
| 65 |
| 66 // |view| corresponds to B2's RenderWidgetHostViewChildFrame in the example |
| 67 // above. |
| 68 void SetView(RenderWidgetHostViewChildFrame* view); |
| 69 |
| 70 // 'Platform' functionality exposed to RenderWidgetHostViewChildFrame. |
| 71 // These methods can forward messages to the child frame proxy in the parent |
| 72 // frame renderer or attempt to handle them within the browser process. |
| 73 void ChildFrameBuffersSwapped( |
| 74 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 75 int gpu_host_id); |
| 76 |
| 77 void ChildFrameCompositorFrameSwapped( |
| 78 uint32 output_surface_id, |
| 79 scoped_ptr<cc::CompositorFrame> frame); |
| 80 |
| 81 gfx::Rect ChildFrameRect(); |
| 82 |
| 83 private: |
| 84 // Handlers for messages received from the parent frame. |
| 85 void OnBuffersSwappedACK( |
| 86 const FrameHostMsg_BuffersSwappedACK_Params& params); |
| 87 |
| 88 // The RenderFrameHost that routes messages to the parent frame's renderer |
| 89 // process. |
| 90 // TODO(kenrb): The type becomes RenderFrameProxyHost when that class comes |
| 91 // to exist. |
| 92 RenderFrameHostImpl* frame_proxy_in_parent_renderer_; |
| 93 |
| 94 // The RenderWidgetHostView for the frame. Initially NULL. |
| 95 RenderWidgetHostViewChildFrame* view_; |
| 96 |
| 97 gfx::Rect child_frame_rect_; |
| 98 }; |
| 99 |
| 100 } // namespace content |
| 101 |
| 102 #endif // CONTENT_BROWSER_FRAME_HOST_CROSS_PROCESS_FRAME_CONNECTOR_H_ |
| 103 |
| OLD | NEW |