+void FrameTree::CreateProxiesForSiteInstance(
+ FrameTreeNode* source,
+ SiteInstance* site_instance) {
+ // Create the swapped out RVH for the new SiteInstance. This will create
+ // a top-level swapped out RFH as well, which will then be wrapped by a
+ // RenderFrameProxyHost.
+ if (!source->IsMainFrame()) {
+ RenderViewHostImpl* render_view_host =
+ source->frame_tree()->GetRenderViewHost(site_instance);
+ if (!render_view_host) {
+ root()->render_manager()->CreateRenderFrame(site_instance,
+ MSG_ROUTING_NONE,
+ true,
+ false,
+ true);
+ }
+ }
+
+ scoped_refptr<SiteInstance> instance(site_instance);
+ ForEach(base::Bind(&CreateProxyForSiteInstance, source, instance));
+}
+