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

Unified Diff: content/browser/web_contents/render_view_host_manager.cc

Issue 10827078: Support frame tree propagation between renderers in the same browsing instance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another round of fixes based on Charlie's review. Created 8 years, 4 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/web_contents/render_view_host_manager.cc
diff --git a/content/browser/web_contents/render_view_host_manager.cc b/content/browser/web_contents/render_view_host_manager.cc
index 62fec79d74de5e16ec285817f4bc86b6f9eb9689..0ad29065fcc5606cdeae2a809f75d24ef454b13c 100644
--- a/content/browser/web_contents/render_view_host_manager.cc
+++ b/content/browser/web_contents/render_view_host_manager.cc
@@ -239,6 +239,26 @@ void RenderViewHostManager::DidNavigateMainFrame(
}
}
+void RenderViewHostManager::DidUpdateFrameTree(
+ RenderViewHost* render_view_host) {
+ CHECK_EQ(render_view_host, current_host());
+
+ RenderViewHostImpl* render_view_host_impl = static_cast<RenderViewHostImpl*>(
+ render_view_host);
+
+ for (RenderViewHostMap::iterator iter = swapped_out_hosts_.begin();
+ iter != swapped_out_hosts_.end();
+ ++iter) {
+ DCHECK_NE(iter->second->GetSiteInstance(),
+ current_host()->GetSiteInstance());
not at google - send to devlin 2012/08/30 05:01:41 This check seems to be flakily but consistently fa
+
+ iter->second->UpdateFrameTree(
+ render_view_host_impl->GetProcess()->GetID(),
+ render_view_host_impl->GetRoutingID(),
+ render_view_host_impl->frame_tree());
+ }
+}
+
void RenderViewHostManager::SetWebUIPostCommit(WebUIImpl* web_ui) {
DCHECK(!web_ui_.get());
web_ui_.reset(web_ui);
@@ -495,6 +515,15 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
if (entry.IsViewSourceMode())
return SiteInstance::CreateForURL(browser_context, dest_url);
+ // If we are navigating from a blank SiteInstance to a WebUI, make sure we
+ // create a new SiteInstance.
+ const WebUIControllerFactory* web_ui_factory =
+ content::GetContentClient()->browser()->GetWebUIControllerFactory();
+ if (web_ui_factory &&
+ web_ui_factory->UseWebUIForURL(browser_context, dest_url)) {
+ return SiteInstance::CreateForURL(browser_context, dest_url);
+ }
+
// Normally the "site" on the SiteInstance is set lazily when the load
// actually commits. This is to support better process sharing in case
// the site redirects to some other site: we want to use the destination
@@ -607,6 +636,15 @@ int RenderViewHostManager::CreateRenderView(
if (success) {
// Don't show the view until we get a DidNavigate from it.
new_render_view_host->GetView()->Hide();
+
+ // If we are creating a swapped out RVH, send a message to update its
+ // frame tree based on the active RVH for this RenderViewHostManager.
+ if (swapped_out) {
+ new_render_view_host->UpdateFrameTree(
+ current_host()->GetProcess()->GetID(),
+ current_host()->GetRoutingID(),
+ current_host()->frame_tree());
+ }
} else if (!swapped_out) {
CancelPending();
}
@@ -920,7 +958,7 @@ bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) {
swapped_out_hosts_.end();
}
-RenderViewHost* RenderViewHostManager::GetSwappedOutRenderViewHost(
+RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost(
SiteInstance* instance) {
RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId());
if (iter != swapped_out_hosts_.end())
« no previous file with comments | « content/browser/web_contents/render_view_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