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

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

Powered by Google App Engine
This is Rietveld 408576698