| 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 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/browser/frame_host/render_frame_host_impl.h" | 9 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 10 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
| 11 #include "ipc/ipc_listener.h" | 11 #include "ipc/ipc_listener.h" |
| 12 #include "ipc/ipc_sender.h" | 12 #include "ipc/ipc_sender.h" |
| 13 | 13 |
| 14 namespace content { |
| 15 |
| 16 class CrossProcessFrameConnector; |
| 14 class FrameTreeNode; | 17 class FrameTreeNode; |
| 15 class RenderProcessHost; | 18 class RenderProcessHost; |
| 16 class RenderFrameHostImpl; | 19 class RenderFrameHostImpl; |
| 17 class RenderViewHostImpl; | 20 class RenderViewHostImpl; |
| 18 | 21 class RenderWidgetHostView; |
| 19 namespace content { | |
| 20 | 22 |
| 21 // When a page's frames are rendered by multiple processes, each renderer has a | 23 // When a page's frames are rendered by multiple processes, each renderer has a |
| 22 // full copy of the frame tree. It has full RenderFrames for the frames it is | 24 // full copy of the frame tree. It has full RenderFrames for the frames it is |
| 23 // responsible for rendering and placeholder objects (i.e., RenderFrameProxies) | 25 // responsible for rendering and placeholder objects (i.e., RenderFrameProxies) |
| 24 // for frames rendered by other processes. | 26 // for frames rendered by other processes. |
| 25 // | 27 // |
| 26 // This class is the browser-side host object for the placeholder. Each node in | 28 // This class is the browser-side host object for the placeholder. Each node in |
| 27 // the frame tree has a RenderFrameHost for the active SiteInstance and a set | 29 // the frame tree has a RenderFrameHost for the active SiteInstance and a set |
| 28 // of RenderFrameProxyHost objects - one for all other SiteInstances with | 30 // of RenderFrameProxyHost objects - one for all other SiteInstances with |
| 29 // references to this frame. The proxies allow us to keep existing window | 31 // references to this frame. The proxies allow us to keep existing window |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 64 } |
| 63 | 65 |
| 64 int GetRoutingID() { | 66 int GetRoutingID() { |
| 65 return routing_id_; | 67 return routing_id_; |
| 66 } | 68 } |
| 67 | 69 |
| 68 SiteInstance* GetSiteInstance() { | 70 SiteInstance* GetSiteInstance() { |
| 69 return site_instance_.get(); | 71 return site_instance_.get(); |
| 70 } | 72 } |
| 71 | 73 |
| 74 void SetChildRWHView(RenderWidgetHostView* view); |
| 75 |
| 72 // TODO(nasko): The following methods should be removed once we don't have a | 76 // TODO(nasko): The following methods should be removed once we don't have a |
| 73 // swapped out state on RenderFrameHosts. See https://crbug.com/357747. | 77 // swapped out state on RenderFrameHosts. See https://crbug.com/357747. |
| 74 RenderFrameHostImpl* render_frame_host() { | 78 RenderFrameHostImpl* render_frame_host() { |
| 75 return render_frame_host_.get(); | 79 return render_frame_host_.get(); |
| 76 } | 80 } |
| 77 RenderViewHostImpl* GetRenderViewHost(); | 81 RenderViewHostImpl* GetRenderViewHost(); |
| 78 | 82 |
| 79 void TakeFrameHostOwnership( | 83 void TakeFrameHostOwnership( |
| 80 scoped_ptr<RenderFrameHostImpl> render_frame_host) { | 84 scoped_ptr<RenderFrameHostImpl> render_frame_host) { |
| 81 render_frame_host_ = render_frame_host.Pass(); | 85 render_frame_host_ = render_frame_host.Pass(); |
| 82 } | 86 } |
| 83 scoped_ptr<RenderFrameHostImpl> PassFrameHostOwnership(); | 87 scoped_ptr<RenderFrameHostImpl> PassFrameHostOwnership(); |
| 84 | 88 |
| 85 // IPC::Sender | 89 // IPC::Sender |
| 86 virtual bool Send(IPC::Message* msg) OVERRIDE; | 90 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 87 | 91 |
| 88 private: | |
| 89 // IPC::Listener | 92 // IPC::Listener |
| 90 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 93 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 91 | 94 |
| 95 CrossProcessFrameConnector* cross_process_frame_connector() { |
| 96 return cross_process_frame_connector_.get(); |
| 97 } |
| 98 |
| 99 private: |
| 92 // This RenderFrameProxyHost's routing id. | 100 // This RenderFrameProxyHost's routing id. |
| 93 int routing_id_; | 101 int routing_id_; |
| 94 | 102 |
| 95 // The SiteInstance this proxy is associated with. | 103 // The SiteInstance this proxy is associated with. |
| 96 scoped_refptr<SiteInstance> site_instance_; | 104 scoped_refptr<SiteInstance> site_instance_; |
| 97 | 105 |
| 98 // The node in the frame tree where this proxy is located. | 106 // The node in the frame tree where this proxy is located. |
| 99 FrameTreeNode* frame_tree_node_; | 107 FrameTreeNode* frame_tree_node_; |
| 100 | 108 |
| 109 // When a RenderFrameHost is in a different process from its parent in the |
| 110 // frame tree, this class connects its associated RenderWidgetHostView |
| 111 // to this RenderFrameProxyHost, which corresponds to the same frame in the |
| 112 // parent's renderer process. |
| 113 scoped_ptr<CrossProcessFrameConnector> cross_process_frame_connector_; |
| 114 |
| 101 // TODO(nasko): This can be removed once we don't have a swapped out state on | 115 // TODO(nasko): This can be removed once we don't have a swapped out state on |
| 102 // RenderFrameHosts. See https://crbug.com/357747. | 116 // RenderFrameHosts. See https://crbug.com/357747. |
| 103 scoped_ptr<RenderFrameHostImpl> render_frame_host_; | 117 scoped_ptr<RenderFrameHostImpl> render_frame_host_; |
| 104 | 118 |
| 105 DISALLOW_COPY_AND_ASSIGN(RenderFrameProxyHost); | 119 DISALLOW_COPY_AND_ASSIGN(RenderFrameProxyHost); |
| 106 }; | 120 }; |
| 107 | 121 |
| 108 } // namespace | 122 } // namespace |
| 109 | 123 |
| 110 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ | 124 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ |
| OLD | NEW |