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 ae642472ccbdc9b117053853b6e55524c1f70916..3e2b4a535538cef4bfa2bc9eee5fe5feefdb57b4 100644 |
| --- a/content/browser/frame_host/render_frame_host_manager.h |
| +++ b/content/browser/frame_host/render_frame_host_manager.h |
| @@ -12,6 +12,7 @@ |
| #include "base/logging.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "content/browser/frame_host/render_frame_host_impl.h" |
| #include "content/browser/renderer_host/render_view_host_delegate.h" |
| #include "content/browser/site_instance_impl.h" |
| #include "content/common/content_export.h" |
| @@ -33,9 +34,7 @@ class NavigationEntryImpl; |
| class NavigationHandleImpl; |
| class NavigationRequest; |
| class NavigatorTestWithBrowserSideNavigation; |
| -class RenderFrameHost; |
| class RenderFrameHostDelegate; |
| -class RenderFrameHostImpl; |
| class RenderFrameHostManagerTest; |
| class RenderFrameProxyHost; |
| class RenderViewHost; |
| @@ -148,12 +147,6 @@ class CONTENT_EXPORT RenderFrameHostManager { |
| virtual NavigationControllerImpl& |
| GetControllerForRenderManager() = 0; |
| - // Creates a WebUI object for the given URL if one applies. Ownership of the |
| - // returned pointer will be passed to the caller. If no WebUI applies, |
| - // returns NULL. |
| - virtual scoped_ptr<WebUIImpl> CreateWebUIForRenderManager( |
| - const GURL& url) = 0; |
| - |
| // Returns the navigation entry of the current navigation, or NULL if there |
| // is none. |
| virtual NavigationEntry* |
| @@ -186,6 +179,10 @@ class CONTENT_EXPORT RenderFrameHostManager { |
| // WebContentsImpl. |
| static bool ClearRFHsPendingShutdown(FrameTreeNode* node); |
| + // Used with FrameTree::ForEach to destroy all WebUI instances associated with |
| + // RenderFrameHosts. |
| + static bool ClearWebUIInstances(FrameTreeNode* node); |
| + |
| // All three delegate pointers must be non-NULL and are not owned by this |
| // class. They must outlive this class. The RenderViewHostDelegate and |
| // RenderWidgetHostDelegate are what will be installed into all |
| @@ -249,7 +246,7 @@ class CONTENT_EXPORT RenderFrameHostManager { |
| // somehwere else. |
| void RemoveOuterDelegateFrame(); |
| - // Returns the pending RenderFrameHost, or NULL if there is no pending one. |
| + // Returns the pending RenderFrameHost, or null if there is no pending one. |
| RenderFrameHostImpl* pending_frame_host() const { |
| return pending_render_frame_host_.get(); |
| } |
| @@ -263,21 +260,10 @@ class CONTENT_EXPORT RenderFrameHostManager { |
| // TODO(creis): Remove this when we no longer use RVH for navigation. |
| RenderViewHostImpl* pending_render_view_host() const; |
| - // Returns the current committed Web UI or NULL if none applies. |
| - WebUIImpl* web_ui() const { return web_ui_.get(); } |
| - |
| - // Returns the Web UI for the pending navigation, or NULL of none applies. |
| - WebUIImpl* pending_web_ui() const { |
| - return pending_web_ui_.get() ? pending_web_ui_.get() : |
| - pending_and_current_web_ui_.get(); |
| - } |
| - |
| - // PlzNavigate |
| - // Returns the speculative WebUI for the navigation (a newly created one or |
| - // the current one if it should be reused). If none is set returns nullptr. |
| - WebUIImpl* speculative_web_ui() const { |
| - return should_reuse_web_ui_ ? web_ui_.get() : speculative_web_ui_.get(); |
| - } |
| + // Returns the WebUI associated with the ongoing navigation, it being either |
| + // the active or the pending one from the navigating RenderFrameHost. Returns |
| + // null if there's no ongoing navigation or if no WebUI applies. |
| + WebUIImpl* GetNavigatingWebUI() const; |
| // Called when we want to instruct the renderer to navigate to the given |
| // navigation entry. It may create a new RenderFrameHost or re-use an existing |
| @@ -353,19 +339,12 @@ class CONTENT_EXPORT RenderFrameHostManager { |
| void DidChangeOpener(int opener_routing_id, |
| SiteInstance* source_site_instance); |
| - // Sets the pending Web UI for the pending navigation, ensuring that the |
| - // bindings are appropriate compared to |bindings|. |
| - void SetPendingWebUI(const GURL& url, int bindings); |
| - |
| - // Creates and initializes a RenderFrameHost. The |web_ui| is an optional |
| - // input parameter used to double check bindings when swapping back in a |
| - // previously existing RenderFrameHost. If |flags| has the |
| + // Creates and initializes a RenderFrameHost. If |flags| has the |
| // CREATE_RF_SWAPPED_OUT bit set from the CreateRenderFrameFlags enum, it will |
| // initially be placed on the swapped out hosts list. If |view_routing_id_ptr| |
| // is not nullptr it will be set to the routing id of the view associated with |
| // the frame. |
| scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance, |
| - WebUIImpl* web_ui, |
| int flags, |
| int* view_routing_id_ptr); |
| @@ -568,16 +547,6 @@ class CONTENT_EXPORT RenderFrameHostManager { |
| const GURL& new_effective_url, |
| bool new_is_view_source_mode) const; |
| - // Creates a new Web UI, ensuring that the bindings are appropriate compared |
| - // to |bindings|. |
| - scoped_ptr<WebUIImpl> CreateWebUI(const GURL& url, int bindings); |
| - |
| - // Returns true if it is safe to reuse the current WebUI when navigating from |
| - // |current_entry| to |new_url|. |
| - bool ShouldReuseWebUI( |
| - const NavigationEntry* current_entry, |
| - const GURL& new_url) const; |
| - |
| // Returns the SiteInstance to use for the navigation. |
| SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, |
| SiteInstance* source_instance, |
| @@ -664,13 +633,11 @@ class CONTENT_EXPORT RenderFrameHostManager { |
| 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 SiteInstance. |
| - bool CreateSpeculativeRenderFrameHost(const GURL& url, |
| - SiteInstance* old_instance, |
| - SiteInstance* new_instance, |
| - int bindings); |
| + // Create and initialize a speculative RenderFrameHost for an ongoing |
| + // navigation. It might be destroyed and re-created later if the navigation |
| + // is redirected to a different SiteInstance. |
| + bool CreateSpeculativeRenderFrameHost(SiteInstance* old_instance, |
| + SiteInstance* new_instance); |
| // Sets up the necessary state for a new RenderViewHost. If |proxy| is not |
| // null, it creates a RenderFrameProxy in the target renderer process which is |
| @@ -683,9 +650,13 @@ class CONTENT_EXPORT RenderFrameHostManager { |
| // above. |
| bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); |
| - // 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. |
| + // Makes the pending WebUI on the current RenderFrameHost to being active. |
|
Charlie Reis
2015/11/26 07:02:51
nit: s/to being active/active/
carlosk
2015/11/26 10:58:02
Done.
|
| + // Call this when the current RenderFrameHost commits and it has a pending |
| + // WebUI. |
| + void CommitPendingWebUI(); |
| + |
| + // Sets the pending RenderFrameHost to be the active one. Call this for every |
| + // cross-site commit. |
|
Charlie Reis
2015/11/26 07:02:51
nit: "cross-site commit" probably isn't accurate.
carlosk
2015/11/26 10:58:02
Done.
|
| // If PlzNavigate is enabled the method will set the speculative (not pending) |
| // RenderFrameHost to be the active one. |
| void CommitPending(); |
| @@ -741,6 +712,11 @@ class CONTENT_EXPORT RenderFrameHostManager { |
| const GlobalRequestID& transferred_request_id, |
| int bindings); |
| + // Updates the pending WebUI of the current RenderFrameHost for a same-site |
| + // navigation. |
| + void UpdatePendingWebUIOnCurrentFrameHost(const GURL& dest_url, |
| + int entry_bindings); |
| + |
| // Called when a renderer process is starting to close. We should not |
| // schedule new navigations in its swapped out RenderFrameHosts after this. |
| void RendererProcessClosing(RenderProcessHost* render_process_host); |
| @@ -757,25 +733,15 @@ class CONTENT_EXPORT RenderFrameHostManager { |
| RenderViewHostDelegate* render_view_delegate_; |
| RenderWidgetHostDelegate* render_widget_delegate_; |
| - // Our RenderFrameHost and its associated Web UI (if any, will be NULL for |
| - // non-WebUI pages). This object is responsible for all communication with |
| - // a child RenderFrame instance. |
| + // Our RenderFrameHost which is responsible for all communication with a child |
| + // RenderFrame instance. |
| // For now, RenderFrameHost keeps a RenderViewHost in its SiteInstance alive. |
| // Eventually, RenderViewHost will be replaced with a page context. |
| scoped_ptr<RenderFrameHostImpl> render_frame_host_; |
| - scoped_ptr<WebUIImpl> web_ui_; |
| // A RenderFrameHost used to load a cross-site page. This remains hidden |
| - // while a cross-site request is pending until it calls DidNavigate. It may |
| - // have an associated Web UI, in which case the Web UI pointer will be non- |
| - // NULL. |
| - // |
| - // The |pending_web_ui_| may be non-NULL even when the |
| - // |pending_render_frame_host_| is NULL. This will happen when we're |
| - // 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. |
| + // while a cross-site request is pending until it calls DidNavigate. |
| + // Note: This member is not used in PlzNavigate. |
| scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; |
| // If a pending request needs to be transferred to another process, this |
| @@ -791,14 +757,6 @@ class CONTENT_EXPORT RenderFrameHostManager { |
| // navigations in PlzNavigate. |
| scoped_ptr<NavigationHandleImpl> transfer_navigation_handle_; |
| - // If either of these is non-NULL, the pending navigation is to a chrome: |
| - // 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_; |
| - |
| class RenderFrameProxyHostMap; |
| scoped_ptr<RenderFrameProxyHostMap> proxy_hosts_; |
| @@ -813,21 +771,15 @@ class CONTENT_EXPORT RenderFrameHostManager { |
| InterstitialPageImpl* interstitial_page_; |
| // PlzNavigate |
| - // These members store a speculative RenderFrameHost and WebUI. They are |
| - // created early in a navigation so a renderer process can be started in |
| - // parallel, if needed. 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. |
| + // Stores a speculative RenderFrameHost which is created early in a navigation |
| + // so a renderer process can be started in parallel, if needed. |
| + // This is purely a performance optimization and is not required for correct |
| + // behavior. The speculative RenderFrameHost might be discarded later on if |
| + // the final URL's SiteInstance isn't compatible with the one used to create |
| + // it. |
| + // Note: PlzNavigate only uses the speculative RenderFrameHost, not the |
| + // pending one. |
| 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_; |