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 #include "content/browser/frame_host/render_frame_proxy_host.h" | 5 #include "content/browser/frame_host/render_frame_proxy_host.h" |
6 | 6 |
7 #include "content/browser/frame_host/cross_process_frame_connector.h" | 7 #include "content/browser/frame_host/cross_process_frame_connector.h" |
8 #include "content/browser/frame_host/frame_tree.h" | |
8 #include "content/browser/frame_host/frame_tree_node.h" | 9 #include "content/browser/frame_host/frame_tree_node.h" |
9 #include "content/browser/frame_host/render_frame_host_impl.h" | 10 #include "content/browser/frame_host/render_frame_host_impl.h" |
10 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 11 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
12 #include "content/browser/renderer_host/render_view_host_impl.h" | |
11 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 13 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
12 #include "content/browser/site_instance_impl.h" | 14 #include "content/browser/site_instance_impl.h" |
13 #include "content/common/frame_messages.h" | 15 #include "content/common/frame_messages.h" |
14 #include "ipc/ipc_message.h" | 16 #include "ipc/ipc_message.h" |
15 | 17 |
16 namespace content { | 18 namespace content { |
17 | 19 |
18 RenderFrameProxyHost::RenderFrameProxyHost(SiteInstance* site_instance, | 20 RenderFrameProxyHost::RenderFrameProxyHost(SiteInstance* site_instance, |
19 FrameTreeNode* frame_tree_node) | 21 FrameTreeNode* frame_tree_node) |
20 : routing_id_(site_instance->GetProcess()->GetNextRoutingID()), | 22 : routing_id_(site_instance->GetProcess()->GetNextRoutingID()), |
21 site_instance_(site_instance), | 23 site_instance_(site_instance), |
22 frame_tree_node_(frame_tree_node) { | 24 frame_tree_node_(frame_tree_node) { |
23 GetProcess()->AddRoute(routing_id_, this); | 25 GetProcess()->AddRoute(routing_id_, this); |
24 | 26 |
25 if (!frame_tree_node_->IsMainFrame() && | 27 if (!frame_tree_node_->IsMainFrame() && |
26 frame_tree_node_->parent() | 28 frame_tree_node_->parent() |
27 ->render_manager() | 29 ->render_manager() |
28 ->current_frame_host() | 30 ->current_frame_host() |
29 ->GetSiteInstance() == site_instance) { | 31 ->GetSiteInstance() == site_instance) { |
30 // The RenderFrameHost navigating cross-process is destroyed and a proxy for | 32 // The RenderFrameHost navigating cross-process is destroyed and a proxy for |
31 // it is created in the parent's process. CrossProcessFrameConnector | 33 // it is created in the parent's process. CrossProcessFrameConnector |
32 // initialization only needs to happen on an initial cross-process | 34 // initialization only needs to happen on an initial cross-process |
33 // navigation, when the RenderFrameHost leaves the same process as its | 35 // navigation, when the RenderFrameHost leaves the same process as its |
34 // parent. The same CrossProcessFrameConnector is used for subsequent cross- | 36 // parent. The same CrossProcessFrameConnector is used for subsequent cross- |
35 // process navigations, but it will be destroyed if the frame is | 37 // process navigations, but it will be destroyed if the frame is |
36 // navigated back to the same SiteInstance as its parent. | 38 // navigated back to the same SiteInstance as its parent. |
37 cross_process_frame_connector_.reset(new CrossProcessFrameConnector(this)); | 39 cross_process_frame_connector_.reset(new CrossProcessFrameConnector(this)); |
38 } | 40 } |
41 | |
42 RenderFrameHostManager* manager = NULL; | |
43 if (frame_tree_node_->parent()) { | |
44 manager = frame_tree_node_->parent()->render_manager(); | |
45 } | |
ncarter (slow)
2014/07/21 20:31:57
These lines seem to have no effect.
kenrb
2014/07/24 17:53:53
Removed.
| |
39 } | 46 } |
40 | 47 |
41 RenderFrameProxyHost::~RenderFrameProxyHost() { | 48 RenderFrameProxyHost::~RenderFrameProxyHost() { |
42 if (GetProcess()->HasConnection()) | 49 if (GetProcess()->HasConnection()) |
43 Send(new FrameMsg_DeleteProxy(routing_id_)); | 50 Send(new FrameMsg_DeleteProxy(routing_id_)); |
44 | 51 |
45 GetProcess()->RemoveRoute(routing_id_); | 52 GetProcess()->RemoveRoute(routing_id_); |
46 } | 53 } |
47 | 54 |
48 void RenderFrameProxyHost::SetChildRWHView(RenderWidgetHostView* view) { | 55 void RenderFrameProxyHost::SetChildRWHView(RenderWidgetHostView* view) { |
(...skipping 26 matching lines...) Expand all Loading... | |
75 return true; | 82 return true; |
76 | 83 |
77 // TODO(nasko): This can be removed once we don't have a swapped out state on | 84 // TODO(nasko): This can be removed once we don't have a swapped out state on |
78 // RenderFrameHosts. See https://crbug.com/357747. | 85 // RenderFrameHosts. See https://crbug.com/357747. |
79 if (render_frame_host_.get()) | 86 if (render_frame_host_.get()) |
80 return render_frame_host_->OnMessageReceived(msg); | 87 return render_frame_host_->OnMessageReceived(msg); |
81 | 88 |
82 return false; | 89 return false; |
83 } | 90 } |
84 | 91 |
92 bool RenderFrameProxyHost::InitRenderFrameProxy() { | |
93 // The process may (if we're sharing a process with another host that already | |
94 // initialized it) or may not (we have our own process or the old process | |
95 // crashed) have been initialized. Calling Init multiple times will be | |
96 // ignored, so this is safe. | |
97 if (!site_instance_->GetProcess()->Init()) | |
98 return false; | |
99 | |
100 DCHECK(GetProcess()->HasConnection()); | |
101 DCHECK(GetProcess()->GetBrowserContext()); | |
ncarter (slow)
2014/07/21 20:31:57
This DCHECK can be dropped; from what I can tell a
kenrb
2014/07/24 17:53:53
Removed.
| |
102 | |
103 int parent_routing_id = MSG_ROUTING_NONE; | |
104 if (frame_tree_node_->parent()) { | |
105 parent_routing_id = frame_tree_node_->parent()->render_manager()-> | |
106 GetRoutingIdForSiteInstance(site_instance_); | |
107 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE); | |
108 } | |
109 | |
110 Send(new FrameMsg_NewFrameProxy( | |
111 routing_id_, | |
112 parent_routing_id, | |
113 frame_tree_node_->frame_tree()->GetRenderViewHost( | |
114 site_instance_)->GetRoutingID())); | |
115 | |
116 return true; | |
117 } | |
118 | |
85 } // namespace content | 119 } // namespace content |
OLD | NEW |