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

Side by Side Diff: content/browser/frame_host/frame_tree.cc

Issue 117603002: Always create FrameTreeNodes and RenderFrameHosts for every frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix prerendering. Created 6 years, 11 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 #include "content/browser/frame_host/frame_tree.h" 5 #include "content/browser/frame_host/frame_tree.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const std::string& frame_name) { 103 const std::string& frame_name) {
104 FrameTreeNode* parent = FindByFrameID(parent_frame_id); 104 FrameTreeNode* parent = FindByFrameID(parent_frame_id);
105 // TODO(ajwong): Should the renderer be killed here? Would there be a race on 105 // TODO(ajwong): Should the renderer be killed here? Would there be a race on
106 // shutdown that might make this case possible? 106 // shutdown that might make this case possible?
107 if (!parent) 107 if (!parent)
108 return NULL; 108 return NULL;
109 109
110 scoped_ptr<FrameTreeNode> node(new FrameTreeNode( 110 scoped_ptr<FrameTreeNode> node(new FrameTreeNode(
111 this, parent->navigator(), render_frame_delegate_, render_view_delegate_, 111 this, parent->navigator(), render_frame_delegate_, render_view_delegate_,
112 render_widget_delegate_, manager_delegate_, frame_id, frame_name)); 112 render_widget_delegate_, manager_delegate_, frame_id, frame_name));
113 RenderFrameHostImpl* render_frame = node->current_frame_host(); 113 FrameTreeNode* node_ptr = node.get();
114 // AddChild is what creates the RenderFrameHost.
114 parent->AddChild(node.Pass(), frame_routing_id); 115 parent->AddChild(node.Pass(), frame_routing_id);
115 return render_frame; 116 return node_ptr->current_frame_host();
116 } 117 }
117 118
118 void FrameTree::RemoveFrame(RenderFrameHostImpl* render_frame_host, 119 void FrameTree::RemoveFrame(RenderFrameHostImpl* render_frame_host,
119 int64 parent_frame_id, 120 int64 parent_frame_id,
120 int64 frame_id) { 121 int64 frame_id) {
121 // If switches::kSitePerProcess is not specified, then the FrameTree only 122 // If switches::kSitePerProcess is not specified, then the FrameTree only
122 // contains a node for the root element. However, even in this case 123 // contains a node for the root element. However, even in this case
123 // frame detachments need to be broadcast outwards. 124 // frame detachments need to be broadcast outwards.
124 // 125 //
125 // TODO(ajwong): Move this below the |parent| check after the FrameTree is 126 // TODO(ajwong): Move this below the |parent| check after the FrameTree is
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } 235 }
235 } 236 }
236 237
237 FrameTreeNode* FrameTree::FindByFrameID(int64 frame_id) { 238 FrameTreeNode* FrameTree::FindByFrameID(int64 frame_id) {
238 FrameTreeNode* node = NULL; 239 FrameTreeNode* node = NULL;
239 ForEach(base::Bind(&FrameTreeNodeForFrameId, frame_id, &node)); 240 ForEach(base::Bind(&FrameTreeNodeForFrameId, frame_id, &node));
240 return node; 241 return node;
241 } 242 }
242 243
243 } // namespace content 244 } // namespace content
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_render_frame_observer.cc ('k') | content/browser/frame_host/frame_tree_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698