Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Side by Side Diff: content/browser/frame_host/frame_tree.cc

Issue 782093002: Ensure that before creating proxy of site A, RVH of site A is initialized. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Create new RVH instead of re-using + Add test Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(
Charlie Reis 2014/12/12 19:18:31 I took a closer look, and now I'm not sure this is
nasko 2014/12/12 22:25:01 I agree we shouldn't be calling CreateRenderFrame.
lazyboy 2014/12/16 07:10:04 For context about uninitialized RVH: 1 / \ 2
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
218 // loaded document, the entire subtree under |source| will be removed. 218 // loaded document, the entire subtree under |source| will be removed.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
nasko 2014/12/12 22:25:01 What sequence of events causes uninitialized RVH t
lazyboy 2014/12/23 22:03:11 Since we keep around the proxy (with swapped out r
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;
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,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | content/browser/site_per_process_browsertest.cc » ('j') | content/browser/site_per_process_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698