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

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

Issue 972313002: Make <webview> use out-of-process iframe architecture. (Closed) Base URL: ssh://saopaulo.wat/mnt/dev/shared/src@testoopif2z-better-chrome
Patch Set: Address comments move destruction callback to GuestViewContainer Created 5 years, 6 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/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 RenderWidgetHostView* RenderFrameHostManager::GetRenderWidgetHostView() const { 140 RenderWidgetHostView* RenderFrameHostManager::GetRenderWidgetHostView() const {
141 if (interstitial_page_) 141 if (interstitial_page_)
142 return interstitial_page_->GetView(); 142 return interstitial_page_->GetView();
143 if (render_frame_host_) 143 if (render_frame_host_)
144 return render_frame_host_->GetView(); 144 return render_frame_host_->GetView();
145 return nullptr; 145 return nullptr;
146 } 146 }
147 147
148 bool RenderFrameHostManager::ForInnerDelegate() {
149 // TODO(lazyboy): Subframes inside inner WebContents needs to be tested and
150 // we have to make sure that IsMainFrame() check below is appropriate. See
151 // http://crbug.com/500957.
152 return frame_tree_node_->IsMainFrame() &&
153 delegate_->GetOuterDelegateFrameTreeNodeID() !=
154 FrameTreeNode::kFrameTreeNodeInvalidID;
155 }
156
157 RenderWidgetHostImpl*
158 RenderFrameHostManager::GetOuterRenderWidgetHostForKeyboardInput() {
159 if (!ForInnerDelegate())
160 return nullptr;
161
162 FrameTreeNode* outer_contents_frame_tree_node =
163 FrameTreeNode::GloballyFindByID(
164 delegate_->GetOuterDelegateFrameTreeNodeID());
165 return outer_contents_frame_tree_node->parent()
166 ->current_frame_host()
167 ->render_view_host();
168 }
169
148 RenderFrameProxyHost* RenderFrameHostManager::GetProxyToParent() { 170 RenderFrameProxyHost* RenderFrameHostManager::GetProxyToParent() {
149 if (frame_tree_node_->IsMainFrame()) 171 if (frame_tree_node_->IsMainFrame())
150 return NULL; 172 return NULL;
151 173
152 RenderFrameProxyHostMap::iterator iter = 174 RenderFrameProxyHostMap::iterator iter =
153 proxy_hosts_.find(frame_tree_node_->parent() 175 proxy_hosts_.find(frame_tree_node_->parent()
154 ->render_manager() 176 ->render_manager()
155 ->current_frame_host() 177 ->current_frame_host()
156 ->GetSiteInstance() 178 ->GetSiteInstance()
157 ->GetId()); 179 ->GetId());
158 if (iter == proxy_hosts_.end()) 180 if (iter == proxy_hosts_.end())
159 return NULL; 181 return NULL;
160 182
161 return iter->second; 183 return iter->second;
162 } 184 }
163 185
186 RenderFrameProxyHost* RenderFrameHostManager::GetProxyToOuterDelegate() {
187 int outer_contents_frame_tree_node_id =
188 delegate_->GetOuterDelegateFrameTreeNodeID();
189 FrameTreeNode* outer_contents_frame_tree_node =
190 FrameTreeNode::GloballyFindByID(outer_contents_frame_tree_node_id);
191 if (!outer_contents_frame_tree_node ||
192 !outer_contents_frame_tree_node->parent()) {
193 return nullptr;
194 }
195
196 return GetRenderFrameProxyHost(outer_contents_frame_tree_node->parent()
197 ->current_frame_host()
198 ->GetSiteInstance());
199 }
200
201 void RenderFrameHostManager::RemoveOuterDelegateFrame() {
202 FrameTreeNode* outer_delegate_frame_tree_node =
203 FrameTreeNode::GloballyFindByID(
204 delegate_->GetOuterDelegateFrameTreeNodeID());
205 DCHECK(outer_delegate_frame_tree_node->parent());
206 outer_delegate_frame_tree_node->frame_tree()->RemoveFrame(
207 outer_delegate_frame_tree_node);
208 }
209
164 void RenderFrameHostManager::SetPendingWebUI(const GURL& url, int bindings) { 210 void RenderFrameHostManager::SetPendingWebUI(const GURL& url, int bindings) {
165 pending_web_ui_ = CreateWebUI(url, bindings); 211 pending_web_ui_ = CreateWebUI(url, bindings);
166 pending_and_current_web_ui_.reset(); 212 pending_and_current_web_ui_.reset();
167 } 213 }
168 214
169 scoped_ptr<WebUIImpl> RenderFrameHostManager::CreateWebUI(const GURL& url, 215 scoped_ptr<WebUIImpl> RenderFrameHostManager::CreateWebUI(const GURL& url,
170 int bindings) { 216 int bindings) {
171 scoped_ptr<WebUIImpl> new_web_ui(delegate_->CreateWebUIForRenderManager(url)); 217 scoped_ptr<WebUIImpl> new_web_ui(delegate_->CreateWebUIForRenderManager(url));
172 218
173 // If we have assigned (zero or more) bindings to this NavigationEntry in the 219 // If we have assigned (zero or more) bindings to this NavigationEntry in the
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 return; 1686 return;
1641 1687
1642 // Recreate the opener chain. 1688 // Recreate the opener chain.
1643 int opener_route_id = CreateOpenerProxiesIfNeeded(instance); 1689 int opener_route_id = CreateOpenerProxiesIfNeeded(instance);
1644 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); 1690 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance);
1645 InitRenderView(render_view_host, opener_route_id, proxy->GetRoutingID(), 1691 InitRenderView(render_view_host, opener_route_id, proxy->GetRoutingID(),
1646 false); 1692 false);
1647 proxy->set_render_frame_proxy_created(true); 1693 proxy->set_render_frame_proxy_created(true);
1648 } 1694 }
1649 1695
1696 void RenderFrameHostManager::CreateOuterDelegateProxy(
1697 SiteInstance* outer_contents_site_instance,
1698 RenderFrameHostImpl* render_frame_host) {
1699 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
1700 switches::kSitePerProcess));
1701 RenderFrameProxyHost* proxy = new RenderFrameProxyHost(
1702 outer_contents_site_instance, nullptr, frame_tree_node_);
1703 proxy_hosts_[outer_contents_site_instance->GetId()] = proxy;
1704
1705 // Swap the outer WebContents's frame with the proxy to inner WebContents.
1706 //
1707 // We are in the outer WebContents, and its FrameTree would never see
1708 // a load start for any of its inner WebContents. Eventually, that also makes
1709 // the FrameTree never see the matching load stop. Therefore, we always pass
1710 // false to |is_loading| below.
1711 // TODO(lazyboy): This |is_loading| behavior might not be what we want,
1712 // investigate and fix.
1713 render_frame_host->Send(new FrameMsg_SwapOut(
1714 render_frame_host->GetRoutingID(), proxy->GetRoutingID(),
1715 false /* is_loading */, FrameReplicationState()));
1716 proxy->set_render_frame_proxy_created(true);
1717 }
1718
1719 void RenderFrameHostManager::SetRWHViewForInnerContents(
1720 RenderWidgetHostView* child_rwhv) {
1721 DCHECK(ForInnerDelegate());
1722 GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv);
1723 }
1724
1650 bool RenderFrameHostManager::InitRenderView( 1725 bool RenderFrameHostManager::InitRenderView(
1651 RenderViewHostImpl* render_view_host, 1726 RenderViewHostImpl* render_view_host,
1652 int opener_route_id, 1727 int opener_route_id,
1653 int proxy_routing_id, 1728 int proxy_routing_id,
1654 bool for_main_frame_navigation) { 1729 bool for_main_frame_navigation) {
1655 // Ensure the renderer process is initialized before creating the 1730 // Ensure the renderer process is initialized before creating the
1656 // RenderView. 1731 // RenderView.
1657 if (!render_view_host->GetProcess()->Init()) 1732 if (!render_view_host->GetProcess()->Init())
1658 return false; 1733 return false;
1659 1734
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 frame_tree->root()->render_manager()-> 2313 frame_tree->root()->render_manager()->
2239 CreateRenderFrame(instance, nullptr, opener_route_id, 2314 CreateRenderFrame(instance, nullptr, opener_route_id,
2240 CREATE_RF_FOR_MAIN_FRAME_NAVIGATION | 2315 CREATE_RF_FOR_MAIN_FRAME_NAVIGATION |
2241 CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN, 2316 CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN,
2242 &render_view_routing_id); 2317 &render_view_routing_id);
2243 } 2318 }
2244 return render_view_routing_id; 2319 return render_view_routing_id;
2245 } 2320 }
2246 2321
2247 } // namespace content 2322 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698