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

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

Issue 946543003: PlzNavigate: have renderer-initiated navigations be same-process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed SiteInstance direct URL check from tests. Created 5 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 <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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance(); 713 SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance();
714 714
715 scoped_refptr<SiteInstance> dest_site_instance = GetSiteInstanceForNavigation( 715 scoped_refptr<SiteInstance> dest_site_instance = GetSiteInstanceForNavigation(
716 request.common_params().url, request.source_site_instance(), 716 request.common_params().url, request.source_site_instance(),
717 request.dest_site_instance(), request.common_params().transition, 717 request.dest_site_instance(), request.common_params().transition,
718 request.restore_type() != NavigationEntryImpl::RESTORE_NONE, 718 request.restore_type() != NavigationEntryImpl::RESTORE_NONE,
719 request.is_view_source()); 719 request.is_view_source());
720 // The appropriate RenderFrameHost to commit the navigation. 720 // The appropriate RenderFrameHost to commit the navigation.
721 RenderFrameHostImpl* navigation_rfh = nullptr; 721 RenderFrameHostImpl* navigation_rfh = nullptr;
722 722
723 // TODO(carlosk): do not swap processes for renderer initiated navigations 723 // Renderer-initiated navigations that may require a SiteInstance swap are
724 // (see crbug.com/440266). 724 // sent to the browser via the OpenURL IPC, and are afterwards treated as
nasko 2015/03/16 16:22:42 nit: No need for comma before "and".
carlosk 2015/03/16 17:25:00 Done.
725 // browser-initiated navigations. The only NavigationRequests marked as
nasko 2015/03/16 16:22:42 nit: s/The only//
carlosk 2015/03/16 17:25:00 Done.
726 // renderer-initiated are created by receiving a BeginNavigation IPC, and will
727 // then proceed in the same renderer that sent the IPC due to the condition
728 // below.
729 // TODO(carlosk): Once there is support for cross-process scripting check for
730 // non-browser-initiated navigations should be removed (see crbug.com/440266).
725 if (current_site_instance == dest_site_instance.get() || 731 if (current_site_instance == dest_site_instance.get() ||
732 !request.browser_initiated() ||
726 (!frame_tree_node_->IsMainFrame() && 733 (!frame_tree_node_->IsMainFrame() &&
727 !base::CommandLine::ForCurrentProcess()->HasSwitch( 734 !base::CommandLine::ForCurrentProcess()->HasSwitch(
728 switches::kSitePerProcess))) { 735 switches::kSitePerProcess))) {
729 // Reuse the current RFH if its SiteInstance matches the the navigation's 736 // Reuse the current RFH if its SiteInstance matches the the navigation's
730 // or if this is a subframe navigation. We only swap RFHs for subframes when 737 // or if this is a subframe navigation. We only swap RFHs for subframes when
731 // --site-per-process is enabled. 738 // --site-per-process is enabled.
732 CleanUpNavigation(); 739 CleanUpNavigation();
733 navigation_rfh = render_frame_host_.get(); 740 navigation_rfh = render_frame_host_.get();
734 741
735 // As SiteInstances are the same, check if the WebUI should be reused. 742 // As SiteInstances are the same, check if the WebUI should be reused.
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 void RenderFrameHostManager::DeleteRenderFrameProxyHost( 1969 void RenderFrameHostManager::DeleteRenderFrameProxyHost(
1963 SiteInstance* instance) { 1970 SiteInstance* instance) {
1964 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); 1971 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId());
1965 if (iter != proxy_hosts_.end()) { 1972 if (iter != proxy_hosts_.end()) {
1966 delete iter->second; 1973 delete iter->second;
1967 proxy_hosts_.erase(iter); 1974 proxy_hosts_.erase(iter);
1968 } 1975 }
1969 } 1976 }
1970 1977
1971 } // namespace content 1978 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698