Index: trunk/src/content/browser/frame_host/frame_tree_node.h |
=================================================================== |
--- trunk/src/content/browser/frame_host/frame_tree_node.h (revision 241158) |
+++ trunk/src/content/browser/frame_host/frame_tree_node.h (working copy) |
@@ -18,7 +18,6 @@ |
namespace content { |
-class FrameTree; |
class Navigator; |
class RenderFrameHostImpl; |
@@ -30,8 +29,7 @@ |
public: |
static const int64 kInvalidFrameId; |
- FrameTreeNode(FrameTree* frame_tree, |
- Navigator* navigator, |
+ FrameTreeNode(Navigator* navigator, |
RenderFrameHostDelegate* render_frame_delegate, |
RenderViewHostDelegate* render_view_delegate, |
RenderWidgetHostDelegate* render_widget_delegate, |
@@ -41,19 +39,28 @@ |
~FrameTreeNode(); |
- bool IsMainFrame() const; |
- |
- void AddChild(scoped_ptr<FrameTreeNode> child, int frame_routing_id); |
+ void AddChild(scoped_ptr<FrameTreeNode> child); |
void RemoveChild(FrameTreeNode* child); |
- // Clears process specific-state after a main frame process swap. |
- // TODO(creis): Look into how we can remove the need for this method. |
- void ResetForMainFrameSwap(); |
- |
- FrameTree* frame_tree() const { |
- return frame_tree_; |
+ // TODO(nasko): This method should be removed once RenderFrameHosts are |
+ // created by RenderFrameHostManager. |
+ void set_render_frame_host( |
+ RenderFrameHostImpl* render_frame_host, |
+ bool owns_render_frame_host) { |
+ render_frame_host_ = render_frame_host; |
+ owns_render_frame_host_ = owns_render_frame_host; |
} |
+ // 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(); |
} |
@@ -96,25 +103,23 @@ |
current_url_ = url; |
} |
- RenderFrameHostImpl* current_frame_host() const { |
- return render_manager_.current_frame_host(); |
+ RenderFrameHostImpl* render_frame_host() const { |
+ return render_frame_host_; |
} |
private: |
// The next available browser-global FrameTreeNode ID. |
static int64 next_frame_tree_node_id_; |
- // The FrameTree that owns us. |
- FrameTree* frame_tree_; // not owned. |
- |
// The Navigator object responsible for managing navigations at this node |
// of the frame tree. |
scoped_refptr<Navigator> navigator_; |
- // 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. |
+ // 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. |
+ // TODO(creis): This will eliminate the need for |render_frame_host_| below. |
RenderFrameHostManager render_manager_; |
// A browser-global identifier for the frame in the page, which stays stable |
@@ -134,6 +139,22 @@ |
// 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 RenderFrameHostManager 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 |