Chromium Code Reviews| 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..7017274772c6a36f2d621170dd24c1fd11a479c9 100644 |
| --- a/content/browser/frame_host/render_frame_host_manager.h |
| +++ b/content/browser/frame_host/render_frame_host_manager.h |
| @@ -22,6 +22,10 @@ |
| struct FrameMsg_Navigate_Params; |
| +namespace { |
| +struct SiteInstanceDescriptor; |
|
carlosk
2015/03/23 14:31:18
Instead of the lose |out_params| I preferred creat
clamy
2015/03/23 15:26:44
Unnamed namespaces are forbidden in header files.
carlosk
2015/03/23 17:39:19
Done.
|
| +} |
| + |
| namespace content { |
| class BrowserContext; |
| class CrossProcessFrameConnector; |
| @@ -422,6 +426,13 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
| friend class RenderFrameHostManagerTest; |
| friend class TestWebContents; |
| + enum RenderFrameHostToUse { |
|
clamy
2015/03/23 15:26:44
This should be prefixed by a PlzNavigate comment t
carlosk
2015/03/23 17:39:19
Done. I also moved the friend-related macro below
|
| + INVALID, |
| + REUSE_CURRENT, |
| + NEW_SPECULATIVE, |
| + REUSE_SPECULATIVE, |
| + }; |
| + |
| FRIEND_TEST_ALL_PREFIXES(CrossProcessFrameTreeBrowserTest, |
| CreateCrossProcessSubframeProxies); |
| @@ -469,6 +480,13 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
| const NavigationEntry* current_entry, |
| const GURL& new_url) const; |
| + // PlzNavigate |
| + // Returns which RenderFrameHost should be used for the navigation among the |
| + // possibilities defined by RenderFrameHostToUse. |
| + scoped_refptr<SiteInstance> ChooseFrameHostForNavigation( |
| + const NavigationRequest& request, |
| + RenderFrameHostToUse* rfh_to_use); |
|
carlosk
2015/03/23 14:31:18
The added logic to reuse the speculative RFH made
clamy
2015/03/23 15:26:44
I don't like the signature of this method either,
carlosk
2015/03/23 17:39:19
What I think is nice about the two methods is that
|
| + |
| // Returns the SiteInstance to use for the navigation. |
| SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, |
|
clamy
2015/03/23 15:26:44
Is GetSiteInstanceForNavigation idempotent in the
carlosk
2015/03/23 17:39:19
GetSiteInstanceForNavigation is not idempotent as
|
| SiteInstance* source_instance, |
| @@ -477,25 +495,46 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
| 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| is a valid SiteInstance for a |
| + // navigation to |dest_url| given all the provided context. |
| + bool IsCorrectSiteInstanceForURL(SiteInstance* candidate_instance, |
| + const GURL& dest_url, |
| + SiteInstance* source_instance, |
| + SiteInstance* dest_instance, |
| + ui::PageTransition transition, |
| + bool dest_is_restore, |
| + bool dest_is_view_source_mode); |
| + |
| + // 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 |
| + // ShouldSwapBrowsingInstancesForNavigation. |
| + // |source_instance| is the SiteInstance of the frame that initiated the |
| + // navigation. |dest_instance|, is a predetermined SiteInstance |
| + // that'll be used if not null. Internally, |current_instance| is the |
| + // 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 |
| + // 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( |
|
clamy
2015/03/23 15:26:44
Why do we have a DetermineSiteInstanceForURL and a
carlosk
2015/03/23 17:39:19
I guess you are asking about the DetermineSiteInst
|
| + 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); |
|
carlosk
2015/03/23 14:31:18
I adapted this comment above so that it now fits w
|
| // Determines the appropriate url to use as the current url for SiteInstance |
| // selection. |