| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 switches::kEnableBrowserSideNavigation)) { | 41 switches::kEnableBrowserSideNavigation)) { |
| 42 navigator_->CancelNavigation(this); | 42 navigator_->CancelNavigation(this); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool FrameTreeNode::IsMainFrame() const { | 46 bool FrameTreeNode::IsMainFrame() const { |
| 47 return frame_tree_->root() == this; | 47 return frame_tree_->root() == this; |
| 48 } | 48 } |
| 49 | 49 |
| 50 void FrameTreeNode::AddChild(scoped_ptr<FrameTreeNode> child, | 50 void FrameTreeNode::AddChild(scoped_ptr<FrameTreeNode> child, |
| 51 int process_id, |
| 51 int frame_routing_id) { | 52 int frame_routing_id) { |
| 53 // Child frame must always be created in the same process as the parent. |
| 54 CHECK_EQ(process_id, render_manager_.current_host()->GetProcess()->GetID()); |
| 55 |
| 52 // Initialize the RenderFrameHost for the new node. We always create child | 56 // Initialize the RenderFrameHost for the new node. We always create child |
| 53 // frames in the same SiteInstance as the current frame, and they can swap to | 57 // frames in the same SiteInstance as the current frame, and they can swap to |
| 54 // a different one if they navigate away. | 58 // a different one if they navigate away. |
| 55 child->render_manager()->Init( | 59 child->render_manager()->Init( |
| 56 render_manager_.current_host()->GetSiteInstance()->GetBrowserContext(), | 60 render_manager_.current_host()->GetSiteInstance()->GetBrowserContext(), |
| 57 render_manager_.current_host()->GetSiteInstance(), | 61 render_manager_.current_host()->GetSiteInstance(), |
| 58 render_manager_.current_host()->GetRoutingID(), | 62 render_manager_.current_host()->GetRoutingID(), |
| 59 frame_routing_id); | 63 frame_routing_id); |
| 60 child->set_parent(this); | 64 child->set_parent(this); |
| 61 children_.push_back(child.release()); | 65 children_.push_back(child.release()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 86 current_frame_host()->set_render_frame_created(false); | 90 current_frame_host()->set_render_frame_created(false); |
| 87 | 91 |
| 88 // The children may not have been cleared if a cross-process navigation | 92 // The children may not have been cleared if a cross-process navigation |
| 89 // commits before the old process cleans everything up. Make sure the child | 93 // commits before the old process cleans everything up. Make sure the child |
| 90 // nodes get deleted before swapping to a new process. | 94 // nodes get deleted before swapping to a new process. |
| 91 ScopedVector<FrameTreeNode> old_children = children_.Pass(); | 95 ScopedVector<FrameTreeNode> old_children = children_.Pass(); |
| 92 old_children.clear(); // May notify observers. | 96 old_children.clear(); // May notify observers. |
| 93 } | 97 } |
| 94 | 98 |
| 95 } // namespace content | 99 } // namespace content |
| OLD | NEW |