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

Unified Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 270883003: Decouple RVH creation from CrossProcessFrameConnector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index bf4312e12121da4a94101c8ee0e2846a435ef8ec..df9f0a0aefc0b151867af93de8aab2e39a25acfc 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -21,6 +21,7 @@
#include "content/browser/frame_host/render_frame_host_factory.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/frame_host/render_frame_proxy_host.h"
+#include "content/browser/frame_host/render_widget_host_view_child_frame.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
@@ -33,6 +34,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_widget_host_iterator.h"
+#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/common/content_switches.h"
@@ -178,7 +180,7 @@ RenderFrameHostImpl* RenderFrameHostManager::Navigate(
// Note: we don't call InitRenderView here because we are navigating away
// soon anyway, and we don't have the NavigationEntry for this host.
delegate_->CreateRenderViewForRenderManager(
- render_frame_host_->render_view_host(), MSG_ROUTING_NONE, NULL);
+ render_frame_host_->render_view_host(), MSG_ROUTING_NONE, false);
}
// If the renderer crashed, then try to create a new one to satisfy this
@@ -188,7 +190,7 @@ RenderFrameHostImpl* RenderFrameHostManager::Navigate(
int opener_route_id = delegate_->CreateOpenerRenderViewsForRenderManager(
dest_render_frame_host->GetSiteInstance());
if (!InitRenderView(dest_render_frame_host->render_view_host(),
- opener_route_id))
+ opener_route_id, false))
return NULL;
// Now that we've created a new renderer, be sure to hide it if it isn't
@@ -480,6 +482,7 @@ void RenderFrameHostManager::RendererProcessClosing(
}
void RenderFrameHostManager::SwapOutOldPage() {
+ LOG(ERROR) << "RFHM::SwapOutOldPage[" << this << "]";
// Should only see this while we have a pending renderer or transfer.
CHECK(cross_navigation_pending_ || pending_nav_params_.get());
@@ -494,21 +497,6 @@ void RenderFrameHostManager::SwapOutOldPage() {
// no longer on the stack when we send the SwapOut message.
delegate_->CancelModalDialogsForRenderManager();
- if (!frame_tree_node_->IsMainFrame()) {
- // The RenderFrameHost being swapped out becomes the proxy for this
- // frame in its parent's process. CrossProcessFrameConnector
- // initialization only needs to happen on an initial cross-process
- // navigation, when the RenderFrame leaves the same process as its parent.
- // The same CrossProcessFrameConnector is used for subsequent cross-
- // process navigations, but it will be destroyed if the Frame is
- // navigated back to the same site instance as its parent.
- // TODO(kenrb): This will change when RenderFrameProxyHost is created.
- if (!cross_process_frame_connector_) {
- cross_process_frame_connector_ =
- new CrossProcessFrameConnector(render_frame_host_.get());
- }
- }
-
// Tell the old frame it is being swapped out. This will fire the unload
// handler in the background (without firing the beforeunload handler a second
// time). When the navigation completes, we will send a message to the
@@ -935,7 +923,8 @@ int RenderFrameHostManager::CreateRenderFrame(
new_render_frame_host.Pass());
}
- bool success = InitRenderView(render_view_host, opener_route_id);
+ bool success = InitRenderView(
+ render_view_host, opener_route_id, frame_tree_node_->IsMainFrame());
if (success && frame_tree_node_->IsMainFrame()) {
// Don't show the main frame's view until we get a DidNavigate from it.
render_view_host->GetView()->Hide();
@@ -953,7 +942,10 @@ int RenderFrameHostManager::CreateRenderFrame(
}
bool RenderFrameHostManager::InitRenderView(RenderViewHost* render_view_host,
- int opener_route_id) {
+ int opener_route_id,
+ bool for_subframe) {
+ LOG(ERROR) << "RFHM::InitRenderView[" << this << "]: for_subframe:"
+ << for_subframe;
// We may have initialized this RenderViewHost for another RenderFrameHost.
if (render_view_host->IsRenderViewLive())
return true;
@@ -975,10 +967,11 @@ bool RenderFrameHostManager::InitRenderView(RenderViewHost* render_view_host,
}
return delegate_->CreateRenderViewForRenderManager(
- render_view_host, opener_route_id, cross_process_frame_connector_);
+ render_view_host, opener_route_id, for_subframe);
}
void RenderFrameHostManager::CommitPending() {
+ LOG(ERROR) << "RFHM::CommitPending[" << this << "]";
// First check whether we're going to want to focus the location bar after
// this commit. We do this now because the navigation hasn't formally
// committed yet, so if we've already cleared |pending_web_ui_| the call chain
@@ -1132,6 +1125,23 @@ void RenderFrameHostManager::CommitPending() {
old_render_frame_host.reset();
ShutdownRenderFrameHostsInSiteInstance(old_site_instance_id);
} else {
+ // The RenderFrameHost being swapped out becomes the proxy for this
+ // frame in its parent's process. CrossProcessFrameConnector
+ // initialization only needs to happen on an initial cross-process
+ // navigation, when the RenderFrame leaves the same process as its parent.
+ // The same CrossProcessFrameConnector is used for subsequent cross-
+ // process navigations, but it will be destroyed if the Frame is
+ // navigated back to the same site instance as its parent.
+ // TODO(kenrb): This will change when RenderFrameProxyHost is created.
+ if (!cross_process_frame_connector_) {
+ cross_process_frame_connector_ =
+ new CrossProcessFrameConnector(old_render_frame_host.get());
+ RenderWidgetHostView* rwhv =
+ old_render_frame_host->render_view_host()->GetView();
kenrb 2014/05/08 19:56:14 Which RenderViewHost does old_render_frame_host->r
+ cross_process_frame_connector_->set_view(
+ static_cast<RenderWidgetHostViewChildFrame*>(rwhv));
+ }
+
proxy_hosts_[old_site_instance_id] = new RenderFrameProxyHost(
old_render_frame_host.Pass());
}
@@ -1170,6 +1180,7 @@ RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate(
const NavigationEntryImpl& entry) {
// If we are currently navigating cross-process, we want to get back to normal
// and then navigate as usual.
+ LOG(ERROR) << "RFHM::UpdateStateForNavigate[" << this << "]";
if (cross_navigation_pending_) {
if (pending_render_frame_host_)
CancelPending();
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698