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

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

Issue 938073002: Clarify comment on FrameTree::AddFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « content/browser/frame_host/frame_tree.h ('k') | no next file » | 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 144
145 RenderFrameHostImpl* FrameTree::AddFrame(FrameTreeNode* parent, 145 RenderFrameHostImpl* FrameTree::AddFrame(FrameTreeNode* parent,
146 int process_id, 146 int process_id,
147 int new_routing_id, 147 int new_routing_id,
148 const std::string& frame_name) { 148 const std::string& frame_name) {
149 // A child frame always starts with an initial empty document, which means 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 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 151 // which requested a child frame to be added is the same as the process of the
152 // parent node. 152 // parent node.
153 // We return nullptr if this is not the case, which can happen in a race if an
154 // old RFH sends a CreateChildFrame message as we're swapping to a new RFH.
153 if (parent->current_frame_host()->GetProcess()->GetID() != process_id) 155 if (parent->current_frame_host()->GetProcess()->GetID() != process_id)
154 return nullptr; 156 return nullptr;
155 157
156 scoped_ptr<FrameTreeNode> node(new FrameTreeNode( 158 scoped_ptr<FrameTreeNode> node(new FrameTreeNode(
157 this, parent->navigator(), render_frame_delegate_, render_view_delegate_, 159 this, parent->navigator(), render_frame_delegate_, render_view_delegate_,
158 render_widget_delegate_, manager_delegate_, frame_name)); 160 render_widget_delegate_, manager_delegate_, frame_name));
159 std::pair<FrameTreeNodeIDMap::iterator, bool> result = 161 std::pair<FrameTreeNodeIDMap::iterator, bool> result =
160 g_frame_tree_node_id_map.Get().insert( 162 g_frame_tree_node_id_map.Get().insert(
161 std::make_pair(node->frame_tree_node_id(), node.get())); 163 std::make_pair(node->frame_tree_node_id(), node.get()));
162 CHECK(result.second); 164 CHECK(result.second);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 rvh->Shutdown(); 327 rvh->Shutdown();
326 render_view_host_pending_shutdown_map_.erase(multi_iter); 328 render_view_host_pending_shutdown_map_.erase(multi_iter);
327 } 329 }
328 break; 330 break;
329 } 331 }
330 CHECK(render_view_host_found); 332 CHECK(render_view_host_found);
331 } 333 }
332 } 334 }
333 335
334 } // namespace content 336 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698