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