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

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

Issue 23841002: Create a new RenderFrameHost per child frame when --site-per-process is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: notify observers regardless of flag Created 7 years, 3 months 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
« no previous file with comments | « content/browser/renderer_host/frame_tree.cc ('k') | content/browser/renderer_host/frame_tree_node.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/frame_tree_node.h
diff --git a/content/browser/web_contents/frame_tree_node.h b/content/browser/renderer_host/frame_tree_node.h
similarity index 51%
rename from content/browser/web_contents/frame_tree_node.h
rename to content/browser/renderer_host/frame_tree_node.h
index 76d2194d5c4f09116286306a656f04b2fc2a9b7a..99dd13594d979243e99e06ebe141221a37902725 100644
--- a/content/browser/web_contents/frame_tree_node.h
+++ b/content/browser/renderer_host/frame_tree_node.h
@@ -8,25 +8,45 @@
#include <string>
#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "content/common/content_export.h"
#include "url/gurl.h"
namespace content {
+class RenderFrameHostImpl;
+
// Any page that contains iframes has a tree structure of the frames in the
// renderer process. We are mirroring this tree in the browser process. This
// class represents a node in this tree and is a wrapper for all objects that
// are frame-specific (as opposed to page-specific).
class CONTENT_EXPORT FrameTreeNode {
public:
- FrameTreeNode(int64 frame_id, const std::string& name);
+ static const int64 kInvalidFrameId;
+
+ FrameTreeNode(int64 frame_id, const std::string& name,
+ scoped_ptr<RenderFrameHostImpl> render_frame_host);
~FrameTreeNode();
- // This method takes ownership of the child pointer.
- void AddChild(FrameTreeNode* child);
+ void AddChild(scoped_ptr<FrameTreeNode> child);
void RemoveChild(int64 child_id);
+ // 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);
+
+ void set_frame_id(int64 frame_id) {
+ DCHECK_EQ(frame_id_, kInvalidFrameId);
+ frame_id_ = frame_id;
+ }
+
int64 frame_id() const {
return frame_id_;
}
@@ -51,6 +71,10 @@ class CONTENT_EXPORT FrameTreeNode {
current_url_ = url;
}
+ RenderFrameHostImpl* render_frame_host() const {
+ return render_frame_host_;
+ }
+
private:
// The unique identifier for the frame in the page.
int64 frame_id_;
@@ -62,6 +86,22 @@ 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 bookeeping 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
« no previous file with comments | « content/browser/renderer_host/frame_tree.cc ('k') | content/browser/renderer_host/frame_tree_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698