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..0887159ddecdfa5acd8955b7719a670dc7192825 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; |
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,11 +367,25 @@ 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 if needed. |
+ 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); |
+ // PlzNavigate |
+ // Returns the speculative RenderFrameHost, or NULL if there is no pending |
+ // one. |
+ RenderFrameHostImpl* speculative_render_frame_host() const { |
+ return speculative_render_frame_host_.get(); |
+ } |
+ |
private: |
friend class RenderFrameHostManagerTest; |
friend class TestWebContents; |
@@ -416,21 +435,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 +482,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 destroyed later if the final navigation |
+ // 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 +514,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 which |
+ // 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 be 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 +635,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); |
}; |