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 3b80d6304c89347ee86018c36e53f56f4acd543c..bf1a6f534b8d055ddc48c8012bdffb359d69a6da 100644 |
--- a/content/browser/frame_host/render_frame_host_manager.h |
+++ b/content/browser/frame_host/render_frame_host_manager.h |
@@ -31,6 +31,7 @@ class InterstitialPageImpl; |
class NavigationControllerImpl; |
class NavigationEntry; |
class NavigationEntryImpl; |
+class NavigatorTestWithBrowserSideNavigation; |
class RenderFrameHost; |
class RenderFrameHostDelegate; |
class RenderFrameHostImpl; |
@@ -42,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 |
@@ -289,7 +291,8 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
// Called when a renderer's frame navigates. |
void DidNavigateFrame(RenderFrameHostImpl* render_frame_host, |
- bool was_caused_by_user_gesture); |
+ bool was_caused_by_user_gesture, |
+ bool was_within_same_page); |
nasko
2015/01/06 00:03:18
Why is this parameter added? It isn't used anywher
carlosk
2015/01/08 16:05:56
clamy@ asked for this to be added to be already in
nasko
2015/01/09 18:13:07
In general, we don't add code that isn't used in a
carlosk
2015/01/12 14:35:25
Talked to clamy@ and we agreed to revert it.
|
// Called when a renderer sets its opener to null. |
void DidDisownOpener(RenderFrameHost* render_frame_host); |
@@ -367,10 +370,26 @@ 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. |
- RenderFrameHostImpl* GetFrameHostForNavigation(const GURL& url, |
nasko
2015/01/06 00:03:18
Why renaming from Get to Select? Select implies re
carlosk
2015/01/08 16:05:56
I discussed with clamy@ and this seemed like the b
nasko
2015/01/08 23:36:37
While somewhat true, there is a coding convention
carlosk
2015/01/09 14:48:52
Acknowledged. Reverted to "Get".
|
- ui::PageTransition transition); |
+ // PlzNavigate |
+ // Notifies the RFHM that a navigation has begun so that it can speculatively |
+ // create a new renderer process if needed. |
nasko
2015/01/06 00:03:18
nit: s/a new renderer process/a new RenderFrameHos
carlosk
2015/01/08 16:05:56
Done.
|
+ void BeginNavigation(const CommonNavigationParams& common_params); |
+ |
+ // PlzNavigate |
+ // Called (possibly several times) during a navigation to select an |
nasko
2015/01/06 00:03:18
Do we really expect this to be called more than tw
carlosk
2015/01/08 16:05:56
For every redirect once we begin monitoring them.
nasko
2015/01/08 23:36:37
Why do we need to monitor redirects? We should be
carlosk
2015/01/09 14:48:52
This is a performance improvement change and the e
nasko
2015/01/09 18:13:07
I'm sorry, but I do not agree with this. While it
carlosk
2015/01/12 14:35:25
I agree that backing this with data is the right t
|
+ // appropriate RenderFrameHost for the provided URL. |
+ RenderFrameHostImpl* SelectFrameHostForNavigation( |
+ const GURL& url, |
+ ui::PageTransition transition); |
+ |
+ // PlzNavigate |
+ // Cancels any state for any ongoing navigation. |
nasko
2015/01/06 00:03:18
nit: State cannot be cancelled, it can be cleaned
carlosk
2015/01/08 16:05:56
Changed to Clean up.
|
+ void CleanUpNavigation(); |
+ |
+ // PlzNavigate |
+ // Clears the speculative members, returning the RenderFrameHost to the caller |
+ // for disposal. |
+ scoped_ptr<RenderFrameHostImpl> UnsetSpeculativeRenderFrameHost(); |
// Notification methods to tell this RenderFrameHostManager that the frame it |
// is responsible for has started or stopped loading a document. |
@@ -378,6 +397,7 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
void OnDidStopLoading(); |
private: |
+ friend class NavigatorTestWithBrowserSideNavigation; |
friend class RenderFrameHostManagerTest; |
friend class TestWebContents; |
@@ -478,6 +498,15 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
int frame_routing_id, |
int flags); |
+ // PlzNavigate |
+ // Creates and initializes a speculative RenderFrameHost and/or WebUI for an |
+ // ongoing navigation. They might be destroyed and re-created later if the |
+ // navigation is redirected to a different site. |
nasko
2015/01/06 00:03:18
nit: s/site/SiteInstance/
carlosk
2015/01/08 16:05:56
Done.
|
+ bool CreateSpeculativeRenderFrameHost(const GURL& url, |
+ SiteInstance* old_instance, |
+ SiteInstance* new_instance, |
+ int bindings); |
+ |
// 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 |
@@ -497,6 +526,8 @@ 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. |
+ // If PlzNavigate is enabled the method will set the speculative (not pending) |
+ // RenderFrameHost to be the active one. |
void CommitPending(); |
// Runs the unload handler in the old RenderFrameHost, after the new |
@@ -583,6 +614,7 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
// transitioning between two Web UI pages: the RFH won't be swapped, so the |
// pending pointer will be unused, but there will be a pending Web UI |
// associated with the navigation. |
+ // Note: This is not used in PlzNavigate. |
scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; |
// If a pending request needs to be transferred to another process, this |
@@ -598,6 +630,7 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
// page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is |
// used for when they reference the same object. If either is non-NULL, the |
// other should be NULL. |
+ // Note: These are not used in PlzNavigate. |
scoped_ptr<WebUIImpl> pending_web_ui_; |
base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; |
@@ -617,6 +650,23 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
NotificationRegistrar registrar_; |
+ // PlzNavigate |
+ // These members store a speculative RenderFrameHost and WebUI. They are |
+ // created early in a navigation so the renderer process can be started in |
nasko
2015/01/06 00:03:18
nit: s/the renderer process/a renderer process/
s/
carlosk
2015/01/08 16:05:56
Done.
|
+ // parallel. This is purely a performance optimization and is not required for |
+ // correct behavior. The created RenderFrameHost might be discarded later on |
+ // if the final URL's SiteInstance isn't compatible with what was used to |
+ // create it. |
+ // Note: PlzNavigate only uses speculative RenderFrameHost and WebUI, not |
+ // the pending ones. |
+ scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; |
+ scoped_ptr<WebUIImpl> speculative_web_ui_; |
+ |
+ // PlzNavigate |
+ // If true at navigation commit time the current WebUI will be kept instead of |
+ // creating a new one. |
+ bool should_reuse_web_ui_; |
+ |
base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |