Chromium Code Reviews| 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/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2312 | 2312 |
| 2313 RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate( | 2313 RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate( |
| 2314 const GURL& dest_url, | 2314 const GURL& dest_url, |
| 2315 SiteInstance* source_instance, | 2315 SiteInstance* source_instance, |
| 2316 SiteInstance* dest_instance, | 2316 SiteInstance* dest_instance, |
| 2317 ui::PageTransition transition, | 2317 ui::PageTransition transition, |
| 2318 bool dest_is_restore, | 2318 bool dest_is_restore, |
| 2319 bool dest_is_view_source_mode, | 2319 bool dest_is_view_source_mode, |
| 2320 const GlobalRequestID& transferred_request_id, | 2320 const GlobalRequestID& transferred_request_id, |
| 2321 int bindings) { | 2321 int bindings) { |
| 2322 // Don't swap for subframes unless we are in --site-per-process. We can get | 2322 if (!frame_tree_node_->IsMainFrame()) { |
| 2323 // here in tests for subframes (e.g., NavigateFrameToURL). | 2323 // Don't swap for subframes unless we are in an OOPIF-enabled mode. We can |
| 2324 if (!frame_tree_node_->IsMainFrame() && | 2324 // get here in tests for subframes (e.g., NavigateFrameToURL). |
| 2325 !SiteIsolationPolicy::AreCrossProcessFramesPossible()) { | 2325 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) |
| 2326 return render_frame_host_.get(); | 2326 return render_frame_host_.get(); |
| 2327 | |
| 2328 // If we are in an OOPIF mode that only applies to some sites, only swap if | |
| 2329 // the policy determines that a transfer would have been needed. We can get | |
| 2330 // here for session restore. | |
|
ncarter (slow)
2015/12/08 22:16:17
Maybe move these 3 comment lines down to just befo
| |
| 2331 // 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"
| |
| 2332 // for a swap is determined by the source_instance. | |
| 2333 GURL resolved_url = dest_url; | |
| 2334 if (url::Origin(resolved_url).unique()) { | |
| 2335 // If there is no source_instance for a unique origin, then we should | |
| 2336 // avoid a process swap. | |
| 2337 if (!source_instance) | |
| 2338 return render_frame_host_.get(); | |
| 2339 | |
| 2340 // Use source_instance to determine if a swap is needed. | |
| 2341 resolved_url = source_instance->GetSiteURL(); | |
| 2342 } | |
| 2343 if (!IsRendererTransferNeededForNavigation(render_frame_host_.get(), | |
| 2344 resolved_url)) { | |
| 2345 DCHECK(!dest_instance || | |
| 2346 dest_instance == render_frame_host_->GetSiteInstance()); | |
| 2347 return render_frame_host_.get(); | |
| 2348 } | |
| 2327 } | 2349 } |
| 2328 | 2350 |
| 2329 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); | 2351 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); |
| 2330 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation( | 2352 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation( |
| 2331 dest_url, source_instance, dest_instance, nullptr, transition, | 2353 dest_url, source_instance, dest_instance, nullptr, transition, |
| 2332 dest_is_restore, dest_is_view_source_mode); | 2354 dest_is_restore, dest_is_view_source_mode); |
| 2333 | 2355 |
| 2334 // If we are currently navigating cross-process to a pending RFH for a | 2356 // If we are currently navigating cross-process to a pending RFH for a |
| 2335 // different SiteInstance, we want to get back to normal and then navigate as | 2357 // different SiteInstance, we want to get back to normal and then navigate as |
| 2336 // usual. We will reuse the pending RFH below if it matches the destination | 2358 // usual. We will reuse the pending RFH below if it matches the destination |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2660 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { | 2682 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { |
| 2661 if (!frame_tree_node_->opener()) | 2683 if (!frame_tree_node_->opener()) |
| 2662 return MSG_ROUTING_NONE; | 2684 return MSG_ROUTING_NONE; |
| 2663 | 2685 |
| 2664 return frame_tree_node_->opener() | 2686 return frame_tree_node_->opener() |
| 2665 ->render_manager() | 2687 ->render_manager() |
| 2666 ->GetRoutingIdForSiteInstance(instance); | 2688 ->GetRoutingIdForSiteInstance(instance); |
| 2667 } | 2689 } |
| 2668 | 2690 |
| 2669 } // namespace content | 2691 } // namespace content |
| OLD | NEW |