Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Unified Diff: content/browser/frame_host/render_frame_host_manager.h

Issue 106963004: Make RenderFrameHostManager swap RenderFrameHosts, not RenderViewHosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 94a4998b62f492d944110a84fa2545524871928b..b1fdf73bf52722fbe7df3c42c6b652a6fd29bb69 100644
--- a/content/browser/frame_host/render_frame_host_manager.h
+++ b/content/browser/frame_host/render_frame_host_manager.h
@@ -24,6 +24,7 @@ class NavigationControllerImpl;
class NavigationEntry;
class NavigationEntryImpl;
class RenderFrameHostDelegate;
+class RenderFrameHostImpl;
class RenderFrameHostManagerTest;
class RenderViewHost;
class RenderViewHostImpl;
@@ -126,11 +127,16 @@ class CONTENT_EXPORT RenderFrameHostManager
int routing_id,
int main_frame_routing_id);
- // Returns the currently active RenderViewHost.
+ // Returns the currently active RenderFrameHost.
//
// This will be non-NULL between Init() and Shutdown(). You may want to NULL
// check it in many cases, however. Windows can send us messages during the
// destruction process after it has been shut down.
+ RenderFrameHostImpl* current_frame() const {
+ return render_frame_host_;
+ }
+
+ // TODO(creis): Remove this when we no longer use RVH for navigation.
RenderViewHostImpl* current_host() const;
// Returns the view associated with the current RenderViewHost, or NULL if
@@ -138,6 +144,9 @@ class CONTENT_EXPORT RenderFrameHostManager
RenderWidgetHostView* GetRenderWidgetHostView() const;
// Returns the pending render view host, or NULL if there is no pending one.
nasko 2013/12/12 02:22:12 "render frame host"
Charlie Reis 2013/12/12 18:19:30 Oops, done.
+ RenderFrameHostImpl* pending_render_frame_host() const;
nasko 2013/12/12 02:22:12 This seems a bit inconsistent: current_frame() vs
Charlie Reis 2013/12/12 18:19:30 current_frame_host() and pending_frame_host() soun
+
+ // 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.
@@ -183,13 +192,13 @@ class CONTENT_EXPORT RenderFrameHostManager
// Called when a renderer sets its opener to null.
void DidDisownOpener(RenderViewHost* render_view_host);
- // Helper method to create a RenderViewHost. If |swapped_out| is true, it
+ // Helper method to create a RenderFrameHost. If |swapped_out| is true, it
// will be initially placed on the swapped out hosts list. Otherwise, it
// will be used for a pending cross-site navigation.
- int CreateRenderView(SiteInstance* instance,
- int opener_route_id,
- bool swapped_out,
- bool hidden);
+ int CreateRenderFrame(SiteInstance* instance,
+ int opener_route_id,
+ bool swapped_out,
+ bool hidden);
// Called when a provisional load on the given renderer is aborted.
void RendererAbortedProvisionalLoad(RenderViewHost* render_view_host);
@@ -236,12 +245,16 @@ class CONTENT_EXPORT RenderFrameHostManager
// Called when a RenderViewHost is about to be deleted.
void RenderViewDeleted(RenderViewHost* rvh);
- // Returns whether the given RenderViewHost is on the list of swapped out
- // RenderViewHosts.
- bool IsOnSwappedOutList(RenderViewHost* rvh) const;
+ // Returns whether the given RenderFrameHost (or its associated
+ // RenderViewHost) is on the list of swapped out RenderFrameHosts.
+ bool IsRVHOnSwappedOutList(RenderViewHostImpl* rvh) const;
+ bool IsOnSwappedOutList(RenderFrameHostImpl* rfh) const;
- // Returns the swapped out RenderViewHost for the given SiteInstance, if any.
- RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance);
+ // Returns the swapped out RenderViewHost or RenderFrameHost for the given
+ // SiteInstance, if any.
+ RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance) const;
+ RenderFrameHostImpl* GetSwappedOutRenderFrameHost(
+ SiteInstance* instance) const;
// Runs the unload handler in the current page, when we know that a pending
// cross-process navigation is going to commit. We may initiate a transfer
@@ -253,7 +266,7 @@ class CONTENT_EXPORT RenderFrameHostManager
friend class TestWebContents;
// Tracks information about a navigation while a cross-process transition is
- // in progress, in case we need to transfer it to a new RenderViewHost.
+ // in progress, in case we need to transfer it to a new RenderFrameHost.
struct PendingNavigationParams {
PendingNavigationParams();
PendingNavigationParams(const GlobalRequestID& global_request_id,
@@ -325,60 +338,65 @@ class CONTENT_EXPORT RenderFrameHostManager
SiteInstance* current_instance,
bool force_browsing_instance_swap);
- // Sets up the necessary state for a new RenderViewHost with the given opener.
+ // Sets up the necessary state for a new RenderFrameHost with the given
+ // opener. This also initializes the RenderView if necessary.
nasko 2013/12/12 02:22:12 nit: "RenderViewHost" here and next line.
Charlie Reis 2013/12/12 18:19:30 Done. I looked closer and we're not really doing
+ // TODO(creis): opener_route_id is currently for the RenderView but should be
+ // for the RenderFrame, since frames can have openers.
bool InitRenderView(RenderViewHost* render_view_host, int opener_route_id);
- // Sets the pending RenderViewHost/WebUI to be the active one. Note that this
- // doesn't require the pending render_view_host_ pointer to be non-NULL, since
- // there could be Web UI switching as well. Call this for every commit.
+ // 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();
- // Shutdown all RenderViewHosts in a SiteInstance. This is called
- // to shutdown views when all the views in a SiteInstance are
- // confirmed to be swapped out.
- void ShutdownRenderViewHostsInSiteInstance(int32 site_instance_id);
+ // Shutdown all RenderFrameHosts in a SiteInstance. This is called to shutdown
+ // frames when all the frames in a SiteInstance are confirmed to be swapped
+ // out.
+ void ShutdownRenderFrameHostsInSiteInstance(int32 site_instance_id);
// Helper method to terminate the pending RenderViewHost.
void CancelPending();
- RenderViewHostImpl* UpdateRendererStateForNavigate(
+ RenderFrameHostImpl* UpdateRendererStateForNavigate(
const NavigationEntryImpl& entry);
// Called when a renderer process is starting to close. We should not
- // schedule new navigations in its swapped out RenderViewHosts after this.
+ // schedule new navigations in its swapped out RenderFrameHosts after this.
void RendererProcessClosing(RenderProcessHost* render_process_host);
// Our delegate, not owned by us. Guaranteed non-NULL.
Delegate* delegate_;
- // Whether a navigation requiring different RenderView's is pending. This is
- // either cross-site request is (in the new process model), or when required
- // for the view type (like view source versus not).
+ // Whether a navigation requiring different RenderFrameHosts is pending. This
+ // is either for cross-site requests or when required for the process type
+ // (like WebUI).
bool cross_navigation_pending_;
- // Implemented by the owner of this class, these delegates are installed into
- // all the RenderViewHosts that we create.
+ // Implemented by the owner of this class. These delegates are installed into
+ // all the RenderFrameHosts that we create.
RenderFrameHostDelegate* render_frame_delegate_;
RenderViewHostDelegate* render_view_delegate_;
RenderWidgetHostDelegate* render_widget_delegate_;
- // Our RenderView host and its associated Web UI (if any, will be NULL for
- // non-DOM-UI pages). This object is responsible for all communication with
- // a child RenderView instance.
- RenderViewHostImpl* render_view_host_;
+ // 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.
+ // For now, RenderFrameHost keeps a RenderViewHost in its SiteInstance alive.
+ // Eventually, RenderViewHost will be replaced with a page context.
+ RenderFrameHostImpl* render_frame_host_;
scoped_ptr<WebUIImpl> web_ui_;
- // A RenderViewHost used to load a cross-site page. This remains hidden
+ // 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_view_host_| is NULL. This will happen when we're
- // transitioning between two Web UI pages: the RVH won't be swapped, so 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.
- RenderViewHostImpl* pending_render_view_host_;
+ RenderFrameHostImpl* pending_render_frame_host_;
// Tracks information about any current pending cross-process navigation.
scoped_ptr<PendingNavigationParams> pending_nav_params_;
@@ -390,10 +408,10 @@ class CONTENT_EXPORT RenderFrameHostManager
scoped_ptr<WebUIImpl> pending_web_ui_;
base::WeakPtr<WebUIImpl> pending_and_current_web_ui_;
- // A map of site instance ID to swapped out RenderViewHosts. This may include
- // pending_render_view_host_ for navigations to existing entries.
- typedef base::hash_map<int32, RenderViewHostImpl*> RenderViewHostMap;
- RenderViewHostMap swapped_out_hosts_;
+ // A map of site instance ID to swapped out RenderFrameHosts. This may
+ // include pending_render_frame_host_ for navigations to existing entries.
+ typedef base::hash_map<int32, RenderFrameHostImpl*> RenderFrameHostMap;
+ RenderFrameHostMap swapped_out_hosts_;
// The intersitial page currently shown if any, not own by this class
// (the InterstitialPage is self-owned, it deletes itself when hidden).

Powered by Google App Engine
This is Rietveld 408576698