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

Unified Diff: content/browser/renderer_host/render_view_host_impl.h

Issue 30323002: [DRAFT] Create RenderFrameHostManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 1 month 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/renderer_host/render_view_host_impl.h
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
index ec5fc1522a8bb7339111032dd3c464202d278997..61689b10aa881c8412452562456050b57148fbbc 100644
--- a/content/browser/renderer_host/render_view_host_impl.h
+++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -61,7 +61,6 @@ namespace content {
class BrowserMediaPlayerManager;
class ChildProcessSecurityPolicyImpl;
class PageState;
-class RenderFrameHostImpl;
class RenderWidgetHostDelegate;
class SessionStorageNamespace;
class SessionStorageNamespaceImpl;
@@ -227,6 +226,21 @@ class CONTENT_EXPORT RenderViewHostImpl
delegate_ = d;
}
+ // Keep track of which RenderFrameHosts are using this RenderViewHost. When
+ // the number drops to zero, we call Shutdown. This cannot use frame_ids,
+ // since the RenderFrameHost may outlive the process (or may go away before
+ // the process and frame_id are created).
+ void RegisterRenderFrameHost(RenderFrameHostImpl* render_frame_host);
+ void UnregisterRenderFrameHost(RenderFrameHostImpl* render_frame_host);
+
+ // Map renderer-specific frame IDs to browser-global FrameTreeNode IDs.
+ // TODO(creis): Call Unregister.
+ void RegisterFrameID(int64 frame_id, int64 frame_tree_node_id);
+ void UnregisterFrameID(int64 frame_id);
+ bool HasFrameID(int64 frame_id) const;
+ int64 GetFrameTreeNodeID(int64 frame_id);
+ int64 GetFrameIDForTesting(int64 frame_tree_node_id) const;
+
// Set up the RenderView child process. Virtual because it is overridden by
// TestRenderViewHost. If the |frame_name| parameter is non-empty, it is used
// as the name of the new top-level frame.
@@ -428,12 +442,6 @@ class CONTENT_EXPORT RenderViewHostImpl
is_subframe_ = is_subframe;
}
- // TODO(creis): Remove this when we replace frame IDs with RenderFrameHost
- // routing IDs.
- int64 main_frame_id() const {
- return main_frame_id_;
- }
-
// Set the opener to null in the renderer process.
void DisownOpener();
@@ -481,13 +489,6 @@ class CONTENT_EXPORT RenderViewHostImpl
bool empty_allowed,
GURL* url);
- // Update the FrameTree to use this RenderViewHost's main frame
- // RenderFrameHost. Called when the RenderViewHost is committed.
- //
- // TODO(ajwong): Remove once RenderViewHost no longer owns the main frame
- // RenderFrameHost.
- void AttachToFrameTree();
-
// The following IPC handlers are public so RenderFrameHost can call them,
// while we transition the code to not use RenderViewHost.
//
@@ -611,33 +612,19 @@ class CONTENT_EXPORT RenderViewHostImpl
void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params);
#endif
- // TODO(nasko): Remove this accessor once RenderFrameHost moves into the frame
- // tree.
- RenderFrameHostImpl* main_render_frame_host() const {
- return main_render_frame_host_.get();
- }
-
private:
friend class TestRenderViewHost;
FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, BasicRenderFrameHost);
FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, RoutingIdSane);
+ typedef base::hash_map<int64, int64> FrameIDMap;
+
// Sets whether this RenderViewHost is swapped out in favor of another,
// and clears any waiting state that is no longer relevant.
void SetSwappedOut(bool is_swapped_out);
bool CanAccessFilesOfPageState(const PageState& state) const;
- // All RenderViewHosts must have a RenderFrameHost for its main frame.
- // Currently the RenderFrameHost is created in lock step on construction
- // and a pointer to the main frame is given to the FrameTreeNode
- // when the RenderViewHost commits (see AttachToFrameTree()).
- //
- // TODO(ajwong): Make this reference non-owning. The root FrameTreeNode of
- // the FrameTree should be responsible for owning the main frame's
- // RenderFrameHost.
- scoped_ptr<RenderFrameHostImpl> main_render_frame_host_;
-
// Our delegate, which wants to know about changes in the RenderView.
RenderViewHostDelegate* delegate_;
@@ -646,6 +633,13 @@ class CONTENT_EXPORT RenderViewHostImpl
// over time.
scoped_refptr<SiteInstanceImpl> instance_;
+ // A list of RenderFrameHosts depending on this RenderViewHost. When the list
+ // size goes to zero, this RenderViewHost is shut down.
+ std::set<RenderFrameHostImpl*> rfh_list_;
+
+ // Map of renderer-specific frame IDs to browser-global FrameTreeNode IDs.
+ FrameIDMap frame_id_map_;
+
// true if we are currently waiting for a response for drag context
// information.
bool waiting_for_drag_context_response_;
@@ -680,10 +674,9 @@ class CONTENT_EXPORT RenderViewHostImpl
// different process from its parent page.
bool is_subframe_;
- // The frame id of the main (top level) frame. This value is set on the
- // initial navigation of a RenderView and reset when the RenderView's
- // process is terminated (in RenderProcessGone).
- int64 main_frame_id_;
+ // Routing ID for the main frame's RenderFrameHost.
+ // TODO(creis): Does this need to be updated on a crash?
+ int main_frame_routing_id_;
// If we were asked to RunModal, then this will hold the reply_msg that we
// must return to the renderer to unblock it.

Powered by Google App Engine
This is Rietveld 408576698