| 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 SetView(RenderWidgetHostView* view); |
| 75 |
| 76 int routing_id() { |
| 77 return routing_id_; |
| 78 } |
| 79 |
| 72 // TODO(nasko): The following methods should be removed once we don't have a | 80 // 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. | 81 // swapped out state on RenderFrameHosts. See https://crbug.com/357747. |
| 74 RenderFrameHostImpl* render_frame_host() { | 82 RenderFrameHostImpl* render_frame_host() { |
| 75 return render_frame_host_.get(); | 83 return render_frame_host_.get(); |
| 76 } | 84 } |
| 77 RenderViewHostImpl* GetRenderViewHost(); | 85 RenderViewHostImpl* GetRenderViewHost(); |
| 78 | 86 |
| 79 void TakeFrameHostOwnership( | 87 void TakeFrameHostOwnership( |
| 80 scoped_ptr<RenderFrameHostImpl> render_frame_host) { | 88 scoped_ptr<RenderFrameHostImpl> render_frame_host) { |
| 81 render_frame_host_ = render_frame_host.Pass(); | 89 render_frame_host_ = render_frame_host.Pass(); |
| 82 } | 90 } |
| 83 scoped_ptr<RenderFrameHostImpl> PassFrameHostOwnership(); | 91 scoped_ptr<RenderFrameHostImpl> PassFrameHostOwnership(); |
| 84 | 92 |
| 85 // IPC::Sender | 93 // IPC::Sender |
| 86 virtual bool Send(IPC::Message* msg) OVERRIDE; | 94 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 87 | 95 |
| 88 private: | |
| 89 // IPC::Listener | 96 // IPC::Listener |
| 90 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 97 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 91 | 98 |
| 99 CrossProcessFrameConnector* cross_process_frame_connector() { |
| 100 return cross_process_frame_connector_.get(); |
| 101 } |
| 102 |
| 103 private: |
| 92 // This RenderFrameProxyHost's routing id. | 104 // This RenderFrameProxyHost's routing id. |
| 93 int routing_id_; | 105 int routing_id_; |
| 94 | 106 |
| 95 // The SiteInstance this proxy is associated with. | 107 // The SiteInstance this proxy is associated with. |
| 96 scoped_refptr<SiteInstance> site_instance_; | 108 scoped_refptr<SiteInstance> site_instance_; |
| 97 | 109 |
| 98 // The node in the frame tree where this proxy is located. | 110 // The node in the frame tree where this proxy is located. |
| 99 FrameTreeNode* frame_tree_node_; | 111 FrameTreeNode* frame_tree_node_; |
| 100 | 112 |
| 113 // When a RrenderFrameHost is in a different process from its parent in the |
| 114 // frame tree, this class connects its associated RenderWidgetHostView |
| 115 // to this RenderFrameProxyHost, which corresponds to the same frame in the |
| 116 // parent's renderer process. |
| 117 scoped_ptr<CrossProcessFrameConnector> cross_process_frame_connector_; |
| 118 |
| 101 // TODO(nasko): This can be removed once we don't have a swapped out state on | 119 // TODO(nasko): This can be removed once we don't have a swapped out state on |
| 102 // RenderFrameHosts. See https://crbug.com/357747. | 120 // RenderFrameHosts. See https://crbug.com/357747. |
| 103 scoped_ptr<RenderFrameHostImpl> render_frame_host_; | 121 scoped_ptr<RenderFrameHostImpl> render_frame_host_; |
| 104 | 122 |
| 105 DISALLOW_COPY_AND_ASSIGN(RenderFrameProxyHost); | 123 DISALLOW_COPY_AND_ASSIGN(RenderFrameProxyHost); |
| 106 }; | 124 }; |
| 107 | 125 |
| 108 } // namespace | 126 } // namespace |
| 109 | 127 |
| 110 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ | 128 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ |
| OLD | NEW |