| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_proxy_host.h" | 5 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "content/browser/bad_message.h" | 8 #include "content/browser/bad_message.h" |
| 9 #include "content/browser/frame_host/cross_process_frame_connector.h" | 9 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 render_frame_proxy_created_(false), | 53 render_frame_proxy_created_(false), |
| 54 render_view_host_(render_view_host) { | 54 render_view_host_(render_view_host) { |
| 55 GetProcess()->AddRoute(routing_id_, this); | 55 GetProcess()->AddRoute(routing_id_, this); |
| 56 CHECK(g_routing_id_frame_proxy_map.Get().insert( | 56 CHECK(g_routing_id_frame_proxy_map.Get().insert( |
| 57 std::make_pair( | 57 std::make_pair( |
| 58 RenderFrameProxyHostID(GetProcess()->GetID(), routing_id_), | 58 RenderFrameProxyHostID(GetProcess()->GetID(), routing_id_), |
| 59 this)).second); | 59 this)).second); |
| 60 CHECK(render_view_host_); | 60 CHECK(render_view_host_); |
| 61 frame_tree_node_->frame_tree()->AddRenderViewHostRef(render_view_host_); | 61 frame_tree_node_->frame_tree()->AddRenderViewHostRef(render_view_host_); |
| 62 | 62 |
| 63 if (!frame_tree_node_->IsMainFrame() && | 63 bool is_proxy_to_parent = !frame_tree_node_->IsMainFrame() && |
| 64 frame_tree_node_->parent() | 64 frame_tree_node_->parent() |
| 65 ->render_manager() | 65 ->render_manager() |
| 66 ->current_frame_host() | 66 ->current_frame_host() |
| 67 ->GetSiteInstance() == site_instance) { | 67 ->GetSiteInstance() == site_instance; |
| 68 |
| 69 // If this is a proxy to parent frame or this proxy is for the inner |
| 70 // WebContents's FrameTreeNode in outer WebContents's process, then we need a |
| 71 // CrossProcessFrameConnector. |
| 72 if (is_proxy_to_parent || |
| 73 frame_tree_node_->render_manager()->ForInnerDelegate()) { |
| 68 // The RenderFrameHost navigating cross-process is destroyed and a proxy for | 74 // The RenderFrameHost navigating cross-process is destroyed and a proxy for |
| 69 // it is created in the parent's process. CrossProcessFrameConnector | 75 // it is created in the parent's process. CrossProcessFrameConnector |
| 70 // initialization only needs to happen on an initial cross-process | 76 // initialization only needs to happen on an initial cross-process |
| 71 // navigation, when the RenderFrameHost leaves the same process as its | 77 // navigation, when the RenderFrameHost leaves the same process as its |
| 72 // parent. The same CrossProcessFrameConnector is used for subsequent cross- | 78 // parent. The same CrossProcessFrameConnector is used for subsequent cross- |
| 73 // process navigations, but it will be destroyed if the frame is | 79 // process navigations, but it will be destroyed if the frame is |
| 74 // navigated back to the same SiteInstance as its parent. | 80 // navigated back to the same SiteInstance as its parent. |
| 75 cross_process_frame_connector_.reset(new CrossProcessFrameConnector(this)); | 81 cross_process_frame_connector_.reset(new CrossProcessFrameConnector(this)); |
| 76 } | 82 } |
| 77 } | 83 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 base::Bind(&MessagePortMessageFilter::RouteMessageEventWithMessagePorts, | 279 base::Bind(&MessagePortMessageFilter::RouteMessageEventWithMessagePorts, |
| 274 message_port_message_filter, target_rfh->GetRoutingID(), | 280 message_port_message_filter, target_rfh->GetRoutingID(), |
| 275 new_params)); | 281 new_params)); |
| 276 } else { | 282 } else { |
| 277 target_rfh->Send( | 283 target_rfh->Send( |
| 278 new FrameMsg_PostMessageEvent(target_rfh->GetRoutingID(), new_params)); | 284 new FrameMsg_PostMessageEvent(target_rfh->GetRoutingID(), new_params)); |
| 279 } | 285 } |
| 280 } | 286 } |
| 281 | 287 |
| 282 } // namespace content | 288 } // namespace content |
| OLD | NEW |