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 ae8d9f9ddc4ff6cd18c405da388ebe0e6334e09a..b9791cf49b253c191b2fc14585b463390b41228b 100644 |
| --- a/content/browser/frame_host/render_frame_host_manager.h |
| +++ b/content/browser/frame_host/render_frame_host_manager.h |
| @@ -20,6 +20,7 @@ |
| #include "content/public/common/referrer.h" |
| #include "ui/base/page_transition_types.h" |
| +struct FrameHostMsg_BeginNavigation_Params; |
| struct FrameMsg_Navigate_Params; |
| namespace content { |
| @@ -31,6 +32,7 @@ class InterstitialPageImpl; |
| class NavigationControllerImpl; |
| class NavigationEntry; |
| class NavigationEntryImpl; |
| +class NavigatorTestWithBrowserSideNavigation; |
| class RenderFrameHost; |
| class RenderFrameHostDelegate; |
| class RenderFrameHostImpl; |
| @@ -42,6 +44,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 |
| @@ -366,12 +369,24 @@ 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 |
|
nasko
2014/12/10 23:11:34
nit: s/about to begin/has begun/ since we issue th
carlosk
2014/12/16 01:53:48
Done.
|
| + // speculatively spawn a new renderer process if needed. |
|
nasko
2014/12/10 23:11:34
nit: s/spawn/create/
carlosk
2014/12/16 01:53:48
Done.
|
| + void BeginNavigation(const FrameHostMsg_BeginNavigation_Params& params, |
| + const CommonNavigationParams& common_params); |
| + |
| + // PlzNavigate |
| + // Called when a navigation is ready to commit, to select the RenderFrameHost |
|
nasko
2014/12/10 23:11:34
nit: no need for comma
carlosk
2014/12/16 01:53:48
Done.
|
| + // that will commit it. |
| RenderFrameHostImpl* GetFrameHostForNavigation(const GURL& url, |
| ui::PageTransition transition); |
| + // PlzNavigate |
| + // Cancels any state for any ongoing navigation. |
| + void CleanUpNavigation(); |
| + |
| private: |
| + friend class NavigatorTestWithBrowserSideNavigation; |
| friend class RenderFrameHostManagerTest; |
| friend class TestWebContents; |
| @@ -466,6 +481,16 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
| int frame_routing_id, |
| int flags); |
| + // PlzNavigate |
| + // Creates a new RenderFrameHost and does all required supporting work for the |
| + // speculative creation of a new speculative RenderFrameHost for an ongoing |
|
nasko
2014/12/10 23:11:34
nit: It will be nice to avoid using "speculative"
carlosk
2014/12/16 01:53:48
Yeah, this was very bad Engrish. ;) I updated the
|
| + // 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, |
| + 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 |
| @@ -485,6 +510,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 |
| @@ -566,6 +593,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 |
| @@ -600,6 +628,22 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { |
| NotificationRegistrar registrar_; |
| + // PlzNavigate |
| + // These members store a speculative RenderFrameHost and WebUI. They are |
| + // created early in during a navigation so the renderer process can be started |
| + // in parallel with it. This is purely an optimization and is not required for |
| + // correct behavior. The created instance 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 RenderFrameHosts and not 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); |