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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 1306053008: Avoid creating a RenderWidgetHostView for proxies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 394
395 // If the current render_frame_host_ isn't live, we should create it so 395 // If the current render_frame_host_ isn't live, we should create it so
396 // that we don't show a sad tab while the dest_render_frame_host fetches 396 // that we don't show a sad tab while the dest_render_frame_host fetches
397 // its first page. (Bug 1145340) 397 // its first page. (Bug 1145340)
398 if (dest_render_frame_host != render_frame_host_ && 398 if (dest_render_frame_host != render_frame_host_ &&
399 !render_frame_host_->IsRenderFrameLive()) { 399 !render_frame_host_->IsRenderFrameLive()) {
400 // Note: we don't call InitRenderView here because we are navigating away 400 // Note: we don't call InitRenderView here because we are navigating away
401 // soon anyway, and we don't have the NavigationEntry for this host. 401 // soon anyway, and we don't have the NavigationEntry for this host.
402 delegate_->CreateRenderViewForRenderManager( 402 delegate_->CreateRenderViewForRenderManager(
403 render_frame_host_->render_view_host(), MSG_ROUTING_NONE, 403 render_frame_host_->render_view_host(), MSG_ROUTING_NONE,
404 MSG_ROUTING_NONE, frame_tree_node_->current_replication_state(), 404 MSG_ROUTING_NONE, frame_tree_node_->current_replication_state());
405 frame_tree_node_->IsMainFrame());
406 } 405 }
407 406
408 // If the renderer isn't live, then try to create a new one to satisfy this 407 // If the renderer isn't live, then try to create a new one to satisfy this
409 // navigation request. 408 // navigation request.
410 if (!dest_render_frame_host->IsRenderFrameLive()) { 409 if (!dest_render_frame_host->IsRenderFrameLive()) {
411 // Instruct the destination render frame host to set up a Mojo connection 410 // Instruct the destination render frame host to set up a Mojo connection
412 // with the new render frame if necessary. Note that this call needs to 411 // with the new render frame if necessary. Note that this call needs to
413 // occur before initializing the RenderView; the flow of creating the 412 // occur before initializing the RenderView; the flow of creating the
414 // RenderView can cause browser-side code to execute that expects the this 413 // RenderView can cause browser-side code to execute that expects the this
415 // RFH's ServiceRegistry to be initialized (e.g., if the site is a WebUI 414 // RFH's ServiceRegistry to be initialized (e.g., if the site is a WebUI
416 // site that is handled via Mojo, then Mojo WebUI code in //chrome will 415 // site that is handled via Mojo, then Mojo WebUI code in //chrome will
417 // add a service to this RFH's ServiceRegistry). 416 // add a service to this RFH's ServiceRegistry).
418 dest_render_frame_host->SetUpMojoIfNeeded(); 417 dest_render_frame_host->SetUpMojoIfNeeded();
419 418
420 // Recreate the opener chain. 419 // Recreate the opener chain.
421 CreateOpenerProxies(dest_render_frame_host->GetSiteInstance(), 420 CreateOpenerProxies(dest_render_frame_host->GetSiteInstance(),
422 frame_tree_node_); 421 frame_tree_node_);
423 if (!InitRenderView(dest_render_frame_host->render_view_host(), 422 if (!InitRenderView(dest_render_frame_host->render_view_host(),
424 MSG_ROUTING_NONE, 423 MSG_ROUTING_NONE))
425 frame_tree_node_->IsMainFrame()))
426 return nullptr; 424 return nullptr;
427 425
428 // Now that we've created a new renderer, be sure to hide it if it isn't 426 // Now that we've created a new renderer, be sure to hide it if it isn't
429 // our primary one. Otherwise, we might crash if we try to call Show() 427 // our primary one. Otherwise, we might crash if we try to call Show()
430 // on it later. 428 // on it later.
431 if (dest_render_frame_host != render_frame_host_) { 429 if (dest_render_frame_host != render_frame_host_) {
432 if (dest_render_frame_host->GetView()) 430 if (dest_render_frame_host->GetView())
433 dest_render_frame_host->GetView()->Hide(); 431 dest_render_frame_host->GetView()->Hide();
434 } else { 432 } else {
435 // After a renderer crash we'd have marked the host as invisible, so we 433 // After a renderer crash we'd have marked the host as invisible, so we
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 } 1049 }
1052 DCHECK(navigation_rfh && 1050 DCHECK(navigation_rfh &&
1053 (navigation_rfh == render_frame_host_.get() || 1051 (navigation_rfh == render_frame_host_.get() ||
1054 navigation_rfh == speculative_render_frame_host_.get())); 1052 navigation_rfh == speculative_render_frame_host_.get()));
1055 1053
1056 // If the RenderFrame that needs to navigate is not live (its process was just 1054 // If the RenderFrame that needs to navigate is not live (its process was just
1057 // created or has crashed), initialize it. 1055 // created or has crashed), initialize it.
1058 if (!navigation_rfh->IsRenderFrameLive()) { 1056 if (!navigation_rfh->IsRenderFrameLive()) {
1059 // Recreate the opener chain. 1057 // Recreate the opener chain.
1060 CreateOpenerProxies(navigation_rfh->GetSiteInstance(), frame_tree_node_); 1058 CreateOpenerProxies(navigation_rfh->GetSiteInstance(), frame_tree_node_);
1061 if (!InitRenderView(navigation_rfh->render_view_host(), MSG_ROUTING_NONE, 1059 if (!InitRenderView(navigation_rfh->render_view_host(), MSG_ROUTING_NONE)) {
1062 frame_tree_node_->IsMainFrame())) {
1063 return nullptr; 1060 return nullptr;
1064 } 1061 }
1065 1062
1066 if (navigation_rfh == render_frame_host_) { 1063 if (navigation_rfh == render_frame_host_) {
1067 // TODO(nasko): This is a very ugly hack. The Chrome extensions process 1064 // TODO(nasko): This is a very ugly hack. The Chrome extensions process
1068 // manager still uses NotificationService and expects to see a 1065 // manager still uses NotificationService and expects to see a
1069 // RenderViewHost changed notification after WebContents and 1066 // RenderViewHost changed notification after WebContents and
1070 // RenderFrameHostManager are completely initialized. This should be 1067 // RenderFrameHostManager are completely initialized. This should be
1071 // removed once the process manager moves away from NotificationService. 1068 // removed once the process manager moves away from NotificationService.
1072 // See https://crbug.com/462682. 1069 // See https://crbug.com/462682.
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 // to open a new tab to an interstitial-inducing URL, and then navigates 1552 // to open a new tab to an interstitial-inducing URL, and then navigates
1556 // the page to a different same-site URL. (This seems very unlikely in 1553 // the page to a different same-site URL. (This seems very unlikely in
1557 // practice.) 1554 // practice.)
1558 if (current_entry) 1555 if (current_entry)
1559 return current_entry->GetURL(); 1556 return current_entry->GetURL();
1560 return current_instance->GetSiteURL(); 1557 return current_instance->GetSiteURL();
1561 } 1558 }
1562 1559
1563 void RenderFrameHostManager::CreatePendingRenderFrameHost( 1560 void RenderFrameHostManager::CreatePendingRenderFrameHost(
1564 SiteInstance* old_instance, 1561 SiteInstance* old_instance,
1565 SiteInstance* new_instance, 1562 SiteInstance* new_instance) {
1566 bool is_main_frame) {
1567 int create_render_frame_flags = 0; 1563 int create_render_frame_flags = 0;
1568 if (is_main_frame)
1569 create_render_frame_flags |= CREATE_RF_FOR_MAIN_FRAME_NAVIGATION;
1570
1571 if (delegate_->IsHidden()) 1564 if (delegate_->IsHidden())
1572 create_render_frame_flags |= CREATE_RF_HIDDEN; 1565 create_render_frame_flags |= CREATE_RF_HIDDEN;
1573 1566
1574 if (pending_render_frame_host_) 1567 if (pending_render_frame_host_)
1575 CancelPending(); 1568 CancelPending();
1576 1569
1577 // The process for the new SiteInstance may (if we're sharing a process with 1570 // The process for the new SiteInstance may (if we're sharing a process with
1578 // another host that already initialized it) or may not (we have our own 1571 // another host that already initialized it) or may not (we have our own
1579 // process or the existing process crashed) have been initialized. Calling 1572 // process or the existing process crashed) have been initialized. Calling
1580 // Init multiple times will be ignored, so this is safe. 1573 // Init multiple times will be ignored, so this is safe.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 // The process for the new SiteInstance may (if we're sharing a process with 1677 // The process for the new SiteInstance may (if we're sharing a process with
1685 // another host that already initialized it) or may not (we have our own 1678 // another host that already initialized it) or may not (we have our own
1686 // process or the existing process crashed) have been initialized. Calling 1679 // process or the existing process crashed) have been initialized. Calling
1687 // Init multiple times will be ignored, so this is safe. 1680 // Init multiple times will be ignored, so this is safe.
1688 if (!new_instance->GetProcess()->Init()) 1681 if (!new_instance->GetProcess()->Init())
1689 return false; 1682 return false;
1690 1683
1691 CreateProxiesForNewRenderFrameHost(old_instance, new_instance); 1684 CreateProxiesForNewRenderFrameHost(old_instance, new_instance);
1692 1685
1693 int create_render_frame_flags = 0; 1686 int create_render_frame_flags = 0;
1694 if (frame_tree_node_->IsMainFrame())
1695 create_render_frame_flags |= CREATE_RF_FOR_MAIN_FRAME_NAVIGATION;
1696 if (delegate_->IsHidden()) 1687 if (delegate_->IsHidden())
1697 create_render_frame_flags |= CREATE_RF_HIDDEN; 1688 create_render_frame_flags |= CREATE_RF_HIDDEN;
1698 speculative_render_frame_host_ = 1689 speculative_render_frame_host_ =
1699 CreateRenderFrame(new_instance, speculative_web_ui_.get(), 1690 CreateRenderFrame(new_instance, speculative_web_ui_.get(),
1700 create_render_frame_flags, nullptr); 1691 create_render_frame_flags, nullptr);
1701 1692
1702 if (!speculative_render_frame_host_) { 1693 if (!speculative_render_frame_host_) {
1703 speculative_web_ui_.reset(); 1694 speculative_web_ui_.reset();
1704 return false; 1695 return false;
1705 } 1696 }
(...skipping 24 matching lines...) Expand all
1730 1721
1731 // We are creating a pending, speculative or swapped out RFH here. We should 1722 // We are creating a pending, speculative or swapped out RFH here. We should
1732 // never create it in the same SiteInstance as our current RFH. 1723 // never create it in the same SiteInstance as our current RFH.
1733 CHECK_NE(render_frame_host_->GetSiteInstance(), instance); 1724 CHECK_NE(render_frame_host_->GetSiteInstance(), instance);
1734 1725
1735 // Check if we've already created an RFH for this SiteInstance. If so, try 1726 // Check if we've already created an RFH for this SiteInstance. If so, try
1736 // to re-use the existing one, which has already been initialized. We'll 1727 // to re-use the existing one, which has already been initialized. We'll
1737 // remove it from the list of proxy hosts below if it will be active. 1728 // remove it from the list of proxy hosts below if it will be active.
1738 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); 1729 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance);
1739 if (proxy && proxy->render_frame_host()) { 1730 if (proxy && proxy->render_frame_host()) {
1731 RenderViewHost* render_view_host = proxy->GetRenderViewHost();
1740 CHECK(!swapped_out_forbidden); 1732 CHECK(!swapped_out_forbidden);
1741 if (view_routing_id_ptr) 1733 if (view_routing_id_ptr)
1742 *view_routing_id_ptr = proxy->GetRenderViewHost()->GetRoutingID(); 1734 *view_routing_id_ptr = proxy->GetRenderViewHost()->GetRoutingID();
1743 // Delete the existing RenderFrameProxyHost, but reuse the RenderFrameHost. 1735 // Delete the existing RenderFrameProxyHost, but reuse the RenderFrameHost.
1744 // Prevent the process from exiting while we're trying to use it. 1736 // Prevent the process from exiting while we're trying to use it.
1745 if (!swapped_out) { 1737 if (!swapped_out) {
1746 new_render_frame_host = proxy->PassFrameHostOwnership(); 1738 new_render_frame_host = proxy->PassFrameHostOwnership();
1747 new_render_frame_host->GetProcess()->AddPendingView(); 1739 new_render_frame_host->GetProcess()->AddPendingView();
1748 1740
1749 proxy_hosts_->Remove(instance->GetId()); 1741 proxy_hosts_->Remove(instance->GetId());
1750 // NB |proxy| is deleted at this point. 1742 // NB |proxy| is deleted at this point.
1751 } 1743 }
1744 // If we are reusing the RenderViewHost and it doesn't already have a
1745 // RenderWidgetHostView, we need to create one if this is the main frame.
1746 if (!render_view_host->GetView() && frame_tree_node_->IsMainFrame())
1747 delegate_->CreateRenderWidgetHostViewForRenderManager(render_view_host);
1752 } else { 1748 } else {
1753 // Create a new RenderFrameHost if we don't find an existing one. 1749 // Create a new RenderFrameHost if we don't find an existing one.
1754 1750
1755 int32 widget_routing_id = MSG_ROUTING_NONE; 1751 int32 widget_routing_id = MSG_ROUTING_NONE;
1756 int32 surface_id = 0; 1752 int32 surface_id = 0;
1757 // A RenderFrame in a different process from its parent RenderFrame 1753 // A RenderFrame in a different process from its parent RenderFrame
1758 // requires a RenderWidget for input/layout/painting. 1754 // requires a RenderWidget for input/layout/painting.
1759 if (frame_tree_node_->parent() && 1755 if (frame_tree_node_->parent() &&
1760 frame_tree_node_->parent()->current_frame_host()->GetSiteInstance() != 1756 frame_tree_node_->parent()->current_frame_host()->GetSiteInstance() !=
1761 instance) { 1757 instance) {
(...skipping 16 matching lines...) Expand all
1778 new_render_frame_host->GetProcess()->AddPendingView(); 1774 new_render_frame_host->GetProcess()->AddPendingView();
1779 } else { 1775 } else {
1780 proxy = new RenderFrameProxyHost( 1776 proxy = new RenderFrameProxyHost(
1781 new_render_frame_host->GetSiteInstance(), 1777 new_render_frame_host->GetSiteInstance(),
1782 new_render_frame_host->render_view_host(), frame_tree_node_); 1778 new_render_frame_host->render_view_host(), frame_tree_node_);
1783 proxy_hosts_->Add(instance->GetId(), make_scoped_ptr(proxy)); 1779 proxy_hosts_->Add(instance->GetId(), make_scoped_ptr(proxy));
1784 proxy_routing_id = proxy->GetRoutingID(); 1780 proxy_routing_id = proxy->GetRoutingID();
1785 proxy->TakeFrameHostOwnership(new_render_frame_host.Pass()); 1781 proxy->TakeFrameHostOwnership(new_render_frame_host.Pass());
1786 } 1782 }
1787 1783
1788 success = InitRenderView(render_view_host, proxy_routing_id, 1784 if (frame_tree_node_->IsMainFrame()) {
1789 !!(flags & CREATE_RF_FOR_MAIN_FRAME_NAVIGATION)); 1785 success = InitRenderView(render_view_host, proxy_routing_id);
1786
1787 // If we are reusing the RenderViewHost and it doesn't already have a
1788 // RenderWidgetHostView, we need to create one if this is the main frame.
1789 if (!swapped_out && !render_view_host->GetView())
1790 delegate_->CreateRenderWidgetHostViewForRenderManager(render_view_host);
1791 } else {
1792 DCHECK(render_view_host->IsRenderViewLive());
1793 }
1794
1790 if (success) { 1795 if (success) {
1791 // Remember that InitRenderView also created the RenderFrameProxy. 1796 // Remember that InitRenderView also created the RenderFrameProxy.
1792 if (swapped_out) 1797 if (swapped_out)
1793 proxy->set_render_frame_proxy_created(true); 1798 proxy->set_render_frame_proxy_created(true);
1794 if (frame_tree_node_->IsMainFrame()) { 1799 if (frame_tree_node_->IsMainFrame()) {
1795 // Don't show the main frame's view until we get a DidNavigate from it. 1800 // Don't show the main frame's view until we get a DidNavigate from it.
1796 // Only the RenderViewHost for the top-level RenderFrameHost has a 1801 // Only the RenderViewHost for the top-level RenderFrameHost has a
1797 // RenderWidgetHostView; RenderWidgetHosts for out-of-process iframes 1802 // RenderWidgetHostView; RenderWidgetHosts for out-of-process iframes
1798 // will be created later and hidden. 1803 // will be created later and hidden.
1799 if (render_view_host->GetView()) 1804 if (render_view_host->GetView())
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 return proxy->GetRoutingID(); 1869 return proxy->GetRoutingID();
1865 1870
1866 if (!proxy) { 1871 if (!proxy) {
1867 proxy = 1872 proxy =
1868 new RenderFrameProxyHost(instance, render_view_host, frame_tree_node_); 1873 new RenderFrameProxyHost(instance, render_view_host, frame_tree_node_);
1869 proxy_hosts_->Add(instance->GetId(), make_scoped_ptr(proxy)); 1874 proxy_hosts_->Add(instance->GetId(), make_scoped_ptr(proxy));
1870 } 1875 }
1871 1876
1872 if (SiteIsolationPolicy::IsSwappedOutStateForbidden() && 1877 if (SiteIsolationPolicy::IsSwappedOutStateForbidden() &&
1873 frame_tree_node_->IsMainFrame()) { 1878 frame_tree_node_->IsMainFrame()) {
1874 InitRenderView(render_view_host, proxy->GetRoutingID(), true); 1879 InitRenderView(render_view_host, proxy->GetRoutingID());
1875 proxy->set_render_frame_proxy_created(true); 1880 proxy->set_render_frame_proxy_created(true);
1876 } else { 1881 } else {
1877 proxy->InitRenderFrameProxy(); 1882 proxy->InitRenderFrameProxy();
1878 } 1883 }
1879 1884
1880 return proxy->GetRoutingID(); 1885 return proxy->GetRoutingID();
1881 } 1886 }
1882 1887
1883 void RenderFrameHostManager::CreateProxiesForChildFrame(FrameTreeNode* child) { 1888 void RenderFrameHostManager::CreateProxiesForChildFrame(FrameTreeNode* child) {
1884 for (const auto& pair : *proxy_hosts_) { 1889 for (const auto& pair : *proxy_hosts_) {
(...skipping 14 matching lines...) Expand all
1899 1904
1900 if (render_view_host->IsRenderViewLive()) 1905 if (render_view_host->IsRenderViewLive())
1901 return; 1906 return;
1902 1907
1903 // If the proxy in |instance| doesn't exist, this RenderView is not swapped 1908 // If the proxy in |instance| doesn't exist, this RenderView is not swapped
1904 // out and shouldn't be reinitialized here. 1909 // out and shouldn't be reinitialized here.
1905 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); 1910 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance);
1906 if (!proxy) 1911 if (!proxy)
1907 return; 1912 return;
1908 1913
1909 InitRenderView(render_view_host, proxy->GetRoutingID(), false); 1914 InitRenderView(render_view_host, proxy->GetRoutingID());
1910 proxy->set_render_frame_proxy_created(true); 1915 proxy->set_render_frame_proxy_created(true);
1911 } 1916 }
1912 1917
1913 void RenderFrameHostManager::CreateOuterDelegateProxy( 1918 void RenderFrameHostManager::CreateOuterDelegateProxy(
1914 SiteInstance* outer_contents_site_instance, 1919 SiteInstance* outer_contents_site_instance,
1915 RenderFrameHostImpl* render_frame_host) { 1920 RenderFrameHostImpl* render_frame_host) {
1916 CHECK(BrowserPluginGuestMode::UseCrossProcessFramesForGuests()); 1921 CHECK(BrowserPluginGuestMode::UseCrossProcessFramesForGuests());
1917 RenderFrameProxyHost* proxy = new RenderFrameProxyHost( 1922 RenderFrameProxyHost* proxy = new RenderFrameProxyHost(
1918 outer_contents_site_instance, nullptr, frame_tree_node_); 1923 outer_contents_site_instance, nullptr, frame_tree_node_);
1919 proxy_hosts_->Add(outer_contents_site_instance->GetId(), 1924 proxy_hosts_->Add(outer_contents_site_instance->GetId(),
(...skipping 14 matching lines...) Expand all
1934 } 1939 }
1935 1940
1936 void RenderFrameHostManager::SetRWHViewForInnerContents( 1941 void RenderFrameHostManager::SetRWHViewForInnerContents(
1937 RenderWidgetHostView* child_rwhv) { 1942 RenderWidgetHostView* child_rwhv) {
1938 DCHECK(ForInnerDelegate() && frame_tree_node_->IsMainFrame()); 1943 DCHECK(ForInnerDelegate() && frame_tree_node_->IsMainFrame());
1939 GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv); 1944 GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv);
1940 } 1945 }
1941 1946
1942 bool RenderFrameHostManager::InitRenderView( 1947 bool RenderFrameHostManager::InitRenderView(
1943 RenderViewHostImpl* render_view_host, 1948 RenderViewHostImpl* render_view_host,
1944 int proxy_routing_id, 1949 int proxy_routing_id) {
1945 bool for_main_frame_navigation) {
1946 // Ensure the renderer process is initialized before creating the 1950 // Ensure the renderer process is initialized before creating the
1947 // RenderView. 1951 // RenderView.
1948 if (!render_view_host->GetProcess()->Init()) 1952 if (!render_view_host->GetProcess()->Init())
1949 return false; 1953 return false;
1950 1954
1951 // We may have initialized this RenderViewHost for another RenderFrameHost. 1955 // We may have initialized this RenderViewHost for another RenderFrameHost.
1952 if (render_view_host->IsRenderViewLive()) 1956 if (render_view_host->IsRenderViewLive())
1953 return true; 1957 return true;
1954 1958
1955 // If the ongoing navigation is to a WebUI and the RenderView is not in a 1959 // If the ongoing navigation is to a WebUI and the RenderView is not in a
(...skipping 16 matching lines...) Expand all
1972 CHECK(!ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( 1976 CHECK(!ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
1973 render_view_host->GetProcess()->GetID())); 1977 render_view_host->GetProcess()->GetID()));
1974 } 1978 }
1975 } 1979 }
1976 1980
1977 int opener_frame_routing_id = 1981 int opener_frame_routing_id =
1978 GetOpenerRoutingID(render_view_host->GetSiteInstance()); 1982 GetOpenerRoutingID(render_view_host->GetSiteInstance());
1979 1983
1980 return delegate_->CreateRenderViewForRenderManager( 1984 return delegate_->CreateRenderViewForRenderManager(
1981 render_view_host, opener_frame_routing_id, proxy_routing_id, 1985 render_view_host, opener_frame_routing_id, proxy_routing_id,
1982 frame_tree_node_->current_replication_state(), for_main_frame_navigation); 1986 frame_tree_node_->current_replication_state());
1983 } 1987 }
1984 1988
1985 bool RenderFrameHostManager::InitRenderFrame( 1989 bool RenderFrameHostManager::InitRenderFrame(
1986 RenderFrameHostImpl* render_frame_host) { 1990 RenderFrameHostImpl* render_frame_host) {
1987 if (render_frame_host->IsRenderFrameLive()) 1991 if (render_frame_host->IsRenderFrameLive())
1988 return true; 1992 return true;
1989 1993
1990 SiteInstance* site_instance = render_frame_host->GetSiteInstance(); 1994 SiteInstance* site_instance = render_frame_host->GetSiteInstance();
1991 1995
1992 int opener_routing_id = MSG_ROUTING_NONE; 1996 int opener_routing_id = MSG_ROUTING_NONE;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
2288 2292
2289 // New SiteInstance: create a pending RFH to navigate. 2293 // New SiteInstance: create a pending RFH to navigate.
2290 2294
2291 // This will possibly create (set to nullptr) a Web UI object for the 2295 // This will possibly create (set to nullptr) a Web UI object for the
2292 // pending page. We'll use this later to give the page special access. This 2296 // pending page. We'll use this later to give the page special access. This
2293 // must happen before the new renderer is created below so it will get 2297 // must happen before the new renderer is created below so it will get
2294 // bindings. It must also happen after the above conditional call to 2298 // bindings. It must also happen after the above conditional call to
2295 // CancelPending(), otherwise CancelPending may clear the pending_web_ui_ 2299 // CancelPending(), otherwise CancelPending may clear the pending_web_ui_
2296 // and the page will not have its bindings set appropriately. 2300 // and the page will not have its bindings set appropriately.
2297 SetPendingWebUI(dest_url, bindings); 2301 SetPendingWebUI(dest_url, bindings);
2298 CreatePendingRenderFrameHost(current_instance, new_instance.get(), 2302 CreatePendingRenderFrameHost(current_instance, new_instance.get());
2299 frame_tree_node_->IsMainFrame());
2300 if (!pending_render_frame_host_) 2303 if (!pending_render_frame_host_)
2301 return nullptr; 2304 return nullptr;
2302 2305
2303 // Check if our current RFH is live before we set up a transition. 2306 // Check if our current RFH is live before we set up a transition.
2304 if (!render_frame_host_->IsRenderFrameLive()) { 2307 if (!render_frame_host_->IsRenderFrameLive()) {
2305 // The current RFH is not live. There's no reason to sit around with a 2308 // The current RFH is not live. There's no reason to sit around with a
2306 // sad tab or a newly created RFH while we wait for the pending RFH to 2309 // sad tab or a newly created RFH while we wait for the pending RFH to
2307 // navigate. Just switch to the pending RFH now and go back to normal. 2310 // navigate. Just switch to the pending RFH now and go back to normal.
2308 // (Note that we don't care about on{before}unload handlers if the current 2311 // (Note that we don't care about on{before}unload handlers if the current
2309 // RFH isn't live.) 2312 // RFH isn't live.)
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 (rvh == pending_render_view_host()); 2572 (rvh == pending_render_view_host());
2570 if (rvh && rvh->IsRenderViewLive() && !need_proxy_for_pending_rvh) 2573 if (rvh && rvh->IsRenderViewLive() && !need_proxy_for_pending_rvh)
2571 return; 2574 return;
2572 2575
2573 if (rvh && !rvh->IsRenderViewLive()) { 2576 if (rvh && !rvh->IsRenderViewLive()) {
2574 EnsureRenderViewInitialized(rvh, instance); 2577 EnsureRenderViewInitialized(rvh, instance);
2575 } else { 2578 } else {
2576 // Create a swapped out RenderView in the given SiteInstance if none 2579 // Create a swapped out RenderView in the given SiteInstance if none
2577 // exists. Since an opener can point to a subframe, do this on the root 2580 // exists. Since an opener can point to a subframe, do this on the root
2578 // frame of the current opener's frame tree. 2581 // frame of the current opener's frame tree.
2579 frame_tree->root()->render_manager()-> 2582 frame_tree->root()->render_manager()->CreateRenderFrame(
2580 CreateRenderFrame(instance, nullptr, 2583 instance, nullptr, CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN, nullptr);
2581 CREATE_RF_FOR_MAIN_FRAME_NAVIGATION |
2582 CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN,
2583 nullptr);
2584 } 2584 }
2585 } 2585 }
2586 } 2586 }
2587 2587
2588 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { 2588 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) {
2589 if (!frame_tree_node_->opener()) 2589 if (!frame_tree_node_->opener())
2590 return MSG_ROUTING_NONE; 2590 return MSG_ROUTING_NONE;
2591 2591
2592 return frame_tree_node_->opener() 2592 return frame_tree_node_->opener()
2593 ->render_manager() 2593 ->render_manager()
2594 ->GetRoutingIdForSiteInstance(instance); 2594 ->GetRoutingIdForSiteInstance(instance);
2595 } 2595 }
2596 2596
2597 } // namespace content 2597 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.h ('k') | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698