Index: content/browser/frame_host/render_frame_proxy_host.cc |
diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc |
index 0a27c9e5be6bfd471ca680bbef2cd002ed4d3a23..a72085b046b58291926aed06f0e20f4a810a281f 100644 |
--- a/content/browser/frame_host/render_frame_proxy_host.cc |
+++ b/content/browser/frame_host/render_frame_proxy_host.cc |
@@ -58,13 +58,21 @@ RenderFrameProxyHost::RenderFrameProxyHost(SiteInstance* site_instance, |
RenderFrameProxyHostID(GetProcess()->GetID(), routing_id_), |
this)).second); |
CHECK(render_view_host_); |
- frame_tree_node_->frame_tree()->AddRenderViewHostRef(render_view_host_); |
- |
- if (!frame_tree_node_->IsMainFrame() && |
- frame_tree_node_->parent() |
- ->render_manager() |
- ->current_frame_host() |
- ->GetSiteInstance() == site_instance) { |
+ // TODO(lazyboy): Comment why we skip this. |
+ if (!frame_tree_node_->render_manager()->ForInnerDelegate()) |
+ frame_tree_node_->frame_tree()->AddRenderViewHostRef(render_view_host_); |
+ |
+ bool is_proxy_to_parent = !frame_tree_node_->IsMainFrame() && |
+ frame_tree_node_->parent() |
+ ->render_manager() |
+ ->current_frame_host() |
+ ->GetSiteInstance() == site_instance; |
+ |
+ // If this is a proxy to parent frame or this proxy is for the inner |
+ // WebContents's FrameTreeNode in outer WebContents's process, then we need a |
+ // CrossProcessFrameConnector. |
+ if (is_proxy_to_parent || |
+ frame_tree_node_->render_manager()->ForInnerDelegate()) { |
// The RenderFrameHost navigating cross-process is destroyed and a proxy for |
// it is created in the parent's process. CrossProcessFrameConnector |
// initialization only needs to happen on an initial cross-process |
@@ -86,7 +94,9 @@ RenderFrameProxyHost::~RenderFrameProxyHost() { |
Send(new FrameMsg_DeleteProxy(routing_id_)); |
} |
- frame_tree_node_->frame_tree()->ReleaseRenderViewHostRef(render_view_host_); |
+ // TODO(lazyboy): Comment why we skip this. |
+ if (!frame_tree_node_->render_manager()->ForInnerDelegate()) |
+ frame_tree_node_->frame_tree()->ReleaseRenderViewHostRef(render_view_host_); |
GetProcess()->RemoveRoute(routing_id_); |
g_routing_id_frame_proxy_map.Get().erase( |
RenderFrameProxyHostID(GetProcess()->GetID(), routing_id_)); |
@@ -185,6 +195,11 @@ void RenderFrameProxyHost::DisownOpener() { |
} |
void RenderFrameProxyHost::OnDetach() { |
+ if (frame_tree_node_->render_manager()->ForInnerDelegate()) { |
+ frame_tree_node_->render_manager()->RemoveOuterDelegateFrame(); |
+ return; |
+ } |
+ |
// This message should only be received for subframes. Note that we can't |
// restrict it to just the current SiteInstances of the ancestors of this |
// frame, because another frame in the tree may be able to detach this frame |