OLD | NEW |
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 Loading... |
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, |
45 int frame_routing_id) { | 46 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 |
46 // Initialize the RenderFrameHost for the new node. We always create child | 50 // Initialize the RenderFrameHost for the new node. We always create child |
47 // frames in the same SiteInstance as the current frame, and they can swap to | 51 // frames in the same SiteInstance as the current frame, and they can swap to |
48 // a different one if they navigate away. | 52 // a different one if they navigate away. |
49 child->render_manager()->Init( | 53 child->render_manager()->Init( |
50 render_manager_.current_host()->GetSiteInstance()->GetBrowserContext(), | 54 render_manager_.current_host()->GetSiteInstance()->GetBrowserContext(), |
51 render_manager_.current_host()->GetSiteInstance(), | 55 render_manager_.current_host()->GetSiteInstance(), |
52 render_manager_.current_host()->GetRoutingID(), | 56 render_manager_.current_host()->GetRoutingID(), |
53 frame_routing_id); | 57 frame_routing_id); |
54 child->set_parent(this); | 58 child->set_parent(this); |
55 children_.push_back(child.release()); | 59 children_.push_back(child.release()); |
(...skipping 24 matching lines...) Expand all Loading... |
80 current_frame_host()->set_render_frame_created(false); | 84 current_frame_host()->set_render_frame_created(false); |
81 | 85 |
82 // The children may not have been cleared if a cross-process navigation | 86 // The children may not have been cleared if a cross-process navigation |
83 // commits before the old process cleans everything up. Make sure the child | 87 // commits before the old process cleans everything up. Make sure the child |
84 // nodes get deleted before swapping to a new process. | 88 // nodes get deleted before swapping to a new process. |
85 ScopedVector<FrameTreeNode> old_children = children_.Pass(); | 89 ScopedVector<FrameTreeNode> old_children = children_.Pass(); |
86 old_children.clear(); // May notify observers. | 90 old_children.clear(); // May notify observers. |
87 } | 91 } |
88 | 92 |
89 } // namespace content | 93 } // namespace content |
OLD | NEW |