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

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

Issue 663183003: Revert of Drop CreateChildFrame messages when swapping out. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2171
Patch Set: Created 6 years, 2 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
« no previous file with comments | « content/browser/frame_host/frame_tree.h ('k') | content/browser/frame_host/frame_tree_node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 queue.pop(); 136 queue.pop();
137 if (!on_node.Run(node)) 137 if (!on_node.Run(node))
138 break; 138 break;
139 139
140 for (size_t i = 0; i < node->child_count(); ++i) 140 for (size_t i = 0; i < node->child_count(); ++i)
141 queue.push(node->child_at(i)); 141 queue.push(node->child_at(i));
142 } 142 }
143 } 143 }
144 144
145 RenderFrameHostImpl* FrameTree::AddFrame(FrameTreeNode* parent, 145 RenderFrameHostImpl* FrameTree::AddFrame(FrameTreeNode* parent,
146 int process_id,
147 int new_routing_id, 146 int new_routing_id,
148 const std::string& frame_name) { 147 const std::string& frame_name) {
149 // A child frame always starts with an initial empty document, which means
150 // it is in the same SiteInstance as the parent frame. Ensure that the process
151 // which requested a child frame to be added is the same as the process of the
152 // parent node.
153 if (parent->current_frame_host()->GetProcess()->GetID() != process_id)
154 return nullptr;
155
156 scoped_ptr<FrameTreeNode> node(new FrameTreeNode( 148 scoped_ptr<FrameTreeNode> node(new FrameTreeNode(
157 this, parent->navigator(), render_frame_delegate_, render_view_delegate_, 149 this, parent->navigator(), render_frame_delegate_, render_view_delegate_,
158 render_widget_delegate_, manager_delegate_, frame_name)); 150 render_widget_delegate_, manager_delegate_, frame_name));
159 std::pair<FrameTreeNodeIDMap::iterator, bool> result = 151 std::pair<FrameTreeNodeIDMap::iterator, bool> result =
160 g_frame_tree_node_id_map.Get().insert( 152 g_frame_tree_node_id_map.Get().insert(
161 std::make_pair(node->frame_tree_node_id(), node.get())); 153 std::make_pair(node->frame_tree_node_id(), node.get()));
162 CHECK(result.second); 154 CHECK(result.second);
163 FrameTreeNode* node_ptr = node.get(); 155 FrameTreeNode* node_ptr = node.get();
164 // AddChild is what creates the RenderFrameHost. 156 // AddChild is what creates the RenderFrameHost.
165 parent->AddChild(node.Pass(), process_id, new_routing_id); 157 parent->AddChild(node.Pass(), new_routing_id);
166 return node_ptr->current_frame_host(); 158 return node_ptr->current_frame_host();
167 } 159 }
168 160
169 void FrameTree::RemoveFrame(FrameTreeNode* child) { 161 void FrameTree::RemoveFrame(FrameTreeNode* child) {
170 FrameTreeNode* parent = child->parent(); 162 FrameTreeNode* parent = child->parent();
171 if (!parent) { 163 if (!parent) {
172 NOTREACHED() << "Unexpected RemoveFrame call for main frame."; 164 NOTREACHED() << "Unexpected RemoveFrame call for main frame.";
173 return; 165 return;
174 } 166 }
175 167
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 rvh->Shutdown(); 322 rvh->Shutdown();
331 render_view_host_pending_shutdown_map_.erase(multi_iter); 323 render_view_host_pending_shutdown_map_.erase(multi_iter);
332 } 324 }
333 break; 325 break;
334 } 326 }
335 CHECK(render_view_host_found); 327 CHECK(render_view_host_found);
336 } 328 }
337 } 329 }
338 330
339 } // namespace content 331 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree.h ('k') | content/browser/frame_host/frame_tree_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698