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

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

Issue 1138413002: OOPIF: Don't resurrect a dead process just to create proxies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Nasko's feedback Created 5 years, 7 months 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
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_proxy_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 SiteInstance* old_instance, 1339 SiteInstance* old_instance,
1340 SiteInstance* new_instance, 1340 SiteInstance* new_instance,
1341 bool is_main_frame) { 1341 bool is_main_frame) {
1342 int create_render_frame_flags = 0; 1342 int create_render_frame_flags = 0;
1343 if (is_main_frame) 1343 if (is_main_frame)
1344 create_render_frame_flags |= CREATE_RF_FOR_MAIN_FRAME_NAVIGATION; 1344 create_render_frame_flags |= CREATE_RF_FOR_MAIN_FRAME_NAVIGATION;
1345 1345
1346 if (delegate_->IsHidden()) 1346 if (delegate_->IsHidden())
1347 create_render_frame_flags |= CREATE_RF_HIDDEN; 1347 create_render_frame_flags |= CREATE_RF_HIDDEN;
1348 1348
1349 // The process for the new SiteInstance may (if we're sharing a process with
1350 // another host that already initialized it) or may not (we have our own
1351 // process or the old process crashed) have been initialized. Calling Init
nasko 2015/05/14 22:10:52 nit: s/old/existing/
alexmos 2015/05/14 22:54:16 Done.
1352 // multiple times will be ignored, so this is safe.
1353 new_instance->GetProcess()->Init();
alexmos 2015/05/14 22:02:50 Should I also return early here if this fails? Cr
nasko 2015/05/14 22:10:52 Returning early is probably desired. Looking at th
alexmos 2015/05/14 22:54:15 I added the early return and moved CancelPending t
1354
1349 int opener_route_id = CreateOpenerRenderViewsIfNeeded( 1355 int opener_route_id = CreateOpenerRenderViewsIfNeeded(
1350 old_instance, new_instance, &create_render_frame_flags); 1356 old_instance, new_instance, &create_render_frame_flags);
1351 1357
1352 if (pending_render_frame_host_) 1358 if (pending_render_frame_host_)
1353 CancelPending(); 1359 CancelPending();
1354 1360
1355 // Create a non-swapped-out RFH with the given opener. 1361 // Create a non-swapped-out RFH with the given opener.
1356 pending_render_frame_host_ = 1362 pending_render_frame_host_ =
1357 CreateRenderFrame(new_instance, pending_web_ui(), opener_route_id, 1363 CreateRenderFrame(new_instance, pending_web_ui(), opener_route_id,
1358 create_render_frame_flags, nullptr); 1364 create_render_frame_flags, nullptr);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 int bindings) { 1434 int bindings) {
1429 CHECK(new_instance); 1435 CHECK(new_instance);
1430 CHECK_NE(old_instance, new_instance); 1436 CHECK_NE(old_instance, new_instance);
1431 CHECK(!should_reuse_web_ui_); 1437 CHECK(!should_reuse_web_ui_);
1432 1438
1433 // Note: |speculative_web_ui_| must be initialized before starting the 1439 // Note: |speculative_web_ui_| must be initialized before starting the
1434 // |speculative_render_frame_host_| creation steps otherwise the WebUI 1440 // |speculative_render_frame_host_| creation steps otherwise the WebUI
1435 // won't be properly initialized. 1441 // won't be properly initialized.
1436 speculative_web_ui_ = CreateWebUI(url, bindings); 1442 speculative_web_ui_ = CreateWebUI(url, bindings);
1437 1443
1444 // The process for the new SiteInstance may (if we're sharing a process with
1445 // another host that already initialized it) or may not (we have our own
1446 // process or the old process crashed) have been initialized. Calling Init
1447 // multiple times will be ignored, so this is safe.
1448 if (!new_instance->GetProcess()->Init())
1449 return false;
1450
1438 int create_render_frame_flags = 0; 1451 int create_render_frame_flags = 0;
1439 int opener_route_id = 1452 int opener_route_id =
1440 CreateOpenerRenderViewsIfNeeded(old_instance, new_instance, 1453 CreateOpenerRenderViewsIfNeeded(old_instance, new_instance,
1441 &create_render_frame_flags); 1454 &create_render_frame_flags);
1442 1455
1443 if (frame_tree_node_->IsMainFrame()) 1456 if (frame_tree_node_->IsMainFrame())
1444 create_render_frame_flags |= CREATE_RF_FOR_MAIN_FRAME_NAVIGATION; 1457 create_render_frame_flags |= CREATE_RF_FOR_MAIN_FRAME_NAVIGATION;
1445 if (delegate_->IsHidden()) 1458 if (delegate_->IsHidden())
1446 create_render_frame_flags |= CREATE_RF_HIDDEN; 1459 create_render_frame_flags |= CREATE_RF_HIDDEN;
1447 speculative_render_frame_host_ = 1460 speculative_render_frame_host_ =
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
2118 void RenderFrameHostManager::DeleteRenderFrameProxyHost( 2131 void RenderFrameHostManager::DeleteRenderFrameProxyHost(
2119 SiteInstance* instance) { 2132 SiteInstance* instance) {
2120 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); 2133 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId());
2121 if (iter != proxy_hosts_.end()) { 2134 if (iter != proxy_hosts_.end()) {
2122 delete iter->second; 2135 delete iter->second;
2123 proxy_hosts_.erase(iter); 2136 proxy_hosts_.erase(iter);
2124 } 2137 }
2125 } 2138 }
2126 2139
2127 } // namespace content 2140 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_proxy_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698