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

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

Issue 1199313006: Disable support for swapped out RenderFrame(Host) on desktop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 namespace content { 45 namespace content {
46 46
47 // static 47 // static
48 bool RenderFrameHostManager::ClearRFHsPendingShutdown(FrameTreeNode* node) { 48 bool RenderFrameHostManager::ClearRFHsPendingShutdown(FrameTreeNode* node) {
49 node->render_manager()->pending_delete_hosts_.clear(); 49 node->render_manager()->pending_delete_hosts_.clear();
50 return true; 50 return true;
51 } 51 }
52 52
53 // static 53 // static
54 bool RenderFrameHostManager::IsSwappedOutStateForbidden() { 54 bool RenderFrameHostManager::IsSwappedOutStateForbidden() {
Avi (use Gerrit) 2015/06/24 14:59:43 Looking forward to this function going away. :)
55 return base::CommandLine::ForCurrentProcess()->HasSwitch( 55 return true;
56 switches::kSitePerProcess);
57 } 56 }
58 57
59 RenderFrameHostManager::RenderFrameHostManager( 58 RenderFrameHostManager::RenderFrameHostManager(
60 FrameTreeNode* frame_tree_node, 59 FrameTreeNode* frame_tree_node,
61 RenderFrameHostDelegate* render_frame_delegate, 60 RenderFrameHostDelegate* render_frame_delegate,
62 RenderViewHostDelegate* render_view_delegate, 61 RenderViewHostDelegate* render_view_delegate,
63 RenderWidgetHostDelegate* render_widget_delegate, 62 RenderWidgetHostDelegate* render_widget_delegate,
64 Delegate* delegate) 63 Delegate* delegate)
65 : frame_tree_node_(frame_tree_node), 64 : frame_tree_node_(frame_tree_node),
66 delegate_(delegate), 65 delegate_(delegate),
67 render_frame_delegate_(render_frame_delegate), 66 render_frame_delegate_(render_frame_delegate),
68 render_view_delegate_(render_view_delegate), 67 render_view_delegate_(render_view_delegate),
69 render_widget_delegate_(render_widget_delegate), 68 render_widget_delegate_(render_widget_delegate),
70 interstitial_page_(nullptr), 69 interstitial_page_(nullptr),
71 should_reuse_web_ui_(false), 70 should_reuse_web_ui_(false),
72 weak_factory_(this) { 71 weak_factory_(this) {
73 DCHECK(frame_tree_node_); 72 DCHECK(frame_tree_node_);
73 LOG(ERROR) << "RFHM[" << this << "]::RFHM:"
74 << " parent:" << frame_tree_node_->parent();
74 } 75 }
75 76
76 RenderFrameHostManager::~RenderFrameHostManager() { 77 RenderFrameHostManager::~RenderFrameHostManager() {
77 if (pending_render_frame_host_) { 78 if (pending_render_frame_host_) {
78 scoped_ptr<RenderFrameHostImpl> relic = UnsetPendingRenderFrameHost(); 79 scoped_ptr<RenderFrameHostImpl> relic = UnsetPendingRenderFrameHost();
79 ShutdownProxiesIfLastActiveFrameInSiteInstance(relic.get()); 80 ShutdownProxiesIfLastActiveFrameInSiteInstance(relic.get());
80 } 81 }
81 82
82 if (speculative_render_frame_host_) { 83 if (speculative_render_frame_host_) {
83 scoped_ptr<RenderFrameHostImpl> relic = UnsetSpeculativeRenderFrameHost(); 84 scoped_ptr<RenderFrameHostImpl> relic = UnsetSpeculativeRenderFrameHost();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 frame_entry.url(), 199 frame_entry.url(),
199 // TODO(creis): Move source_site_instance to FNE. 200 // TODO(creis): Move source_site_instance to FNE.
200 entry.source_site_instance(), frame_entry.site_instance(), 201 entry.source_site_instance(), frame_entry.site_instance(),
201 entry.GetTransitionType(), 202 entry.GetTransitionType(),
202 entry.restore_type() != NavigationEntryImpl::RESTORE_NONE, 203 entry.restore_type() != NavigationEntryImpl::RESTORE_NONE,
203 entry.IsViewSourceMode(), entry.transferred_global_request_id(), 204 entry.IsViewSourceMode(), entry.transferred_global_request_id(),
204 entry.bindings()); 205 entry.bindings());
205 if (!dest_render_frame_host) 206 if (!dest_render_frame_host)
206 return NULL; // We weren't able to create a pending render frame host. 207 return NULL; // We weren't able to create a pending render frame host.
207 208
209 LOG(ERROR) << "RFHM[" << this << "]::Navigate:"
210 << " rfh:" << render_frame_host_
211 << " dest_rfh:" << dest_render_frame_host;
212
208 // If the current render_frame_host_ isn't live, we should create it so 213 // If the current render_frame_host_ isn't live, we should create it so
209 // that we don't show a sad tab while the dest_render_frame_host fetches 214 // that we don't show a sad tab while the dest_render_frame_host fetches
210 // its first page. (Bug 1145340) 215 // its first page. (Bug 1145340)
211 if (dest_render_frame_host != render_frame_host_ && 216 if (dest_render_frame_host != render_frame_host_ &&
212 !render_frame_host_->IsRenderFrameLive()) { 217 !render_frame_host_->IsRenderFrameLive()) {
218 LOG(ERROR) << "RFHM[" << this << "]::Navigate:"
219 << " dest rfh != rfh and rfh not live";
213 // Note: we don't call InitRenderView here because we are navigating away 220 // Note: we don't call InitRenderView here because we are navigating away
214 // soon anyway, and we don't have the NavigationEntry for this host. 221 // soon anyway, and we don't have the NavigationEntry for this host.
215 delegate_->CreateRenderViewForRenderManager( 222 delegate_->CreateRenderViewForRenderManager(
216 render_frame_host_->render_view_host(), MSG_ROUTING_NONE, 223 render_frame_host_->render_view_host(), MSG_ROUTING_NONE,
217 MSG_ROUTING_NONE, frame_tree_node_->current_replication_state(), 224 MSG_ROUTING_NONE, frame_tree_node_->current_replication_state(),
218 frame_tree_node_->IsMainFrame()); 225 frame_tree_node_->IsMainFrame());
219 } 226 }
220 227
221 // If the renderer crashed, then try to create a new one to satisfy this 228 // If the renderer crashed, then try to create a new one to satisfy this
222 // navigation request. 229 // navigation request.
223 if (!dest_render_frame_host->IsRenderFrameLive()) { 230 if (!dest_render_frame_host->IsRenderFrameLive()) {
231 LOG(ERROR) << "RFHM[" << this << "]::Navigate:"
232 << " dest rfh not live";
224 // Instruct the destination render frame host to set up a Mojo connection 233 // Instruct the destination render frame host to set up a Mojo connection
225 // with the new render frame if necessary. Note that this call needs to 234 // with the new render frame if necessary. Note that this call needs to
226 // occur before initializing the RenderView; the flow of creating the 235 // occur before initializing the RenderView; the flow of creating the
227 // RenderView can cause browser-side code to execute that expects the this 236 // RenderView can cause browser-side code to execute that expects the this
228 // RFH's ServiceRegistry to be initialized (e.g., if the site is a WebUI 237 // RFH's ServiceRegistry to be initialized (e.g., if the site is a WebUI
229 // site that is handled via Mojo, then Mojo WebUI code in //chrome will 238 // site that is handled via Mojo, then Mojo WebUI code in //chrome will
230 // add a service to this RFH's ServiceRegistry). 239 // add a service to this RFH's ServiceRegistry).
231 dest_render_frame_host->SetUpMojoIfNeeded(); 240 dest_render_frame_host->SetUpMojoIfNeeded();
232 241
233 // Recreate the opener chain. 242 // Recreate the opener chain.
(...skipping 25 matching lines...) Expand all
259 268
260 // If entry includes the request ID of a request that is being transferred, 269 // If entry includes the request ID of a request that is being transferred,
261 // the destination render frame will take ownership, so release ownership of 270 // the destination render frame will take ownership, so release ownership of
262 // the request. 271 // the request.
263 if (cross_site_transferring_request_.get() && 272 if (cross_site_transferring_request_.get() &&
264 cross_site_transferring_request_->request_id() == 273 cross_site_transferring_request_->request_id() ==
265 entry.transferred_global_request_id()) { 274 entry.transferred_global_request_id()) {
266 cross_site_transferring_request_->ReleaseRequest(); 275 cross_site_transferring_request_->ReleaseRequest();
267 } 276 }
268 277
278 LOG(ERROR) << "RFHM[" << this << "]::Navigate: " << dest_render_frame_host;
269 return dest_render_frame_host; 279 return dest_render_frame_host;
270 } 280 }
271 281
272 void RenderFrameHostManager::Stop() { 282 void RenderFrameHostManager::Stop() {
273 render_frame_host_->Stop(); 283 render_frame_host_->Stop();
274 284
275 // If we are navigating cross-process, we should stop the pending renderers. 285 // If we are navigating cross-process, we should stop the pending renderers.
276 // This will lead to a DidFailProvisionalLoad, which will properly destroy 286 // This will lead to a DidFailProvisionalLoad, which will properly destroy
277 // them. 287 // them.
278 if (pending_render_frame_host_) { 288 if (pending_render_frame_host_) {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 if (pair.second->GetSiteInstance() != parent_site_instance) { 529 if (pair.second->GetSiteInstance() != parent_site_instance) {
520 pair.second->Send(new FrameMsg_DidUpdateSandboxFlags( 530 pair.second->Send(new FrameMsg_DidUpdateSandboxFlags(
521 pair.second->GetRoutingID(), 531 pair.second->GetRoutingID(),
522 frame_tree_node_->current_replication_state().sandbox_flags)); 532 frame_tree_node_->current_replication_state().sandbox_flags));
523 } 533 }
524 } 534 }
525 } 535 }
526 536
527 void RenderFrameHostManager::RendererProcessClosing( 537 void RenderFrameHostManager::RendererProcessClosing(
528 RenderProcessHost* render_process_host) { 538 RenderProcessHost* render_process_host) {
539 LOG(ERROR) << "RFHM[" << this << "]::RendererProcessClosing:";
540
529 // Remove any swapped out RVHs from this process, so that we don't try to 541 // Remove any swapped out RVHs from this process, so that we don't try to
530 // swap them back in while the process is exiting. Start by finding them, 542 // swap them back in while the process is exiting. Start by finding them,
531 // since there could be more than one. 543 // since there could be more than one.
532 std::list<int> ids_to_remove; 544 std::list<int> ids_to_remove;
533 // Do not remove proxies in the dead process that still have active frame 545 // Do not remove proxies in the dead process that still have active frame
534 // count though, we just reset them to be uninitialized. 546 // count though, we just reset them to be uninitialized.
535 std::list<int> ids_to_keep; 547 std::list<int> ids_to_keep;
536 for (RenderFrameProxyHostMap::iterator iter = proxy_hosts_.begin(); 548 for (RenderFrameProxyHostMap::iterator iter = proxy_hosts_.begin();
537 iter != proxy_hosts_.end(); 549 iter != proxy_hosts_.end();
538 ++iter) { 550 ++iter) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } 618 }
607 619
608 // Otherwise there are active views and we need a proxy for the old RFH. 620 // Otherwise there are active views and we need a proxy for the old RFH.
609 // (There should not be one yet.) 621 // (There should not be one yet.)
610 CHECK(!GetRenderFrameProxyHost(old_render_frame_host->GetSiteInstance())); 622 CHECK(!GetRenderFrameProxyHost(old_render_frame_host->GetSiteInstance()));
611 RenderFrameProxyHost* proxy = new RenderFrameProxyHost( 623 RenderFrameProxyHost* proxy = new RenderFrameProxyHost(
612 old_render_frame_host->GetSiteInstance(), 624 old_render_frame_host->GetSiteInstance(),
613 old_render_frame_host->render_view_host(), frame_tree_node_); 625 old_render_frame_host->render_view_host(), frame_tree_node_);
614 CHECK(proxy_hosts_.insert(std::make_pair(old_site_instance_id, proxy)).second) 626 CHECK(proxy_hosts_.insert(std::make_pair(old_site_instance_id, proxy)).second)
615 << "Inserting a duplicate item."; 627 << "Inserting a duplicate item.";
628 LOG(ERROR) << "RFHM[" << this << "]::SwapOutOldFrame: "
629 << " created proxy for SI:" << proxy->GetSiteInstance()->GetId()
630 << "," << proxy->GetSiteInstance()->GetSiteURL();
616 631
617 // Tell the old RenderFrameHost to swap out and be replaced by the proxy. 632 // Tell the old RenderFrameHost to swap out and be replaced by the proxy.
618 old_render_frame_host->SwapOut(proxy, true); 633 old_render_frame_host->SwapOut(proxy, true);
619 634
620 // SwapOut creates a RenderFrameProxy, so set the proxy to be initialized. 635 // SwapOut creates a RenderFrameProxy, so set the proxy to be initialized.
621 proxy->set_render_frame_proxy_created(true); 636 proxy->set_render_frame_proxy_created(true);
622 637
623 if (RenderFrameHostManager::IsSwappedOutStateForbidden()) { 638 if (RenderFrameHostManager::IsSwappedOutStateForbidden()) {
624 // In --site-per-process, frames delete their RFH rather than storing it 639 // In --site-per-process, frames delete their RFH rather than storing it
625 // in the proxy. Schedule it for deletion once the SwapOutACK comes in. 640 // in the proxy. Schedule it for deletion once the SwapOutACK comes in.
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 if (swapped_out) 1552 if (swapped_out)
1538 proxy->set_render_frame_proxy_created(true); 1553 proxy->set_render_frame_proxy_created(true);
1539 if (frame_tree_node_->IsMainFrame()) { 1554 if (frame_tree_node_->IsMainFrame()) {
1540 // Don't show the main frame's view until we get a DidNavigate from it. 1555 // Don't show the main frame's view until we get a DidNavigate from it.
1541 // Only the RenderViewHost for the top-level RenderFrameHost has a 1556 // Only the RenderViewHost for the top-level RenderFrameHost has a
1542 // RenderWidgetHostView; RenderWidgetHosts for out-of-process iframes 1557 // RenderWidgetHostView; RenderWidgetHosts for out-of-process iframes
1543 // will be created later and hidden. 1558 // will be created later and hidden.
1544 if (render_view_host->GetView()) 1559 if (render_view_host->GetView())
1545 render_view_host->GetView()->Hide(); 1560 render_view_host->GetView()->Hide();
1546 } 1561 }
1547 // With --site-per-process, RenderViewHost for |instance| might exist 1562 // RenderViewHost for |instance| might exist prior to calling
1548 // prior to calling CreateRenderFrame, due to a subframe in 1563 // CreateRenderFrame. In such a case, InitRenderView will not create the
1549 // |instance|. In such a case, InitRenderView will not create the
1550 // RenderFrame in the renderer process and it needs to be done 1564 // RenderFrame in the renderer process and it needs to be done
1551 // explicitly. 1565 // explicitly.
1552 if (is_site_per_process) { 1566 if (swapped_out_forbidden) {
1553 // Init the RFH, so a RenderFrame is created in the renderer. 1567 // Init the RFH, so a RenderFrame is created in the renderer.
1554 DCHECK(new_render_frame_host); 1568 DCHECK(new_render_frame_host);
1555 success = InitRenderFrame(new_render_frame_host.get()); 1569 success = InitRenderFrame(new_render_frame_host.get());
1556 } 1570 }
1557 } 1571 }
1558 1572
1559 if (success) { 1573 if (success) {
1560 if (view_routing_id_ptr) 1574 if (view_routing_id_ptr)
1561 *view_routing_id_ptr = render_view_host->GetRoutingID(); 1575 *view_routing_id_ptr = render_view_host->GetRoutingID();
1562 } 1576 }
(...skipping 25 matching lines...) Expand all
1588 int RenderFrameHostManager::CreateRenderFrameProxy(SiteInstance* instance) { 1602 int RenderFrameHostManager::CreateRenderFrameProxy(SiteInstance* instance) {
1589 // A RenderFrameProxyHost should never be created in the same SiteInstance as 1603 // A RenderFrameProxyHost should never be created in the same SiteInstance as
1590 // the current RFH. 1604 // the current RFH.
1591 CHECK(instance); 1605 CHECK(instance);
1592 CHECK_NE(instance, render_frame_host_->GetSiteInstance()); 1606 CHECK_NE(instance, render_frame_host_->GetSiteInstance());
1593 1607
1594 RenderViewHostImpl* render_view_host = nullptr; 1608 RenderViewHostImpl* render_view_host = nullptr;
1595 1609
1596 // Ensure a RenderViewHost exists for |instance|, as it creates the page 1610 // Ensure a RenderViewHost exists for |instance|, as it creates the page
1597 // level structure in Blink. 1611 // level structure in Blink.
1612 LOG(ERROR) << "RFHM[" << this << "]::CreateRenderFrameProxy:"
1613 << " main_frame:" << frame_tree_node_->IsMainFrame()
1614 << " site:" << instance->GetId() << "," << instance->GetSiteURL()
1615 << " ft:" << frame_tree_node_->frame_tree();
1616
1598 if (RenderFrameHostManager::IsSwappedOutStateForbidden()) { 1617 if (RenderFrameHostManager::IsSwappedOutStateForbidden()) {
1599 render_view_host = 1618 render_view_host =
1600 frame_tree_node_->frame_tree()->GetRenderViewHost(instance); 1619 frame_tree_node_->frame_tree()->GetRenderViewHost(instance);
1620 LOG(ERROR) << "RFHM[" << this << "]::CreateRenderFrameProxy:"
1621 << " rvh:" << render_view_host;
1601 if (!render_view_host) { 1622 if (!render_view_host) {
1602 CHECK(frame_tree_node_->IsMainFrame()); 1623 CHECK(frame_tree_node_->IsMainFrame());
1603 render_view_host = frame_tree_node_->frame_tree()->CreateRenderViewHost( 1624 render_view_host = frame_tree_node_->frame_tree()->CreateRenderViewHost(
1604 instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE, true, true); 1625 instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE, true, true);
1605 } 1626 }
1606 } 1627 }
1607 1628
1608 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); 1629 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance);
1609 if (proxy && proxy->is_render_frame_proxy_live()) 1630 if (proxy && proxy->is_render_frame_proxy_live()) {
1631 LOG(ERROR) << "RFHM[" << this << "]::CreateRenderFrameProxy:"
1632 << " proxy exists and live:" << proxy;
1610 return proxy->GetRoutingID(); 1633 return proxy->GetRoutingID();
1634 }
1611 1635
1612 if (!proxy) { 1636 if (!proxy) {
1613 proxy = new RenderFrameProxyHost( 1637 proxy = new RenderFrameProxyHost(
1614 instance, render_view_host, frame_tree_node_); 1638 instance, render_view_host, frame_tree_node_);
1615 proxy_hosts_[instance->GetId()] = proxy; 1639 proxy_hosts_[instance->GetId()] = proxy;
1616 } 1640 }
1617 1641
1618 if (RenderFrameHostManager::IsSwappedOutStateForbidden() && 1642 if (RenderFrameHostManager::IsSwappedOutStateForbidden() &&
1619 frame_tree_node_->IsMainFrame()) { 1643 frame_tree_node_->IsMainFrame()) {
1620 InitRenderView( 1644 LOG(ERROR) << "RFHM[" << this << "]::CreateRenderFrameProxy:"
1645 << " init rv";
1646 bool success = InitRenderView(
1621 render_view_host, MSG_ROUTING_NONE, proxy->GetRoutingID(), true); 1647 render_view_host, MSG_ROUTING_NONE, proxy->GetRoutingID(), true);
1648 LOG(ERROR) << "RFHM[" << this << "]::CreateRenderFrameProxy:"
1649 << " init rv:" << success;
1622 proxy->set_render_frame_proxy_created(true); 1650 proxy->set_render_frame_proxy_created(true);
1623 } else { 1651 } else {
1652 LOG(ERROR) << "RFHM[" << this << "]::CreateRenderFrameProxy:"
1653 << " init proxy";
1624 proxy->InitRenderFrameProxy(); 1654 proxy->InitRenderFrameProxy();
1625 } 1655 }
1626 1656
1627 return proxy->GetRoutingID(); 1657 return proxy->GetRoutingID();
1628 } 1658 }
1629 1659
1630 void RenderFrameHostManager::CreateProxiesForChildFrame(FrameTreeNode* child) { 1660 void RenderFrameHostManager::CreateProxiesForChildFrame(FrameTreeNode* child) {
1631 for (const auto& pair : proxy_hosts_) { 1661 for (const auto& pair : proxy_hosts_) {
1632 child->render_manager()->CreateRenderFrameProxy( 1662 child->render_manager()->CreateRenderFrameProxy(
1633 pair.second->GetSiteInstance()); 1663 pair.second->GetSiteInstance());
(...skipping 16 matching lines...) Expand all
1650 proxy->set_render_frame_proxy_created(true); 1680 proxy->set_render_frame_proxy_created(true);
1651 } 1681 }
1652 1682
1653 bool RenderFrameHostManager::InitRenderView( 1683 bool RenderFrameHostManager::InitRenderView(
1654 RenderViewHostImpl* render_view_host, 1684 RenderViewHostImpl* render_view_host,
1655 int opener_route_id, 1685 int opener_route_id,
1656 int proxy_routing_id, 1686 int proxy_routing_id,
1657 bool for_main_frame_navigation) { 1687 bool for_main_frame_navigation) {
1658 // Ensure the renderer process is initialized before creating the 1688 // Ensure the renderer process is initialized before creating the
1659 // RenderView. 1689 // RenderView.
1690 LOG(ERROR) << "RFHM[" << this << "]::InitRenderView: "
1691 << " rvh:" << render_view_host;
1660 if (!render_view_host->GetProcess()->Init()) 1692 if (!render_view_host->GetProcess()->Init())
1661 return false; 1693 return false;
1662 1694
1663 // We may have initialized this RenderViewHost for another RenderFrameHost. 1695 // We may have initialized this RenderViewHost for another RenderFrameHost.
1664 if (render_view_host->IsRenderViewLive()) 1696 if (render_view_host->IsRenderViewLive()) {
1697 LOG(ERROR) << "RFHM[" << this << "]::InitRenderView: "
1698 << " rvh already live.";
1665 return true; 1699 return true;
1700 }
1666 1701
1667 // If the ongoing navigation is to a WebUI and the RenderView is not in a 1702 // If the ongoing navigation is to a WebUI and the RenderView is not in a
1668 // guest process, tell the RenderViewHost about any bindings it will need 1703 // guest process, tell the RenderViewHost about any bindings it will need
1669 // enabled. 1704 // enabled.
1670 WebUIImpl* dest_web_ui = nullptr; 1705 WebUIImpl* dest_web_ui = nullptr;
1671 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1706 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1672 switches::kEnableBrowserSideNavigation)) { 1707 switches::kEnableBrowserSideNavigation)) {
1673 dest_web_ui = 1708 dest_web_ui =
1674 should_reuse_web_ui_ ? web_ui_.get() : speculative_web_ui_.get(); 1709 should_reuse_web_ui_ ? web_ui_.get() : speculative_web_ui_.get();
1675 } else { 1710 } else {
(...skipping 13 matching lines...) Expand all
1689 return delegate_->CreateRenderViewForRenderManager( 1724 return delegate_->CreateRenderViewForRenderManager(
1690 render_view_host, 1725 render_view_host,
1691 opener_route_id, 1726 opener_route_id,
1692 proxy_routing_id, 1727 proxy_routing_id,
1693 frame_tree_node_->current_replication_state(), 1728 frame_tree_node_->current_replication_state(),
1694 for_main_frame_navigation); 1729 for_main_frame_navigation);
1695 } 1730 }
1696 1731
1697 bool RenderFrameHostManager::InitRenderFrame( 1732 bool RenderFrameHostManager::InitRenderFrame(
1698 RenderFrameHostImpl* render_frame_host) { 1733 RenderFrameHostImpl* render_frame_host) {
1699 if (render_frame_host->IsRenderFrameLive()) 1734 LOG(ERROR) << "RFHM[" << this << "]::InitRenderFrame: "
1735 << " rfh:" << render_frame_host;
1736
1737 if (render_frame_host->IsRenderFrameLive()) {
1738 LOG(ERROR) << "RFHM[" << this << "]::InitRenderFrame: "
1739 << " rfh already live.";
1700 return true; 1740 return true;
1741 }
1701 1742
1702 int parent_routing_id = MSG_ROUTING_NONE; 1743 int parent_routing_id = MSG_ROUTING_NONE;
1703 int previous_sibling_routing_id = MSG_ROUTING_NONE; 1744 int previous_sibling_routing_id = MSG_ROUTING_NONE;
1704 int proxy_routing_id = MSG_ROUTING_NONE; 1745 int proxy_routing_id = MSG_ROUTING_NONE;
1705 1746
1706 if (frame_tree_node_->parent()) { 1747 if (frame_tree_node_->parent()) {
1707 parent_routing_id = frame_tree_node_->parent()->render_manager()-> 1748 parent_routing_id = frame_tree_node_->parent()->render_manager()->
1708 GetRoutingIdForSiteInstance(render_frame_host->GetSiteInstance()); 1749 GetRoutingIdForSiteInstance(render_frame_host->GetSiteInstance());
1709 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE); 1750 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE);
1710 } 1751 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 if (!browser_side_navigation) { 1854 if (!browser_side_navigation) {
1814 DCHECK(!speculative_render_frame_host_); 1855 DCHECK(!speculative_render_frame_host_);
1815 old_render_frame_host = 1856 old_render_frame_host =
1816 SetRenderFrameHost(pending_render_frame_host_.Pass()); 1857 SetRenderFrameHost(pending_render_frame_host_.Pass());
1817 } else { 1858 } else {
1818 // PlzNavigate 1859 // PlzNavigate
1819 DCHECK(speculative_render_frame_host_); 1860 DCHECK(speculative_render_frame_host_);
1820 old_render_frame_host = 1861 old_render_frame_host =
1821 SetRenderFrameHost(speculative_render_frame_host_.Pass()); 1862 SetRenderFrameHost(speculative_render_frame_host_.Pass());
1822 } 1863 }
1864 LOG(ERROR) << "RFHM[" << this << "]::CommitPending:"
1865 << " old:" << old_render_frame_host.get()
1866 << "," << old_render_frame_host->GetSiteInstance()->GetSiteURL()
1867 << " new:" << render_frame_host_.get()
1868 << "," << render_frame_host_->GetSiteInstance()->GetSiteURL();
1823 1869
1824 // Remove the children of the old frame from the tree. 1870 // Remove the children of the old frame from the tree.
1825 frame_tree_node_->ResetForNewProcess(); 1871 frame_tree_node_->ResetForNewProcess();
1826 1872
1827 // The process will no longer try to exit, so we can decrement the count. 1873 // The process will no longer try to exit, so we can decrement the count.
1828 render_frame_host_->GetProcess()->RemovePendingView(); 1874 render_frame_host_->GetProcess()->RemovePendingView();
1829 1875
1830 // Show the new view (or a sad tab) if necessary. 1876 // Show the new view (or a sad tab) if necessary.
1831 bool new_rfh_has_view = !!render_frame_host_->GetView(); 1877 bool new_rfh_has_view = !!render_frame_host_->GetView();
1832 if (!delegate_->IsHidden() && new_rfh_has_view) { 1878 if (!delegate_->IsHidden() && new_rfh_has_view) {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation( 2024 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation(
1979 dest_url, source_instance, dest_instance, nullptr, transition, 2025 dest_url, source_instance, dest_instance, nullptr, transition,
1980 dest_is_restore, dest_is_view_source_mode); 2026 dest_is_restore, dest_is_view_source_mode);
1981 2027
1982 const NavigationEntry* current_entry = 2028 const NavigationEntry* current_entry =
1983 delegate_->GetLastCommittedNavigationEntryForRenderManager(); 2029 delegate_->GetLastCommittedNavigationEntryForRenderManager();
1984 2030
1985 DCHECK(!pending_render_frame_host_); 2031 DCHECK(!pending_render_frame_host_);
1986 2032
1987 if (new_instance.get() != current_instance) { 2033 if (new_instance.get() != current_instance) {
2034 LOG(ERROR) << "RFHM[" << this << "]::UpdateStateForNavigate:"
2035 << " navigating from:" << current_instance->GetSiteURL()
2036 << " to:" << new_instance->GetSiteURL();
2037
1988 TRACE_EVENT_INSTANT2( 2038 TRACE_EVENT_INSTANT2(
1989 "navigation", 2039 "navigation",
1990 "RenderFrameHostManager::UpdateStateForNavigate:New SiteInstance", 2040 "RenderFrameHostManager::UpdateStateForNavigate:New SiteInstance",
1991 TRACE_EVENT_SCOPE_THREAD, 2041 TRACE_EVENT_SCOPE_THREAD,
1992 "current_instance id", current_instance->GetId(), 2042 "current_instance id", current_instance->GetId(),
1993 "new_instance id", new_instance->GetId()); 2043 "new_instance id", new_instance->GetId());
1994 2044
1995 // New SiteInstance: create a pending RFH to navigate. 2045 // New SiteInstance: create a pending RFH to navigate.
1996 2046
1997 // This will possibly create (set to nullptr) a Web UI object for the 2047 // This will possibly create (set to nullptr) a Web UI object for the
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 // Unless we are transferring an existing request, we should now tell the 2096 // Unless we are transferring an existing request, we should now tell the
2047 // old render view to run its beforeunload handler, since it doesn't 2097 // old render view to run its beforeunload handler, since it doesn't
2048 // otherwise know that the cross-site request is happening. This will 2098 // otherwise know that the cross-site request is happening. This will
2049 // trigger a call to OnBeforeUnloadACK with the reply. 2099 // trigger a call to OnBeforeUnloadACK with the reply.
2050 render_frame_host_->DispatchBeforeUnload(true); 2100 render_frame_host_->DispatchBeforeUnload(true);
2051 } 2101 }
2052 2102
2053 return pending_render_frame_host_.get(); 2103 return pending_render_frame_host_.get();
2054 } 2104 }
2055 2105
2106 LOG(ERROR) << "RFHM[" << this << "]::UpdateStateForNavigate:"
2107 << " to:" << new_instance->GetSiteURL();
2108
2056 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. 2109 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_.
2057 2110
2058 // It's possible to swap out the current RFH and then decide to navigate in it 2111 // It's possible to swap out the current RFH and then decide to navigate in it
2059 // anyway (e.g., a cross-process navigation that redirects back to the 2112 // anyway (e.g., a cross-process navigation that redirects back to the
2060 // original site). In that case, we have a proxy for the current RFH but 2113 // original site). In that case, we have a proxy for the current RFH but
2061 // haven't deleted it yet. The new navigation will swap it back in, so we can 2114 // haven't deleted it yet. The new navigation will swap it back in, so we can
2062 // delete the proxy. 2115 // delete the proxy.
2063 DeleteRenderFrameProxyHost(new_instance.get()); 2116 DeleteRenderFrameProxyHost(new_instance.get());
2064 2117
2065 if (ShouldReuseWebUI(current_entry, dest_url)) { 2118 if (ShouldReuseWebUI(current_entry, dest_url)) {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2231 // Ensure that all the nodes in the opener's frame tree have 2284 // Ensure that all the nodes in the opener's frame tree have
2232 // RenderFrameProxyHosts for the new SiteInstance. 2285 // RenderFrameProxyHosts for the new SiteInstance.
2233 frame_tree->CreateProxiesForSiteInstance(nullptr, instance); 2286 frame_tree->CreateProxiesForSiteInstance(nullptr, instance);
2234 rvh = frame_tree->GetRenderViewHost(instance); 2287 rvh = frame_tree->GetRenderViewHost(instance);
2235 render_view_routing_id = rvh->GetRoutingID(); 2288 render_view_routing_id = rvh->GetRoutingID();
2236 } else { 2289 } else {
2237 // Create a swapped out RenderView in the given SiteInstance if none exists, 2290 // Create a swapped out RenderView in the given SiteInstance if none exists,
2238 // setting its opener to the given route_id. Since the opener can point to 2291 // setting its opener to the given route_id. Since the opener can point to
2239 // a subframe, do this on the root frame of the opener's frame tree. 2292 // a subframe, do this on the root frame of the opener's frame tree.
2240 // Return the new view's route_id. 2293 // Return the new view's route_id.
2241 frame_tree->root()->render_manager()-> 2294 frame_tree->root()->render_manager()->CreateRenderFrameProxy(instance);
2242 CreateRenderFrame(instance, nullptr, opener_route_id,
2243 CREATE_RF_FOR_MAIN_FRAME_NAVIGATION |
2244 CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN,
2245 &render_view_routing_id);
2246 } 2295 }
2247 return render_view_routing_id; 2296 return render_view_routing_id;
2248 } 2297 }
2249 2298
2250 } // namespace content 2299 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698