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

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

Issue 642813007: Drop CreateChildFrame messages when swapping out. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another round of fixes. 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,
146 int new_routing_id, 147 int new_routing_id,
147 const std::string& frame_name) { 148 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
148 scoped_ptr<FrameTreeNode> node(new FrameTreeNode( 156 scoped_ptr<FrameTreeNode> node(new FrameTreeNode(
149 this, parent->navigator(), render_frame_delegate_, render_view_delegate_, 157 this, parent->navigator(), render_frame_delegate_, render_view_delegate_,
150 render_widget_delegate_, manager_delegate_, frame_name)); 158 render_widget_delegate_, manager_delegate_, frame_name));
151 std::pair<FrameTreeNodeIDMap::iterator, bool> result = 159 std::pair<FrameTreeNodeIDMap::iterator, bool> result =
152 g_frame_tree_node_id_map.Get().insert( 160 g_frame_tree_node_id_map.Get().insert(
153 std::make_pair(node->frame_tree_node_id(), node.get())); 161 std::make_pair(node->frame_tree_node_id(), node.get()));
154 CHECK(result.second); 162 CHECK(result.second);
155 FrameTreeNode* node_ptr = node.get(); 163 FrameTreeNode* node_ptr = node.get();
156 // AddChild is what creates the RenderFrameHost. 164 // AddChild is what creates the RenderFrameHost.
157 parent->AddChild(node.Pass(), new_routing_id); 165 parent->AddChild(node.Pass(), process_id, new_routing_id);
158 return node_ptr->current_frame_host(); 166 return node_ptr->current_frame_host();
159 } 167 }
160 168
161 void FrameTree::RemoveFrame(FrameTreeNode* child) { 169 void FrameTree::RemoveFrame(FrameTreeNode* child) {
162 FrameTreeNode* parent = child->parent(); 170 FrameTreeNode* parent = child->parent();
163 if (!parent) { 171 if (!parent) {
164 NOTREACHED() << "Unexpected RemoveFrame call for main frame."; 172 NOTREACHED() << "Unexpected RemoveFrame call for main frame.";
165 return; 173 return;
166 } 174 }
167 175
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 rvh->Shutdown(); 332 rvh->Shutdown();
325 render_view_host_pending_shutdown_map_.erase(multi_iter); 333 render_view_host_pending_shutdown_map_.erase(multi_iter);
326 } 334 }
327 break; 335 break;
328 } 336 }
329 CHECK(render_view_host_found); 337 CHECK(render_view_host_found);
330 } 338 }
331 } 339 }
332 340
333 } // namespace content 341 } // 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