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/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "content/browser/frame_host/frame_tree.h" | 12 #include "content/browser/frame_host/frame_tree.h" |
13 #include "content/browser/frame_host/navigation_request.h" | 13 #include "content/browser/frame_host/navigation_request.h" |
14 #include "content/browser/frame_host/navigator.h" | 14 #include "content/browser/frame_host/navigator.h" |
15 #include "content/browser/frame_host/render_frame_host_impl.h" | 15 #include "content/browser/frame_host/render_frame_host_impl.h" |
16 #include "content/browser/renderer_host/render_view_host_impl.h" | 16 #include "content/browser/renderer_host/render_view_host_impl.h" |
17 #include "content/common/frame_messages.h" | 17 #include "content/common/frame_messages.h" |
| 18 #include "content/common/site_isolation_policy.h" |
18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 // This is a global map between frame_tree_node_ids and pointers to | 26 // This is a global map between frame_tree_node_ids and pointers to |
26 // FrameTreeNodes. | 27 // FrameTreeNodes. |
27 typedef base::hash_map<int, FrameTreeNode*> FrameTreeNodeIDMap; | 28 typedef base::hash_map<int, FrameTreeNode*> FrameTreeNodeIDMap; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 render_manager_.current_host()->GetSiteInstance()->GetBrowserContext(), | 133 render_manager_.current_host()->GetSiteInstance()->GetBrowserContext(), |
133 render_manager_.current_host()->GetSiteInstance(), | 134 render_manager_.current_host()->GetSiteInstance(), |
134 render_manager_.current_host()->GetRoutingID(), | 135 render_manager_.current_host()->GetRoutingID(), |
135 frame_routing_id); | 136 frame_routing_id); |
136 child->set_parent(this); | 137 child->set_parent(this); |
137 | 138 |
138 // Other renderer processes in this BrowsingInstance may need to find out | 139 // Other renderer processes in this BrowsingInstance may need to find out |
139 // about the new frame. Create a proxy for the child frame in all | 140 // about the new frame. Create a proxy for the child frame in all |
140 // SiteInstances that have a proxy for the frame's parent, since all frames | 141 // SiteInstances that have a proxy for the frame's parent, since all frames |
141 // in a frame tree should have the same set of proxies. | 142 // in a frame tree should have the same set of proxies. |
142 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 143 // TODO(alexmos, nick): We ought to do this for non-oopif too, for openers. |
143 switches::kSitePerProcess)) | 144 if (SiteIsolationPolicy::AreCrossProcessFramesPossible()) |
144 render_manager_.CreateProxiesForChildFrame(child.get()); | 145 render_manager_.CreateProxiesForChildFrame(child.get()); |
145 | 146 |
146 children_.push_back(child.release()); | 147 children_.push_back(child.release()); |
147 } | 148 } |
148 | 149 |
149 void FrameTreeNode::RemoveChild(FrameTreeNode* child) { | 150 void FrameTreeNode::RemoveChild(FrameTreeNode* child) { |
150 std::vector<FrameTreeNode*>::iterator iter; | 151 std::vector<FrameTreeNode*>::iterator iter; |
151 for (iter = children_.begin(); iter != children_.end(); ++iter) { | 152 for (iter = children_.begin(); iter != children_.end(); ++iter) { |
152 if ((*iter) == child) | 153 if ((*iter) == child) |
153 break; | 154 break; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 // TODO(nasko): see if child frames should send IPCs in site-per-process | 372 // TODO(nasko): see if child frames should send IPCs in site-per-process |
372 // mode. | 373 // mode. |
373 if (!IsMainFrame()) | 374 if (!IsMainFrame()) |
374 return true; | 375 return true; |
375 | 376 |
376 render_manager_.Stop(); | 377 render_manager_.Stop(); |
377 return true; | 378 return true; |
378 } | 379 } |
379 | 380 |
380 } // namespace content | 381 } // namespace content |
OLD | NEW |