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

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 from nasko@ + git cl format 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 RenderWidgetHostView* RenderFrameHostManager::GetRenderWidgetHostView() const { 139 RenderWidgetHostView* RenderFrameHostManager::GetRenderWidgetHostView() const {
140 if (interstitial_page_) 140 if (interstitial_page_)
141 return interstitial_page_->GetView(); 141 return interstitial_page_->GetView();
142 if (render_frame_host_) 142 if (render_frame_host_)
143 return render_frame_host_->GetView(); 143 return render_frame_host_->GetView();
144 return nullptr; 144 return nullptr;
145 } 145 }
146 146
147 RenderWidgetHostImpl*
148 RenderFrameHostManager::GetOuterRenderWidgetHostForKeyboardInput() {
149 if (!ForInnerDelegate())
150 return nullptr;
151
152 FrameTreeNode* outer_contents_frame_tree_node =
153 FrameTreeNode::GloballyFindByID(
154 delegate_->GetOuterDelegateFrameTreeNodeID());
155 return outer_contents_frame_tree_node->parent()
156 ->current_frame_host()
157 ->render_view_host();
158 }
159
147 RenderFrameProxyHost* RenderFrameHostManager::GetProxyToParent() { 160 RenderFrameProxyHost* RenderFrameHostManager::GetProxyToParent() {
148 if (frame_tree_node_->IsMainFrame()) 161 if (frame_tree_node_->IsMainFrame())
149 return NULL; 162 return NULL;
150 163
151 RenderFrameProxyHostMap::iterator iter = 164 RenderFrameProxyHostMap::iterator iter =
152 proxy_hosts_.find(frame_tree_node_->parent() 165 proxy_hosts_.find(frame_tree_node_->parent()
153 ->render_manager() 166 ->render_manager()
154 ->current_frame_host() 167 ->current_frame_host()
155 ->GetSiteInstance() 168 ->GetSiteInstance()
156 ->GetId()); 169 ->GetId());
157 if (iter == proxy_hosts_.end()) 170 if (iter == proxy_hosts_.end())
158 return NULL; 171 return NULL;
159 172
160 return iter->second; 173 return iter->second;
161 } 174 }
162 175
176 RenderFrameProxyHost* RenderFrameHostManager::GetProxyToOuterDelegate() {
177 int outer_contents_frame_tree_node_id =
178 delegate_->GetOuterDelegateFrameTreeNodeID();
179 FrameTreeNode* outer_contents_frame_tree_node =
180 FrameTreeNode::GloballyFindByID(outer_contents_frame_tree_node_id);
181 if (!outer_contents_frame_tree_node ||
182 !outer_contents_frame_tree_node->parent()) {
183 return nullptr;
184 }
185
186 return GetRenderFrameProxyHost(outer_contents_frame_tree_node->parent()
187 ->current_frame_host()
188 ->GetSiteInstance());
189 }
190
191 bool RenderFrameHostManager::ForInnerDelegate() {
192 // TODO(lazyboy): Subframes inside inner WebContents needs to be tested and
193 // we have to make sure that IsMainFrame() check below is appropriate. See
194 // http://crbug.com/500957.
195 return frame_tree_node_->IsMainFrame() &&
196 delegate_->GetOuterDelegateFrameTreeNodeID() !=
197 FrameTreeNode::kFrameTreeNodeInvalidID;
198 }
199
200 void RenderFrameHostManager::RemoveOuterDelegateFrame() {
201 FrameTreeNode* outer_delegate_frame_tree_node =
202 FrameTreeNode::GloballyFindByID(
203 delegate_->GetOuterDelegateFrameTreeNodeID());
204 DCHECK(outer_delegate_frame_tree_node->parent());
205 outer_delegate_frame_tree_node->frame_tree()->RemoveFrame(
206 outer_delegate_frame_tree_node);
207 }
208
163 void RenderFrameHostManager::SetPendingWebUI(const GURL& url, int bindings) { 209 void RenderFrameHostManager::SetPendingWebUI(const GURL& url, int bindings) {
164 pending_web_ui_ = CreateWebUI(url, bindings); 210 pending_web_ui_ = CreateWebUI(url, bindings);
165 pending_and_current_web_ui_.reset(); 211 pending_and_current_web_ui_.reset();
166 } 212 }
167 213
168 scoped_ptr<WebUIImpl> RenderFrameHostManager::CreateWebUI(const GURL& url, 214 scoped_ptr<WebUIImpl> RenderFrameHostManager::CreateWebUI(const GURL& url,
169 int bindings) { 215 int bindings) {
170 scoped_ptr<WebUIImpl> new_web_ui(delegate_->CreateWebUIForRenderManager(url)); 216 scoped_ptr<WebUIImpl> new_web_ui(delegate_->CreateWebUIForRenderManager(url));
171 217
172 // If we have assigned (zero or more) bindings to this NavigationEntry in the 218 // If we have assigned (zero or more) bindings to this NavigationEntry in the
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 1687
1642 // Recreate the opener chain. 1688 // Recreate the opener chain.
1643 int opener_route_id = 1689 int opener_route_id =
1644 delegate_->CreateOpenerRenderViewsForRenderManager(instance); 1690 delegate_->CreateOpenerRenderViewsForRenderManager(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 source->IsMainFrame()); 1693 source->IsMainFrame());
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 render_frame_host->Send(new FrameMsg_SwapOut(
Charlie Reis 2015/06/18 00:13:18 Let's put a comment here (and/or the declaration)
lazyboy 2015/06/18 22:45:12 Done.
1707 render_frame_host->GetRoutingID(), proxy->GetRoutingID(),
1708 false /* is_loading */, FrameReplicationState()));
1709 proxy->set_render_frame_proxy_created(true);
1710 }
1711
1712 void RenderFrameHostManager::SetRWHViewForInnerContents(
1713 RenderWidgetHostView* child_rwhv) {
1714 DCHECK(ForInnerDelegate());
1715 GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv);
1716 }
1717
1651 bool RenderFrameHostManager::InitRenderView( 1718 bool RenderFrameHostManager::InitRenderView(
1652 RenderViewHostImpl* render_view_host, 1719 RenderViewHostImpl* render_view_host,
1653 int opener_route_id, 1720 int opener_route_id,
1654 int proxy_routing_id, 1721 int proxy_routing_id,
1655 bool for_main_frame_navigation) { 1722 bool for_main_frame_navigation) {
1656 // Ensure the renderer process is initialized before creating the 1723 // Ensure the renderer process is initialized before creating the
1657 // RenderView. 1724 // RenderView.
1658 if (!render_view_host->GetProcess()->Init()) 1725 if (!render_view_host->GetProcess()->Init())
1659 return false; 1726 return false;
1660 1727
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 void RenderFrameHostManager::DeleteRenderFrameProxyHost( 2251 void RenderFrameHostManager::DeleteRenderFrameProxyHost(
2185 SiteInstance* instance) { 2252 SiteInstance* instance) {
2186 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); 2253 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId());
2187 if (iter != proxy_hosts_.end()) { 2254 if (iter != proxy_hosts_.end()) {
2188 delete iter->second; 2255 delete iter->second;
2189 proxy_hosts_.erase(iter); 2256 proxy_hosts_.erase(iter);
2190 } 2257 }
2191 } 2258 }
2192 2259
2193 } // namespace content 2260 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698