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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "content/browser/bad_message.h" | 8 #include "content/browser/bad_message.h" |
9 #include "content/browser/frame_host/cross_process_frame_connector.h" | 9 #include "content/browser/frame_host/cross_process_frame_connector.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach) | 122 IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach) |
123 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) | 123 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) |
124 IPC_MESSAGE_HANDLER(FrameHostMsg_RouteMessageEvent, OnRouteMessageEvent) | 124 IPC_MESSAGE_HANDLER(FrameHostMsg_RouteMessageEvent, OnRouteMessageEvent) |
125 IPC_MESSAGE_UNHANDLED(handled = false) | 125 IPC_MESSAGE_UNHANDLED(handled = false) |
126 IPC_END_MESSAGE_MAP() | 126 IPC_END_MESSAGE_MAP() |
127 return handled; | 127 return handled; |
128 } | 128 } |
129 | 129 |
130 bool RenderFrameProxyHost::InitRenderFrameProxy() { | 130 bool RenderFrameProxyHost::InitRenderFrameProxy() { |
131 DCHECK(!render_frame_proxy_created_); | 131 DCHECK(!render_frame_proxy_created_); |
132 // The process may (if we're sharing a process with another host that already | 132 |
133 // initialized it) or may not (we have our own process or the old process | 133 // It is possible to reach this when the process is dead (in particular, when |
134 // crashed) have been initialized. Calling Init multiple times will be | 134 // creating proxies from CreateProxiesForChildFrame). In that case, don't |
135 // ignored, so this is safe. | 135 // create the proxy. The process shouldn't be resurrected just to create |
136 if (!GetProcess()->Init()) | 136 // RenderFrameProxies; it should be restored only if it needs to host a |
137 // RenderFrame. In that case, CreateRenderView will reinitialize the | |
nasko
2015/05/14 21:26:29
As we are trying to kill off RenderView, having Cr
alexmos
2015/05/14 22:02:50
Done.
| |
138 // process, and all necessary proxies, including any of the ones we skipped | |
139 // here, will be created by CreateProxiesForSiteInstance. See | |
140 // https://crbug.com/476846 | |
141 if (!GetProcess()->HasConnection()) | |
137 return false; | 142 return false; |
138 | 143 |
139 DCHECK(GetProcess()->HasConnection()); | |
140 | |
141 int parent_routing_id = MSG_ROUTING_NONE; | 144 int parent_routing_id = MSG_ROUTING_NONE; |
142 if (frame_tree_node_->parent()) { | 145 if (frame_tree_node_->parent()) { |
143 parent_routing_id = frame_tree_node_->parent() | 146 RenderFrameProxyHost* parent_proxy = |
144 ->render_manager() | 147 frame_tree_node_->parent()->render_manager()->GetRenderFrameProxyHost( |
alexmos
2015/05/14 17:01:43
Using GetRenderFrameProxyHost instead of GetRoutin
nasko
2015/05/14 21:26:29
This is a very good observation. Let's put that in
alexmos
2015/05/14 22:02:50
Done.
| |
145 ->GetRoutingIdForSiteInstance(site_instance_.get()); | 148 site_instance_.get()); |
149 CHECK(parent_proxy); | |
150 // When this is called, the parent RenderFrameProxy should already exist. | |
151 // The FrameNew_NewFrameProxy will crash on the renderer side if there's no | |
152 // parent proxy. | |
153 DCHECK(parent_proxy->is_render_frame_proxy_live()); | |
alexmos
2015/05/14 17:01:42
I don't think we need my previous recursively-init
nasko
2015/05/14 21:26:29
Acknowledged.
alexmos
2015/05/14 22:02:50
I also converted this DCHECK to a CHECK. (This sh
| |
154 parent_routing_id = parent_proxy->GetRoutingID(); | |
146 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE); | 155 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE); |
147 } | 156 } |
148 | 157 |
149 Send(new FrameMsg_NewFrameProxy(routing_id_, | 158 Send(new FrameMsg_NewFrameProxy(routing_id_, |
150 parent_routing_id, | 159 parent_routing_id, |
151 frame_tree_node_->frame_tree() | 160 frame_tree_node_->frame_tree() |
152 ->GetRenderViewHost(site_instance_.get()) | 161 ->GetRenderViewHost(site_instance_.get()) |
153 ->GetRoutingID(), | 162 ->GetRoutingID(), |
154 frame_tree_node_ | 163 frame_tree_node_ |
155 ->current_replication_state())); | 164 ->current_replication_state())); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 base::Bind(&MessagePortMessageFilter::RouteMessageEventWithMessagePorts, | 265 base::Bind(&MessagePortMessageFilter::RouteMessageEventWithMessagePorts, |
257 message_port_message_filter, target_rfh->GetRoutingID(), | 266 message_port_message_filter, target_rfh->GetRoutingID(), |
258 new_params)); | 267 new_params)); |
259 } else { | 268 } else { |
260 target_rfh->Send( | 269 target_rfh->Send( |
261 new FrameMsg_PostMessageEvent(target_rfh->GetRoutingID(), new_params)); | 270 new FrameMsg_PostMessageEvent(target_rfh->GetRoutingID(), new_params)); |
262 } | 271 } |
263 } | 272 } |
264 | 273 |
265 } // namespace content | 274 } // namespace content |
OLD | NEW |