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 7394628bcbf3136c133ebe367c0852818915106c..6d54f6c4476216cf6ef61439d0e2ceb79d0e5951 100644 |
| --- a/content/browser/frame_host/render_frame_host_manager.h |
| +++ b/content/browser/frame_host/render_frame_host_manager.h |
| @@ -20,20 +20,20 @@ |
| #include "content/public/common/referrer.h" |
| #include "ui/base/page_transition_types.h" |
| +struct FrameHostMsg_BeginNavigation_Params; |
|
nasko
2014/11/10 17:35:31
Why are these structs outside of the content names
clamy
2014/11/12 13:01:13
They are defined that way in frame_messages.h (and
carlosk
2014/11/13 14:40:26
Yes, that.
|
| struct FrameMsg_Navigate_Params; |
| namespace content { |
| class BrowserContext; |
| class CrossProcessFrameConnector; |
| class CrossSiteTransferringRequest; |
| -class InterstitialPageImpl; |
| class FrameTreeNode; |
| +class InterstitialPageImpl; |
| class NavigationControllerImpl; |
| class NavigationEntry; |
| class NavigationEntryImpl; |
| class RenderFrameHost; |
| class RenderFrameHostDelegate; |
| -class RenderFrameHost; |
| class RenderFrameHostImpl; |
| class RenderFrameHostManagerTest; |
| class RenderFrameProxyHost; |
| @@ -43,6 +43,7 @@ class RenderWidgetHostDelegate; |
| class RenderWidgetHostView; |
| class TestWebContents; |
| class WebUIImpl; |
| +struct CommonNavigationParams; |
| // Manages RenderFrameHosts for a FrameTreeNode. It maintains a |
| // current_frame_host() which is the content currently visible to the user. When |
| @@ -294,6 +295,10 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
| // Called when a renderer's frame navigates. |
| void DidNavigateFrame(RenderFrameHostImpl* render_frame_host); |
| + // PlzNavigate |
| + // Cleans up ongoing navigation data. |
| + void CancelNavigation(); |
| + |
| // Called when a renderer sets its opener to null. |
| void DidDisownOpener(RenderFrameHost* render_frame_host); |
| @@ -362,8 +367,15 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
| // RenderFrameHostManager. Returns MSG_ROUTING_NONE if none is found. |
| int GetRoutingIdForSiteInstance(SiteInstance* site_instance); |
| - // PlzNavigate: Called when a navigation is ready to commit, to select the |
| - // renderer that will commit it. |
| + // PlzNavigate |
| + // Notifies the RFHM that a navigation is about to begin so that it can |
| + // speculatively spawn a new renderer process. |
|
clamy
2014/11/12 13:01:13
nit: add "if needed" at the end of the comment.
carlosk
2014/11/13 14:40:26
Done.
|
| + void BeginNavigation(const FrameHostMsg_BeginNavigation_Params& params, |
| + const CommonNavigationParams& common_params); |
| + |
| + // PlzNavigate |
| + // Called when a navigation is ready to commit, to select the renderer that |
| + // will commit it. |
| RenderFrameHostImpl* GetFrameHostForNavigation(const GURL& url, |
| ui::PageTransition transition); |
| @@ -416,21 +428,32 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
| SiteInstance* dest_instance, |
| ui::PageTransition dest_transition, |
| bool dest_is_restore, |
| - bool dest_is_view_source_mode); |
| + bool dest_is_view_source_mode, |
| + bool create_unbounded_site_instance); |
| // 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. |dest_instance| will be used if it is not null. |
| // This is a helper function for GetSiteInstanceForNavigation. |
| - SiteInstance* GetSiteInstanceForURL( |
| - const GURL& dest_url, |
| - SiteInstance* dest_instance, |
| - ui::PageTransition dest_transition, |
| - bool dest_is_restore, |
| - bool dest_is_view_source_mode, |
| - SiteInstance* current_instance, |
| - bool force_browsing_instance_swap); |
| + SiteInstance* GetSiteInstanceForURL(const GURL& dest_url, |
| + SiteInstance* dest_instance, |
| + ui::PageTransition dest_transition, |
| + bool dest_is_restore, |
| + bool dest_is_view_source_mode, |
| + SiteInstance* current_instance, |
| + bool force_browsing_instance_swap, |
| + bool create_unbounded_site_instance); |
| + |
| + SiteInstance* CreateSiteInstanceForURL(BrowserContext* browser_context, |
| + const GURL& creation_url, |
| + bool create_unbounded_site_instance, |
| + SiteInstanceImpl* current_instance); |
| + |
| + SiteInstance* GetRelatedSiteInstanceForURL( |
| + SiteInstanceImpl* current_instance, |
| + const GURL& creation_url, |
| + bool create_unbounded_site_instance); |
| // Determines the appropriate url to use as the current url for SiteInstance |
| // selection. |
| @@ -452,6 +475,19 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
| bool swapped_out, |
| bool hidden); |
| + // PlzNavigate |
| + // Creates a new RenderFrameHost and does all required supporting work for the |
| + // speculative creation of a new renderer for an ongoing navigation request. |
| + // This RenderFrameHost might be later destroyed if the final navigation |
|
nasko
2014/11/10 17:35:32
nit: swap the ordering of "later" and "destroyed"
carlosk
2014/11/13 14:40:26
Done.
|
| + // destination doesn't match the initial one. |
| + bool CreateSpeculativeRenderFrameHost(const GURL& url, |
| + SiteInstance* old_instance, |
| + SiteInstance* new_instance); |
| + |
| + // PlzNavigate |
| + // Cleans up the date related to the speculative RenderFrameHost. |
| + void CleanUpSpeculativeRenderFrameHost(); |
| + |
| // Sets up the necessary state for a new RenderViewHost with the given opener, |
| // if necessary. It creates a RenderFrameProxy in the target renderer process |
| // with the given |proxy_routing_id|, which is used to route IPC messages when |
| @@ -471,13 +507,21 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
| // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this |
| // doesn't require the pending render_frame_host_ pointer to be non-NULL, |
| // since there could be Web UI switching as well. Call this for every commit. |
| - void CommitPending(); |
| + // With PlzNavigate enabled, |use_speculative_rfh| can be set to true what |
|
nasko
2014/11/10 17:35:32
nit: s/what/which/
carlosk
2014/11/13 14:40:26
Done.
|
| + // will cause the speculative RenderFrameHost to be the active one. |
| + void CommitPending(bool use_speculative_rfh); |
| // Runs the unload handler in the old RenderFrameHost, after the new |
| // RenderFrameHost has committed. |old_render_frame_host| will either be |
| // deleted or put on the pending delete list during this call. |
| void SwapOutOldFrame(scoped_ptr<RenderFrameHostImpl> old_render_frame_host); |
| + // Called to properly discard a created RenderFrameHost that was never made |
| + // active (for active ones SwapOutOldFrame is used instead). It can whether be |
|
nasko
2014/11/10 17:35:32
nit: s/whether//
carlosk
2014/11/13 14:40:26
Done.
|
| + // swapped out or fully destroyed. |
| + void RecycleRenderFrameHost( |
| + scoped_ptr<RenderFrameHostImpl> render_frame_host); |
| + |
| // Holds |render_frame_host| until it can be deleted when its swap out ACK |
| // arrives. |
| void MoveToPendingDeleteHosts( |
| @@ -584,6 +628,16 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
| base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
| + // PlzNavigate |
| + // Members to store the speculative RFH created upon starting a navigation |
| + // allowing the creation of the renderer process as early as possible. |
| + // Might be discarded later on if the final URL's SiteInstance doesn't match |
| + // what was assumed in the beginning. |
| + // Note: speculative RenderFrameHost is only used for PlzNavigate and pending |
| + // only for the regular navigation (not yet true, but will be). |
| + scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; |
| + scoped_ptr<WebUIImpl> speculative_web_ui_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
| }; |