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

Side by Side Diff: content/browser/frame_host/frame_tree_node.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
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_node.h" 5 #include "content/browser/frame_host/frame_tree_node.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 24 matching lines...) Expand all
35 parent_(NULL) {} 35 parent_(NULL) {}
36 36
37 FrameTreeNode::~FrameTreeNode() { 37 FrameTreeNode::~FrameTreeNode() {
38 } 38 }
39 39
40 bool FrameTreeNode::IsMainFrame() const { 40 bool FrameTreeNode::IsMainFrame() const {
41 return frame_tree_->root() == this; 41 return frame_tree_->root() == this;
42 } 42 }
43 43
44 void FrameTreeNode::AddChild(scoped_ptr<FrameTreeNode> child, 44 void FrameTreeNode::AddChild(scoped_ptr<FrameTreeNode> child,
45 int process_id,
46 int frame_routing_id) { 45 int frame_routing_id) {
47 // Child frame must always be created in the same process as the parent.
48 CHECK_EQ(process_id, render_manager_.current_host()->GetProcess()->GetID());
49
50 // Initialize the RenderFrameHost for the new node. We always create child 46 // Initialize the RenderFrameHost for the new node. We always create child
51 // frames in the same SiteInstance as the current frame, and they can swap to 47 // frames in the same SiteInstance as the current frame, and they can swap to
52 // a different one if they navigate away. 48 // a different one if they navigate away.
53 child->render_manager()->Init( 49 child->render_manager()->Init(
54 render_manager_.current_host()->GetSiteInstance()->GetBrowserContext(), 50 render_manager_.current_host()->GetSiteInstance()->GetBrowserContext(),
55 render_manager_.current_host()->GetSiteInstance(), 51 render_manager_.current_host()->GetSiteInstance(),
56 render_manager_.current_host()->GetRoutingID(), 52 render_manager_.current_host()->GetRoutingID(),
57 frame_routing_id); 53 frame_routing_id);
58 child->set_parent(this); 54 child->set_parent(this);
59 children_.push_back(child.release()); 55 children_.push_back(child.release());
(...skipping 24 matching lines...) Expand all
84 current_frame_host()->set_render_frame_created(false); 80 current_frame_host()->set_render_frame_created(false);
85 81
86 // The children may not have been cleared if a cross-process navigation 82 // The children may not have been cleared if a cross-process navigation
87 // commits before the old process cleans everything up. Make sure the child 83 // commits before the old process cleans everything up. Make sure the child
88 // nodes get deleted before swapping to a new process. 84 // nodes get deleted before swapping to a new process.
89 ScopedVector<FrameTreeNode> old_children = children_.Pass(); 85 ScopedVector<FrameTreeNode> old_children = children_.Pass();
90 old_children.clear(); // May notify observers. 86 old_children.clear(); // May notify observers.
91 } 87 }
92 88
93 } // namespace content 89 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree_node.h ('k') | content/browser/frame_host/frame_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698