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

Unified Diff: content/browser/frame_host/render_frame_host_manager.h

Issue 967383002: PlzNavigate: Avoid duplicate SiteInstance creation during navigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merged GetSiteInstanceForNavigation with IsCorrectSiteInstanceForURL. 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_manager.h
diff --git a/content/browser/frame_host/render_frame_host_manager.h b/content/browser/frame_host/render_frame_host_manager.h
index f7c15e2bc63fbb2a350fbb1981a4dac184927def..4ac6e3f737cf192d5508e9d5457b2541a6fbdf9a 100644
--- a/content/browser/frame_host/render_frame_host_manager.h
+++ b/content/browser/frame_host/render_frame_host_manager.h
@@ -425,6 +425,36 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver {
FRIEND_TEST_ALL_PREFIXES(CrossProcessFrameTreeBrowserTest,
CreateCrossProcessSubframeProxies);
+ // PlzNavigate
+ enum RenderFrameHostToUse {
+ INVALID,
+ REUSE_CURRENT,
+ NEW_SPECULATIVE,
+ REUSE_SPECULATIVE,
+ };
+
+ // Stores information regarding a SiteInstance targeted at a specific URL. It
+ // can whether point to an existent one or store the details needed to create
Charlie Reis 2015/03/25 00:09:25 nit: can point (drop "whether") s/existent/existi
carlosk 2015/03/30 14:37:38 Done.
+ // a new one.
+ struct SiteInstanceDescriptor {
+ explicit SiteInstanceDescriptor(content::SiteInstance* site_instance)
+ : existent_site_instance(site_instance),
+ new_site_is_related_to_current(false) {}
+
+ SiteInstanceDescriptor(GURL site_url, bool related_to_current)
+ : existent_site_instance(nullptr),
+ new_site_url(site_url),
+ new_site_is_related_to_current(related_to_current) {}
+
+ // Set with an existent SiteInstance to be reused.
+ content::SiteInstance* existent_site_instance;
+ // In case |existent_site_instance| is null, specify a new site URL.
+ GURL new_site_url;
+ // In case |existent_site_instance| is null, specify if the new site should
+ // be created in new BrowsingInstance or not.
+ bool new_site_is_related_to_current;
Charlie Reis 2015/03/25 00:09:26 "site" doesn't fit well in this name. This descri
carlosk 2015/03/30 14:37:38 Done.
+ };
+
// Used with FrameTree::ForEach to erase RenderFrameProxyHosts from a
// FrameTreeNode's RenderFrameHostManager.
static bool ClearProxiesInSiteInstance(int32 site_instance_id,
@@ -473,29 +503,46 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver {
SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url,
SiteInstance* source_instance,
SiteInstance* dest_instance,
+ SiteInstance* candidate_instance,
ui::PageTransition transition,
bool dest_is_restore,
bool dest_is_view_source_mode);
- // Returns an appropriate SiteInstance object for the given |dest_url|,
- // possibly reusing the current SiteInstance. If --process-per-tab is used,
- // this is only called when ShouldSwapBrowsingInstancesForNavigation returns
- // true. |source_instance| is the SiteInstance of the frame that initiated the
- // navigation. |current_instance| is the SiteInstance of the frame that is
- // currently navigating. |dest_instance|, is a predetermined SiteInstance
- // that'll be used if not null.
+ // PlzNavigate
+ // Returns true if |candidate_instance| confirms to the SiteInstance specified
Charlie Reis 2015/03/25 00:09:25 "confirms to" isn't grammatically correct. "match
carlosk 2015/03/30 14:37:38 It was a typo: I meant to write "conforms". But "m
+ // by |descriptor|.
+ bool SiteInstanceMatchesDescription(SiteInstance* candidate_instance,
carlosk 2015/03/24 15:30:06 I wanted to move this method into an unnamed names
Charlie Reis 2015/03/25 00:09:25 Please keep SiteInstanceDescriptor private.
carlosk 2015/03/30 14:37:38 Acknowledged.
+ const SiteInstanceDescriptor& descriptor);
+
+ // Returns a descriptor of the appropriate SiteInstance object for the given
+ // |dest_url|, possibly reusing the current, source or destination
+ // SiteInstance. It will check ShouldTransitionCrossSite and
Charlie Reis 2015/03/25 00:09:25 This second sentence is an implementation detail a
carlosk 2015/03/30 14:37:38 Done.
+ // ShouldSwapBrowsingInstancesForNavigation.
+ // |source_instance| is the SiteInstance of the frame that initiated the
Charlie Reis 2015/03/25 00:09:25 nit: Add an empty comment line above this.
carlosk 2015/03/30 14:37:38 Done.
+ // navigation. |dest_instance|, is a predetermined SiteInstance
Charlie Reis 2015/03/25 00:09:25 Remove comma.
carlosk 2015/03/30 14:37:38 Done.
+ // that'll be used if not null. Internally, |current_instance| is the
Charlie Reis 2015/03/25 00:09:25 that'll -> that will
carlosk 2015/03/30 14:37:38 Done.
+ // SiteInstance of the frame that is currently navigating.
// For example, if you have a parent frame A, which has a child frame B, and
// A is trying to change the src attribute of B, this will cause a navigation
// where the source SiteInstance is A and B is the current SiteInstance.
- // This is a helper function for GetSiteInstanceForNavigation.
- SiteInstance* GetSiteInstanceForURL(const GURL& dest_url,
- SiteInstance* source_instance,
- SiteInstance* current_instance,
- SiteInstance* dest_instance,
- ui::PageTransition transition,
- bool dest_is_restore,
- bool dest_is_view_source_mode,
- bool force_browsing_instance_swap);
+ // This is a helper function for GetSiteInstanceForNavigation and
Charlie Reis 2015/03/25 00:09:26 nit: Add an empty comment line above this.
carlosk 2015/03/30 14:37:38 Done.
+ // IsCorrectSiteInstanceForURL.
+ SiteInstanceDescriptor DetermineSiteInstanceForURL(
+ const GURL& dest_url,
+ SiteInstance* source_instance,
+ SiteInstance* dest_instance,
+ ui::PageTransition transition,
+ bool dest_is_restore,
+ bool dest_is_view_source_mode);
+ SiteInstanceDescriptor DetermineSiteInstanceForURLInternal(
Charlie Reis 2015/03/25 00:09:25 These functions are already private internal detai
carlosk 2015/03/30 14:37:38 I explained this here: https://codereview.chromium
+ const GURL& dest_url,
+ SiteInstance* source_instance,
+ SiteInstance* current_instance,
+ SiteInstance* dest_instance,
+ ui::PageTransition transition,
+ bool dest_is_restore,
+ bool dest_is_view_source_mode,
+ bool force_browsing_instance_swap);
// Determines the appropriate url to use as the current url for SiteInstance
// selection.

Powered by Google App Engine
This is Rietveld 408576698