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

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

Issue 1722623003: PlzNavigate: use RenderFrameHostImpl::IsRendererTransferNeededForNavigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation-policy
Patch Set: Created 4 years, 9 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 scoped_refptr<SiteInstance> dest_site_instance = GetSiteInstanceForNavigation( 805 scoped_refptr<SiteInstance> dest_site_instance = GetSiteInstanceForNavigation(
806 request.common_params().url, request.source_site_instance(), 806 request.common_params().url, request.source_site_instance(),
807 request.dest_site_instance(), candidate_site_instance, 807 request.dest_site_instance(), candidate_site_instance,
808 request.common_params().transition, 808 request.common_params().transition,
809 request.restore_type() != NavigationEntryImpl::RESTORE_NONE, 809 request.restore_type() != NavigationEntryImpl::RESTORE_NONE,
810 request.is_view_source()); 810 request.is_view_source());
811 811
812 // The appropriate RenderFrameHost to commit the navigation. 812 // The appropriate RenderFrameHost to commit the navigation.
813 RenderFrameHostImpl* navigation_rfh = nullptr; 813 RenderFrameHostImpl* navigation_rfh = nullptr;
814 814
815 // Renderer-initiated main frame navigations that may require a SiteInstance
816 // swap are sent to the browser via the OpenURL IPC and are afterwards treated
817 // as browser-initiated navigations. NavigationRequests marked as
818 // renderer-initiated are created by receiving a BeginNavigation IPC, and will
819 // then proceed in the same renderer that sent the IPC due to the condition
820 // below.
821 // Subframe navigations will use the current renderer, unless
822 // --site-per-process is enabled.
823 // TODO(carlosk): Have renderer-initated main frame navigations swap processes
824 // if needed when it no longer breaks OAuth popups (see
825 // https://crbug.com/440266).
826 bool is_main_frame = frame_tree_node_->IsMainFrame();
827 bool notify_webui_of_rv_creation = false; 815 bool notify_webui_of_rv_creation = false;
828 if (current_site_instance == dest_site_instance.get() ||
829 (!request.browser_initiated() && is_main_frame) ||
830 (!is_main_frame && !dest_site_instance->RequiresDedicatedProcess() &&
831 !current_site_instance->RequiresDedicatedProcess())) {
832 // Reuse the current RenderFrameHost if its SiteInstance matches the
833 // navigation's or if this is a subframe navigation. We only swap
834 // RenderFrameHosts for subframes when --site-per-process is enabled.
835 816
817 // Reuse the current RenderFrameHost if its SiteInstance matches the
818 // navigation's.
819 bool no_renderer_swap = current_site_instance == dest_site_instance.get();
820 if (SiteIsolationPolicy::AreCrossProcessFramesPossible()) {
821 // Check if the current renderer should be changed for the navigation.
822 no_renderer_swap |=
823 !IsRendererTransferNeededForNavigation(render_frame_host_.get(),
824 request.common_params().url) &&
825 ShouldMakeNetworkRequestForURL(request.common_params().url);
nasko 2016/02/25 20:04:44 nit: Let's swap the order of these two calls. Shou
clamy 2016/02/26 13:51:02 Done. I also noted that we were preventing transfe
826 } else {
827 // Subframe navigations will use the current renderer.
828 no_renderer_swap |= !frame_tree_node_->IsMainFrame();
829
830 // Renderer-initiated main frame navigations that may require a
831 // SiteInstance swap are sent to the browser via the OpenURL IPC and are
832 // afterwards treated as browser-initiated navigations. NavigationRequests
833 // marked as renderer-initiated are created by receiving a BeginNavigation
834 // IPC, and will then proceed in the same renderer that sent the IPC due to
835 // the condition below.
836 // TODO(carlosk): Have renderer-initated main frame navigations swap
837 // processes if needed when it no longer breaks OAuth popups (see
838 // https://crbug.com/440266).
839 no_renderer_swap |= !request.browser_initiated();
840 }
841 if (no_renderer_swap) {
nasko 2016/02/25 20:04:44 nit: Empty line before the if statement.
clamy 2016/02/26 13:51:02 Done.
836 // GetFrameHostForNavigation will be called more than once during a 842 // GetFrameHostForNavigation will be called more than once during a
837 // navigation (currently twice, on request and when it's about to commit in 843 // navigation (currently twice, on request and when it's about to commit in
838 // the renderer). In the follow up calls an existing pending WebUI should 844 // the renderer). In the follow up calls an existing pending WebUI should
839 // not be recreated if the URL didn't change. So instead of calling 845 // not be recreated if the URL didn't change. So instead of calling
840 // CleanUpNavigation just discard the speculative RenderFrameHost if one 846 // CleanUpNavigation just discard the speculative RenderFrameHost if one
841 // exists. 847 // exists.
842 if (speculative_render_frame_host_) 848 if (speculative_render_frame_host_)
843 DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost()); 849 DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost());
844 850
845 UpdatePendingWebUIOnCurrentFrameHost(request.common_params().url, 851 UpdatePendingWebUIOnCurrentFrameHost(request.common_params().url,
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after
2509 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { 2515 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) {
2510 if (!frame_tree_node_->opener()) 2516 if (!frame_tree_node_->opener())
2511 return MSG_ROUTING_NONE; 2517 return MSG_ROUTING_NONE;
2512 2518
2513 return frame_tree_node_->opener() 2519 return frame_tree_node_->opener()
2514 ->render_manager() 2520 ->render_manager()
2515 ->GetRoutingIdForSiteInstance(instance); 2521 ->GetRoutingIdForSiteInstance(instance);
2516 } 2522 }
2517 2523
2518 } // namespace content 2524 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698