OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_tree.h" | 5 #include "content/browser/frame_host/frame_tree.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 | 197 |
198 void FrameTree::CreateProxiesForSiteInstance( | 198 void FrameTree::CreateProxiesForSiteInstance( |
199 FrameTreeNode* source, | 199 FrameTreeNode* source, |
200 SiteInstance* site_instance) { | 200 SiteInstance* site_instance) { |
201 // Create the swapped out RVH for the new SiteInstance. This will create | 201 // Create the swapped out RVH for the new SiteInstance. This will create |
202 // a top-level swapped out RFH as well, which will then be wrapped by a | 202 // a top-level swapped out RFH as well, which will then be wrapped by a |
203 // RenderFrameProxyHost. | 203 // RenderFrameProxyHost. |
204 if (!source->IsMainFrame()) { | 204 if (!source->IsMainFrame()) { |
205 RenderViewHostImpl* render_view_host = | 205 RenderViewHostImpl* render_view_host = |
206 source->frame_tree()->GetRenderViewHost(site_instance); | 206 source->frame_tree()->GetRenderViewHost(site_instance); |
207 if (!render_view_host) { | 207 if (!render_view_host || !render_view_host->IsRenderViewLive()) { |
208 root()->render_manager()->CreateRenderFrame( | 208 root()->render_manager()->CreateRenderFrame( |
209 site_instance, nullptr, MSG_ROUTING_NONE, | 209 site_instance, nullptr, MSG_ROUTING_NONE, |
210 CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN, nullptr); | 210 CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN, nullptr); |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 scoped_refptr<SiteInstance> instance(site_instance); | 214 scoped_refptr<SiteInstance> instance(site_instance); |
215 | 215 |
216 // Proxies are created in the FrameTree in response to a node navigating to a | 216 // Proxies are created in the FrameTree in response to a node navigating to a |
217 // new SiteInstance. Since |source|'s navigation will replace the currently | 217 // new SiteInstance. Since |source|'s navigation will replace the currently |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 bool hidden) { | 258 bool hidden) { |
259 DCHECK(main_frame_routing_id != MSG_ROUTING_NONE); | 259 DCHECK(main_frame_routing_id != MSG_ROUTING_NONE); |
260 RenderViewHostMap::iterator iter = | 260 RenderViewHostMap::iterator iter = |
261 render_view_host_map_.find(site_instance->GetId()); | 261 render_view_host_map_.find(site_instance->GetId()); |
262 if (iter != render_view_host_map_.end()) { | 262 if (iter != render_view_host_map_.end()) { |
263 // If a RenderViewHost's main frame is pending deletion for this | 263 // If a RenderViewHost's main frame is pending deletion for this |
264 // |site_instance|, put it in the map of RenderViewHosts pending shutdown. | 264 // |site_instance|, put it in the map of RenderViewHosts pending shutdown. |
265 // Otherwise return the existing RenderViewHost for the SiteInstance. | 265 // Otherwise return the existing RenderViewHost for the SiteInstance. |
266 RenderFrameHostImpl* main_frame = static_cast<RenderFrameHostImpl*>( | 266 RenderFrameHostImpl* main_frame = static_cast<RenderFrameHostImpl*>( |
267 iter->second->GetMainFrame()); | 267 iter->second->GetMainFrame()); |
268 if (main_frame->frame_tree_node()->render_manager()->IsPendingDeletion( | 268 // |main_frame| is NULL when the RVH is uninitialized. |
269 main_frame)) { | 269 if (main_frame && |
270 main_frame->frame_tree_node()->render_manager()->IsPendingDeletion( | |
271 main_frame)) { | |
270 render_view_host_pending_shutdown_map_.insert( | 272 render_view_host_pending_shutdown_map_.insert( |
271 std::pair<int, RenderViewHostImpl*>(site_instance->GetId(), | 273 std::pair<int, RenderViewHostImpl*>(site_instance->GetId(), |
272 iter->second)); | 274 iter->second)); |
273 render_view_host_map_.erase(iter); | 275 render_view_host_map_.erase(iter); |
274 } else { | 276 } else { |
275 return iter->second; | 277 return iter->second; |
lazyboy
2014/12/11 01:29:48
Trying to reuse the RVH fails after the frame tree
| |
276 } | 278 } |
277 } | 279 } |
278 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 280 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
279 RenderViewHostFactory::Create(site_instance, | 281 RenderViewHostFactory::Create(site_instance, |
280 render_view_delegate_, | 282 render_view_delegate_, |
281 render_widget_delegate_, | 283 render_widget_delegate_, |
282 routing_id, | 284 routing_id, |
283 main_frame_routing_id, | 285 main_frame_routing_id, |
284 swapped_out, | 286 swapped_out, |
285 hidden)); | 287 hidden)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
347 rvh->Shutdown(); | 349 rvh->Shutdown(); |
348 render_view_host_pending_shutdown_map_.erase(multi_iter); | 350 render_view_host_pending_shutdown_map_.erase(multi_iter); |
349 } | 351 } |
350 break; | 352 break; |
351 } | 353 } |
352 CHECK(render_view_host_found); | 354 CHECK(render_view_host_found); |
353 } | 355 } |
354 } | 356 } |
355 | 357 |
356 } // namespace content | 358 } // namespace content |
OLD | NEW |