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

Unified Diff: content/browser/frame_host/frame_tree_node.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/frame_host/frame_tree_node.h
diff --git a/content/browser/frame_host/frame_tree_node.h b/content/browser/frame_host/frame_tree_node.h
index a110ff9aab557b4155a3781c7374748293dc4373..80f49d7d3064fdc62b8186be53462441eb56eaae 100644
--- a/content/browser/frame_host/frame_tree_node.h
+++ b/content/browser/frame_host/frame_tree_node.h
@@ -26,31 +26,18 @@ class RenderFrameHostImpl;
// are frame-specific (as opposed to page-specific).
class CONTENT_EXPORT FrameTreeNode {
public:
- static const int64 kInvalidFrameId;
-
FrameTreeNode(Navigator* navigator,
RenderViewHostDelegate* render_view_delegate,
RenderWidgetHostDelegate* render_widget_delegate,
RenderViewHostManager::Delegate* manager_delegate,
- int64 frame_id,
- const std::string& name,
- scoped_ptr<RenderFrameHostImpl> render_frame_host);
+ const std::string& name);
~FrameTreeNode();
- void AddChild(scoped_ptr<FrameTreeNode> child);
+ void AddChild(scoped_ptr<FrameTreeNode> child,
+ int render_frame_host_id);
void RemoveChild(FrameTreeNode* child);
- // Transitional API allowing the RenderFrameHost of a FrameTreeNode
- // representing the main frame to be provided by someone else. After
- // this is called, the FrameTreeNode no longer owns its RenderFrameHost.
- //
- // This should only be used for the main frame (aka root) in a frame tree.
- //
- // TODO(ajwong): Remove this method once the main frame RenderFrameHostImpl is
- // no longer owned by the RenderViewHostImpl.
- void ResetForMainFrame(RenderFrameHostImpl* new_render_frame_host);
-
Navigator* navigator() {
return navigator_.get();
}
@@ -59,20 +46,13 @@ class CONTENT_EXPORT FrameTreeNode {
return &render_manager_;
}
+ // This is the browser-wide unique ID for the FrameTreeNode. If you have a
+ // renderer-specific frame ID, you can look up the corresponding FrameTreeNode
+ // ID using RenderViewHostImpl::GetFrameTreeNodeID(frame_id).
int64 frame_tree_node_id() const {
return frame_tree_node_id_;
}
- // DO NOT USE. Only used by FrameTree until we replace renderer-specific
- // frame IDs with RenderFrameHost routing IDs.
- void set_frame_id(int64 frame_id) {
- DCHECK_EQ(frame_id_, kInvalidFrameId);
- frame_id_ = frame_id;
- }
- int64 frame_id() const {
- return frame_id_;
- }
-
const std::string& frame_name() const {
return frame_name_;
}
@@ -94,7 +74,7 @@ class CONTENT_EXPORT FrameTreeNode {
}
RenderFrameHostImpl* render_frame_host() const {
- return render_frame_host_;
+ return render_manager_.current_frame();
}
private:
@@ -105,23 +85,17 @@ class CONTENT_EXPORT FrameTreeNode {
// of the frame tree.
scoped_refptr<Navigator> navigator_;
- // Manages creation and swapping of RenderViewHosts for this frame. This must
- // be declared before |children_| so that it gets deleted after them. That's
- // currently necessary so that RenderFrameHostImpl's destructor can call
- // GetProcess.
+ // Manages creation and swapping of RenderFrameHosts for this frame. This
+ // must be declared before |children_| so that it gets deleted after them.
+ // That's currently necessary so that RenderFrameHostImpl's destructor can
+ // call GetProcess.
// TODO(creis): This will become a RenderFrameHostManager, which eliminates
// the need for |render_frame_host_| below.
RenderViewHostManager render_manager_;
// A browser-global identifier for the frame in the page, which stays stable
// even if the frame does a cross-process navigation.
- const int64 frame_tree_node_id_;
-
- // The renderer-specific identifier for the frame in the page.
- // TODO(creis): Remove this in favor of the RenderFrameHost's routing ID once
- // we create FrameTreeNodes for all frames (even without a flag), since this
- // value can change after cross-process navigations.
- int64 frame_id_;
+ int64 frame_tree_node_id_;
// The assigned name of the frame. This name can be empty, unlike the unique
// name generated internally in the DOM tree.
@@ -130,22 +104,6 @@ class CONTENT_EXPORT FrameTreeNode {
// The immediate children of this specific frame.
ScopedVector<FrameTreeNode> children_;
- // When ResetForMainFrame() is called, this is set to false and the
- // |render_frame_host_| below is not deleted on destruction.
- //
- // For the mainframe, the FrameTree does not own the |render_frame_host_|.
- // This is a transitional wart because RenderViewHostManager does not yet
- // have the bookkeeping logic to handle creating a pending RenderFrameHost
- // along with a pending RenderViewHost. Thus, for the main frame, the
- // RenderViewHost currently retains ownership and the FrameTreeNode should
- // not delete it on destruction.
- bool owns_render_frame_host_;
-
- // The active RenderFrameHost for this frame. The FrameTreeNode does not
- // always own this pointer. See comments above |owns_render_frame_host_|.
- // TODO(ajwong): Replace with RenderFrameHostManager.
- RenderFrameHostImpl* render_frame_host_;
-
// Track the current frame's last committed URL, so we can estimate the
// process impact of out-of-process iframes.
// TODO(creis): Remove this when we can store subframe URLs in the

Powered by Google App Engine
This is Rietveld 408576698