Chromium Code Reviews| Index: content/browser/frame_host/render_frame_host_manager.cc |
| diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc |
| index dab752ccce8ef6062353966fc765bb3091c2e4f1..6cf147c2f381f3326dfc6934cd8218eba93f574c 100644 |
| --- a/content/browser/frame_host/render_frame_host_manager.cc |
| +++ b/content/browser/frame_host/render_frame_host_manager.cc |
| @@ -2319,11 +2319,33 @@ RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate( |
| bool dest_is_view_source_mode, |
| const GlobalRequestID& transferred_request_id, |
| int bindings) { |
| - // Don't swap for subframes unless we are in --site-per-process. We can get |
| - // here in tests for subframes (e.g., NavigateFrameToURL). |
| - if (!frame_tree_node_->IsMainFrame() && |
| - !SiteIsolationPolicy::AreCrossProcessFramesPossible()) { |
| - return render_frame_host_.get(); |
| + if (!frame_tree_node_->IsMainFrame()) { |
| + // Don't swap for subframes unless we are in an OOPIF-enabled mode. We can |
| + // get here in tests for subframes (e.g., NavigateFrameToURL). |
| + if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) |
| + return render_frame_host_.get(); |
| + |
| + // If we are in an OOPIF mode that only applies to some sites, only swap if |
| + // the policy determines that a transfer would have been needed. We can get |
| + // here for session restore. |
|
ncarter (slow)
2015/12/08 22:16:17
Maybe move these 3 comment lines down to just befo
|
| + // Note that if dest_url is a unique origin like about:blank, then the need |
|
ncarter (slow)
2015/12/08 22:16:17
drop "Note that"
|
| + // for a swap is determined by the source_instance. |
| + GURL resolved_url = dest_url; |
| + if (url::Origin(resolved_url).unique()) { |
| + // If there is no source_instance for a unique origin, then we should |
| + // avoid a process swap. |
| + if (!source_instance) |
| + return render_frame_host_.get(); |
| + |
| + // Use source_instance to determine if a swap is needed. |
| + resolved_url = source_instance->GetSiteURL(); |
| + } |
| + if (!IsRendererTransferNeededForNavigation(render_frame_host_.get(), |
| + resolved_url)) { |
| + DCHECK(!dest_instance || |
| + dest_instance == render_frame_host_->GetSiteInstance()); |
| + return render_frame_host_.get(); |
| + } |
| } |
| SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); |