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

Side by Side Diff: content/browser/frame_host/frame_tree_node.h

Issue 172063002: Unify frame IDs with RenderFrameHost routing IDs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix type Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 10 matching lines...) Expand all
21 class FrameTree; 21 class FrameTree;
22 class Navigator; 22 class Navigator;
23 class RenderFrameHostImpl; 23 class RenderFrameHostImpl;
24 24
25 // When a page contains iframes, its renderer process maintains a tree structure 25 // When a page contains iframes, its renderer process maintains a tree structure
26 // of those frames. We are mirroring this tree in the browser process. This 26 // of those frames. We are mirroring this tree in the browser process. This
27 // class represents a node in this tree and is a wrapper for all objects that 27 // class represents a node in this tree and is a wrapper for all objects that
28 // are frame-specific (as opposed to page-specific). 28 // are frame-specific (as opposed to page-specific).
29 class CONTENT_EXPORT FrameTreeNode { 29 class CONTENT_EXPORT FrameTreeNode {
30 public: 30 public:
31 static const int64 kInvalidFrameId;
32 31
33 FrameTreeNode(FrameTree* frame_tree, 32 FrameTreeNode(FrameTree* frame_tree,
34 Navigator* navigator, 33 Navigator* navigator,
35 RenderFrameHostDelegate* render_frame_delegate, 34 RenderFrameHostDelegate* render_frame_delegate,
36 RenderViewHostDelegate* render_view_delegate, 35 RenderViewHostDelegate* render_view_delegate,
37 RenderWidgetHostDelegate* render_widget_delegate, 36 RenderWidgetHostDelegate* render_widget_delegate,
38 RenderFrameHostManager::Delegate* manager_delegate, 37 RenderFrameHostManager::Delegate* manager_delegate,
39 int64 frame_id,
40 const std::string& name); 38 const std::string& name);
41 39
42 ~FrameTreeNode(); 40 ~FrameTreeNode();
43 41
44 bool IsMainFrame() const; 42 bool IsMainFrame() const;
45 43
46 void AddChild(scoped_ptr<FrameTreeNode> child, int frame_routing_id); 44 void AddChild(scoped_ptr<FrameTreeNode> child, int frame_routing_id);
47 void RemoveChild(FrameTreeNode* child); 45 void RemoveChild(FrameTreeNode* child);
48 46
49 // Clears process specific-state in this node to prepare for a new process. 47 // Clears process specific-state in this node to prepare for a new process.
50 void ResetForNewProcess(); 48 void ResetForNewProcess();
51 49
52 FrameTree* frame_tree() const { 50 FrameTree* frame_tree() const {
53 return frame_tree_; 51 return frame_tree_;
54 } 52 }
55 53
56 Navigator* navigator() { 54 Navigator* navigator() {
57 return navigator_.get(); 55 return navigator_.get();
58 } 56 }
59 57
60 RenderFrameHostManager* render_manager() { 58 RenderFrameHostManager* render_manager() {
61 return &render_manager_; 59 return &render_manager_;
62 } 60 }
63 61
64 int64 frame_tree_node_id() const { 62 int64 frame_tree_node_id() const {
65 return frame_tree_node_id_; 63 return frame_tree_node_id_;
66 } 64 }
67 65
68 // DO NOT USE. Only used by FrameTree until we replace renderer-specific
69 // frame IDs with RenderFrameHost routing IDs.
70 void set_frame_id(int64 frame_id) {
71 DCHECK_EQ(frame_id_, kInvalidFrameId);
72 frame_id_ = frame_id;
73 }
74 int64 frame_id() const {
75 return frame_id_;
76 }
77
78 const std::string& frame_name() const { 66 const std::string& frame_name() const {
79 return frame_name_; 67 return frame_name_;
80 } 68 }
81 69
82 size_t child_count() const { 70 size_t child_count() const {
83 return children_.size(); 71 return children_.size();
84 } 72 }
85 73
86 FrameTreeNode* parent() const { return parent_; } 74 FrameTreeNode* parent() const { return parent_; }
87 75
(...skipping 29 matching lines...) Expand all
117 // Manages creation and swapping of RenderFrameHosts for this frame. This 105 // Manages creation and swapping of RenderFrameHosts for this frame. This
118 // must be declared before |children_| so that it gets deleted after them. 106 // must be declared before |children_| so that it gets deleted after them.
119 // That's currently necessary so that RenderFrameHostImpl's destructor can 107 // That's currently necessary so that RenderFrameHostImpl's destructor can
120 // call GetProcess. 108 // call GetProcess.
121 RenderFrameHostManager render_manager_; 109 RenderFrameHostManager render_manager_;
122 110
123 // A browser-global identifier for the frame in the page, which stays stable 111 // A browser-global identifier for the frame in the page, which stays stable
124 // even if the frame does a cross-process navigation. 112 // even if the frame does a cross-process navigation.
125 const int64 frame_tree_node_id_; 113 const int64 frame_tree_node_id_;
126 114
127 // The renderer-specific identifier for the frame in the page.
128 // TODO(creis): Remove this in favor of the RenderFrameHost's routing ID once
129 // we create FrameTreeNodes for all frames (even without a flag), since this
130 // value can change after cross-process navigations.
131 int64 frame_id_;
132
133 // The assigned name of the frame. This name can be empty, unlike the unique 115 // The assigned name of the frame. This name can be empty, unlike the unique
134 // name generated internally in the DOM tree. 116 // name generated internally in the DOM tree.
135 std::string frame_name_; 117 std::string frame_name_;
136 118
137 // The parent node of this frame. NULL if this node is the root or if it has 119 // The parent node of this frame. NULL if this node is the root or if it has
138 // not yet been attached to the frame tree. 120 // not yet been attached to the frame tree.
139 FrameTreeNode* parent_; 121 FrameTreeNode* parent_;
140 122
141 // The immediate children of this specific frame. 123 // The immediate children of this specific frame.
142 ScopedVector<FrameTreeNode> children_; 124 ScopedVector<FrameTreeNode> children_;
143 125
144 // Track the current frame's last committed URL, so we can estimate the 126 // Track the current frame's last committed URL, so we can estimate the
145 // process impact of out-of-process iframes. 127 // process impact of out-of-process iframes.
146 // TODO(creis): Remove this when we can store subframe URLs in the 128 // TODO(creis): Remove this when we can store subframe URLs in the
147 // NavigationController. 129 // NavigationController.
148 GURL current_url_; 130 GURL current_url_;
149 131
150 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); 132 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode);
151 }; 133 };
152 134
153 } // namespace content 135 } // namespace content
154 136
155 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 137 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree_browsertest.cc ('k') | content/browser/frame_host/frame_tree_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698