Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 old_render_frame_host->render_view_host(), frame_tree_node_); | 602 old_render_frame_host->render_view_host(), frame_tree_node_); |
| 603 CHECK(proxy_hosts_.insert(std::make_pair(old_site_instance_id, proxy)).second) | 603 CHECK(proxy_hosts_.insert(std::make_pair(old_site_instance_id, proxy)).second) |
| 604 << "Inserting a duplicate item."; | 604 << "Inserting a duplicate item."; |
| 605 | 605 |
| 606 // Tell the old RenderFrameHost to swap out and be replaced by the proxy. | 606 // Tell the old RenderFrameHost to swap out and be replaced by the proxy. |
| 607 old_render_frame_host->SwapOut(proxy, true); | 607 old_render_frame_host->SwapOut(proxy, true); |
| 608 | 608 |
| 609 // SwapOut creates a RenderFrameProxy, so set the proxy to be initialized. | 609 // SwapOut creates a RenderFrameProxy, so set the proxy to be initialized. |
| 610 proxy->set_render_frame_proxy_created(true); | 610 proxy->set_render_frame_proxy_created(true); |
| 611 | 611 |
| 612 bool is_main_frame = frame_tree_node_->IsMainFrame(); | |
| 613 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 612 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 614 switches::kSitePerProcess) && | 613 switches::kSitePerProcess)) { |
| 615 !is_main_frame) { | 614 // In --site-per-process, frames delete their RFH rather than storing it |
| 616 // In --site-per-process, subframes delete their RFH rather than storing it | |
| 617 // in the proxy. Schedule it for deletion once the SwapOutACK comes in. | 615 // in the proxy. Schedule it for deletion once the SwapOutACK comes in. |
| 618 // TODO(creis): This will be the default when we remove swappedout://. | 616 // TODO(creis): This will be the default when we remove swappedout://. |
| 619 MoveToPendingDeleteHosts(old_render_frame_host.Pass()); | 617 MoveToPendingDeleteHosts(old_render_frame_host.Pass()); |
| 620 } else { | 618 } else { |
| 621 // We shouldn't get here for subframes, since we only swap subframes when | 619 // We shouldn't get here for subframes, since we only swap subframes when |
| 622 // --site-per-process is used. | 620 // --site-per-process is used. |
| 623 DCHECK(is_main_frame); | 621 DCHECK(frame_tree_node_->IsMainFrame()); |
| 624 | 622 |
| 625 // The old RenderFrameHost will stay alive inside the proxy so that existing | 623 // The old RenderFrameHost will stay alive inside the proxy so that existing |
| 626 // JavaScript window references to it stay valid. | 624 // JavaScript window references to it stay valid. |
| 627 proxy->TakeFrameHostOwnership(old_render_frame_host.Pass()); | 625 proxy->TakeFrameHostOwnership(old_render_frame_host.Pass()); |
| 628 } | 626 } |
| 629 } | 627 } |
| 630 | 628 |
| 631 void RenderFrameHostManager::DiscardUnusedFrame( | 629 void RenderFrameHostManager::DiscardUnusedFrame( |
| 632 scoped_ptr<RenderFrameHostImpl> render_frame_host) { | 630 scoped_ptr<RenderFrameHostImpl> render_frame_host) { |
| 633 // TODO(carlosk): this code is very similar to what can be found in | 631 // TODO(carlosk): this code is very similar to what can be found in |
| 634 // SwapOutOldFrame and we should see that these are unified at some point. | 632 // SwapOutOldFrame and we should see that these are unified at some point. |
| 635 | 633 |
| 636 // If the SiteInstance for the pending RFH is being used by others don't | 634 // If the SiteInstance for the pending RFH is being used by others don't |
| 637 // delete the RFH. Just swap it out and it can be reused at a later point. | 635 // delete the RFH. Just swap it out and it can be reused at a later point. |
|
Charlie Reis
2015/06/04 00:02:11
Maybe update the first sentence here as well.
nasko
2015/06/04 14:57:13
Done.
| |
| 638 SiteInstanceImpl* site_instance = render_frame_host->GetSiteInstance(); | 636 SiteInstanceImpl* site_instance = render_frame_host->GetSiteInstance(); |
| 639 if (site_instance->HasSite() && site_instance->active_frame_count() > 1) { | 637 if (site_instance->HasSite() && site_instance->active_frame_count() > 1) { |
| 640 // Any currently suspended navigations are no longer needed. | 638 // Any currently suspended navigations are no longer needed. |
| 641 render_frame_host->CancelSuspendedNavigations(); | 639 render_frame_host->CancelSuspendedNavigations(); |
| 642 | 640 |
| 643 CHECK(!GetRenderFrameProxyHost(site_instance)); | 641 CHECK(!GetRenderFrameProxyHost(site_instance)); |
| 644 RenderFrameProxyHost* proxy = new RenderFrameProxyHost( | 642 RenderFrameProxyHost* proxy = new RenderFrameProxyHost( |
| 645 site_instance, render_frame_host->render_view_host(), frame_tree_node_); | 643 site_instance, render_frame_host->render_view_host(), frame_tree_node_); |
| 646 proxy_hosts_[site_instance->GetId()] = proxy; | 644 proxy_hosts_[site_instance->GetId()] = proxy; |
| 647 | 645 |
| 648 // Check if the RenderFrameHost is already swapped out, to avoid swapping it | 646 // Check if the RenderFrameHost is already swapped out, to avoid swapping it |
| 649 // out again. | 647 // out again. |
| 650 if (!render_frame_host->is_swapped_out()) | 648 if (!render_frame_host->is_swapped_out()) |
| 651 render_frame_host->SwapOut(proxy, false); | 649 render_frame_host->SwapOut(proxy, false); |
| 652 | 650 |
| 653 if (frame_tree_node_->IsMainFrame()) | 651 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 652 switches::kSitePerProcess)) { | |
| 653 DCHECK(frame_tree_node_->IsMainFrame()); | |
| 654 proxy->TakeFrameHostOwnership(render_frame_host.Pass()); | 654 proxy->TakeFrameHostOwnership(render_frame_host.Pass()); |
| 655 } else { | 655 } |
| 656 } | |
| 657 | |
| 658 if (render_frame_host) { | |
| 656 // We won't be coming back, so delete this one. | 659 // We won't be coming back, so delete this one. |
| 657 ShutdownProxiesIfLastActiveFrameInSiteInstance(render_frame_host.get()); | 660 ShutdownProxiesIfLastActiveFrameInSiteInstance(render_frame_host.get()); |
| 658 render_frame_host.reset(); | 661 render_frame_host.reset(); |
| 659 } | 662 } |
| 660 } | 663 } |
| 661 | 664 |
| 662 void RenderFrameHostManager::MoveToPendingDeleteHosts( | 665 void RenderFrameHostManager::MoveToPendingDeleteHosts( |
| 663 scoped_ptr<RenderFrameHostImpl> render_frame_host) { | 666 scoped_ptr<RenderFrameHostImpl> render_frame_host) { |
| 664 // |render_frame_host| will be deleted when its SwapOut ACK is received, or | 667 // |render_frame_host| will be deleted when its SwapOut ACK is received, or |
| 665 // when the timer times out, or when the RFHM itself is deleted (whichever | 668 // when the timer times out, or when the RFHM itself is deleted (whichever |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 909 RenderFrameProxyHostMap::iterator iter = | 912 RenderFrameProxyHostMap::iterator iter = |
| 910 node->render_manager()->proxy_hosts_.find(site_instance_id); | 913 node->render_manager()->proxy_hosts_.find(site_instance_id); |
| 911 if (iter != node->render_manager()->proxy_hosts_.end()) { | 914 if (iter != node->render_manager()->proxy_hosts_.end()) { |
| 912 RenderFrameProxyHost* proxy = iter->second; | 915 RenderFrameProxyHost* proxy = iter->second; |
| 913 // Delete the proxy. If it is for a main frame (and thus the RFH is stored | 916 // Delete the proxy. If it is for a main frame (and thus the RFH is stored |
| 914 // in the proxy) and it was still pending swap out, move the RFH to the | 917 // in the proxy) and it was still pending swap out, move the RFH to the |
| 915 // pending deletion list first. | 918 // pending deletion list first. |
| 916 if (node->IsMainFrame() && | 919 if (node->IsMainFrame() && |
| 917 proxy->render_frame_host() && | 920 proxy->render_frame_host() && |
| 918 proxy->render_frame_host()->rfh_state() == | 921 proxy->render_frame_host()->rfh_state() == |
| 919 RenderFrameHostImpl::STATE_PENDING_SWAP_OUT) { | 922 RenderFrameHostImpl::STATE_PENDING_SWAP_OUT) { |
| 923 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 924 switches::kSitePerProcess)); | |
| 920 scoped_ptr<RenderFrameHostImpl> swapped_out_rfh = | 925 scoped_ptr<RenderFrameHostImpl> swapped_out_rfh = |
| 921 proxy->PassFrameHostOwnership(); | 926 proxy->PassFrameHostOwnership(); |
| 922 node->render_manager()->MoveToPendingDeleteHosts(swapped_out_rfh.Pass()); | 927 node->render_manager()->MoveToPendingDeleteHosts(swapped_out_rfh.Pass()); |
| 923 } | 928 } |
| 924 delete proxy; | 929 delete proxy; |
| 925 node->render_manager()->proxy_hosts_.erase(site_instance_id); | 930 node->render_manager()->proxy_hosts_.erase(site_instance_id); |
| 926 } | 931 } |
| 927 | 932 |
| 928 return true; | 933 return true; |
| 929 } | 934 } |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1447 return true; | 1452 return true; |
| 1448 } | 1453 } |
| 1449 | 1454 |
| 1450 scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::CreateRenderFrame( | 1455 scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::CreateRenderFrame( |
| 1451 SiteInstance* instance, | 1456 SiteInstance* instance, |
| 1452 WebUIImpl* web_ui, | 1457 WebUIImpl* web_ui, |
| 1453 int opener_route_id, | 1458 int opener_route_id, |
| 1454 int flags, | 1459 int flags, |
| 1455 int* view_routing_id_ptr) { | 1460 int* view_routing_id_ptr) { |
| 1456 bool swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); | 1461 bool swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); |
| 1462 bool is_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 1463 switches::kSitePerProcess); | |
| 1464 | |
| 1457 CHECK(instance); | 1465 CHECK(instance); |
| 1466 CHECK_IMPLIES(is_site_per_process, !swapped_out); | |
| 1467 | |
| 1458 // Swapped out views should always be hidden. | 1468 // Swapped out views should always be hidden. |
| 1459 DCHECK(!swapped_out || (flags & CREATE_RF_HIDDEN)); | 1469 DCHECK_IMPLIES(swapped_out, (flags & CREATE_RF_HIDDEN)); |
| 1460 | |
| 1461 // TODO(nasko): Remove the following CHECK once cross-process navigation no | |
| 1462 // longer relies on swapped out RFH for the top-level frame. | |
| 1463 if (!frame_tree_node_->IsMainFrame()) | |
| 1464 CHECK(!swapped_out); | |
| 1465 | 1470 |
| 1466 scoped_ptr<RenderFrameHostImpl> new_render_frame_host; | 1471 scoped_ptr<RenderFrameHostImpl> new_render_frame_host; |
| 1467 bool success = true; | 1472 bool success = true; |
| 1468 if (view_routing_id_ptr) | 1473 if (view_routing_id_ptr) |
| 1469 *view_routing_id_ptr = MSG_ROUTING_NONE; | 1474 *view_routing_id_ptr = MSG_ROUTING_NONE; |
| 1470 | 1475 |
| 1471 // We are creating a pending, speculative or swapped out RFH here. We should | 1476 // We are creating a pending, speculative or swapped out RFH here. We should |
| 1472 // never create it in the same SiteInstance as our current RFH. | 1477 // never create it in the same SiteInstance as our current RFH. |
| 1473 CHECK_NE(render_frame_host_->GetSiteInstance(), instance); | 1478 CHECK_NE(render_frame_host_->GetSiteInstance(), instance); |
| 1474 | 1479 |
| 1475 // Check if we've already created an RFH for this SiteInstance. If so, try | 1480 // Check if we've already created an RFH for this SiteInstance. If so, try |
| 1476 // to re-use the existing one, which has already been initialized. We'll | 1481 // to re-use the existing one, which has already been initialized. We'll |
| 1477 // remove it from the list of proxy hosts below if it will be active. | 1482 // remove it from the list of proxy hosts below if it will be active. |
| 1478 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); | 1483 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); |
| 1479 if (proxy && proxy->render_frame_host()) { | 1484 if (proxy && proxy->render_frame_host()) { |
| 1485 CHECK(!is_site_per_process); | |
| 1480 if (view_routing_id_ptr) | 1486 if (view_routing_id_ptr) |
| 1481 *view_routing_id_ptr = proxy->GetRenderViewHost()->GetRoutingID(); | 1487 *view_routing_id_ptr = proxy->GetRenderViewHost()->GetRoutingID(); |
| 1482 // Delete the existing RenderFrameProxyHost, but reuse the RenderFrameHost. | 1488 // Delete the existing RenderFrameProxyHost, but reuse the RenderFrameHost. |
| 1483 // Prevent the process from exiting while we're trying to use it. | 1489 // Prevent the process from exiting while we're trying to use it. |
| 1484 if (!swapped_out) { | 1490 if (!swapped_out) { |
| 1485 new_render_frame_host = proxy->PassFrameHostOwnership(); | 1491 new_render_frame_host = proxy->PassFrameHostOwnership(); |
| 1486 new_render_frame_host->GetProcess()->AddPendingView(); | 1492 new_render_frame_host->GetProcess()->AddPendingView(); |
| 1487 | 1493 |
| 1488 proxy_hosts_.erase(instance->GetId()); | 1494 proxy_hosts_.erase(instance->GetId()); |
| 1489 delete proxy; | 1495 delete proxy; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1516 // Remember that InitRenderView also created the RenderFrameProxy. | 1522 // Remember that InitRenderView also created the RenderFrameProxy. |
| 1517 if (swapped_out) | 1523 if (swapped_out) |
| 1518 proxy->set_render_frame_proxy_created(true); | 1524 proxy->set_render_frame_proxy_created(true); |
| 1519 if (frame_tree_node_->IsMainFrame()) { | 1525 if (frame_tree_node_->IsMainFrame()) { |
| 1520 // Don't show the main frame's view until we get a DidNavigate from it. | 1526 // Don't show the main frame's view until we get a DidNavigate from it. |
| 1521 // Only the RenderViewHost for the top-level RenderFrameHost has a | 1527 // Only the RenderViewHost for the top-level RenderFrameHost has a |
| 1522 // RenderWidgetHostView; RenderWidgetHosts for out-of-process iframes | 1528 // RenderWidgetHostView; RenderWidgetHosts for out-of-process iframes |
| 1523 // will be created later and hidden. | 1529 // will be created later and hidden. |
| 1524 if (render_view_host->GetView()) | 1530 if (render_view_host->GetView()) |
| 1525 render_view_host->GetView()->Hide(); | 1531 render_view_host->GetView()->Hide(); |
| 1526 } else if (!swapped_out) { | 1532 } |
| 1533 if (is_site_per_process) { | |
|
Charlie Reis
2015/06/04 00:02:11
I don't understand this change. Can you help expl
nasko
2015/06/04 14:57:13
With this CL and --site-per-process, this method i
| |
| 1527 // Init the RFH, so a RenderFrame is created in the renderer. | 1534 // Init the RFH, so a RenderFrame is created in the renderer. |
| 1528 DCHECK(new_render_frame_host); | 1535 DCHECK(new_render_frame_host); |
| 1529 success = InitRenderFrame(new_render_frame_host.get()); | 1536 success = InitRenderFrame(new_render_frame_host.get()); |
| 1530 } | 1537 } |
| 1531 } | 1538 } |
| 1532 | 1539 |
| 1533 if (success) { | 1540 if (success) { |
| 1534 if (view_routing_id_ptr) | 1541 if (view_routing_id_ptr) |
| 1535 *view_routing_id_ptr = render_view_host->GetRoutingID(); | 1542 *view_routing_id_ptr = render_view_host->GetRoutingID(); |
| 1536 } | 1543 } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1558 } | 1565 } |
| 1559 return nullptr; | 1566 return nullptr; |
| 1560 } | 1567 } |
| 1561 | 1568 |
| 1562 int RenderFrameHostManager::CreateRenderFrameProxy(SiteInstance* instance) { | 1569 int RenderFrameHostManager::CreateRenderFrameProxy(SiteInstance* instance) { |
| 1563 // A RenderFrameProxyHost should never be created in the same SiteInstance as | 1570 // A RenderFrameProxyHost should never be created in the same SiteInstance as |
| 1564 // the current RFH. | 1571 // the current RFH. |
| 1565 CHECK(instance); | 1572 CHECK(instance); |
| 1566 CHECK_NE(instance, render_frame_host_->GetSiteInstance()); | 1573 CHECK_NE(instance, render_frame_host_->GetSiteInstance()); |
| 1567 | 1574 |
| 1575 bool is_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 1576 switches::kSitePerProcess); | |
| 1577 RenderViewHostImpl* render_view_host = nullptr; | |
| 1578 | |
| 1579 // Ensure a RenderViewHost exists for |instance|, as it creates the page | |
| 1580 // level structure in Blink. | |
| 1581 if (is_site_per_process) { | |
| 1582 render_view_host = | |
| 1583 frame_tree_node_->frame_tree()->GetRenderViewHost(instance); | |
| 1584 if (!render_view_host) { | |
| 1585 CHECK(frame_tree_node_->IsMainFrame()); | |
| 1586 render_view_host = frame_tree_node_->frame_tree()->CreateRenderViewHost( | |
| 1587 instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE, true, true); | |
| 1588 } | |
| 1589 } | |
| 1590 | |
| 1568 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); | 1591 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); |
| 1569 if (proxy && proxy->is_render_frame_proxy_live()) | 1592 if (proxy && proxy->is_render_frame_proxy_live()) { |
|
Charlie Reis
2015/06/04 00:02:11
nit: No braces needed.
nasko
2015/06/04 14:57:13
Done.
| |
| 1570 return proxy->GetRoutingID(); | 1593 return proxy->GetRoutingID(); |
| 1594 } | |
| 1571 | 1595 |
| 1572 if (!proxy) { | 1596 if (!proxy) { |
| 1573 proxy = new RenderFrameProxyHost( | 1597 proxy = new RenderFrameProxyHost( |
| 1574 instance, frame_tree_node_->frame_tree()->GetRenderViewHost(instance), | 1598 instance, render_view_host, frame_tree_node_); |
|
Charlie Reis
2015/06/04 00:02:11
This looks like a regression for non-site-per-proc
nasko
2015/06/04 14:57:13
This method will never be called for the main fram
| |
| 1575 frame_tree_node_); | |
| 1576 proxy_hosts_[instance->GetId()] = proxy; | 1599 proxy_hosts_[instance->GetId()] = proxy; |
| 1577 } | 1600 } |
| 1578 proxy->InitRenderFrameProxy(); | 1601 |
| 1602 if (is_site_per_process && frame_tree_node_->IsMainFrame()) { | |
| 1603 InitRenderView( | |
|
Charlie Reis
2015/06/04 00:02:11
Why would we need to call this if the RVH already
nasko
2015/06/04 14:57:13
We generally don't need to. But we don't know whet
| |
| 1604 render_view_host, MSG_ROUTING_NONE, proxy->GetRoutingID(), true); | |
| 1605 proxy->set_render_frame_proxy_created(true); | |
| 1606 } else { | |
| 1607 proxy->InitRenderFrameProxy(); | |
|
Charlie Reis
2015/06/04 00:02:11
Why don't we need to call this for main frames in
nasko
2015/06/04 14:57:13
See the comment above. The IPC to create the Rende
| |
| 1608 } | |
| 1609 | |
| 1579 return proxy->GetRoutingID(); | 1610 return proxy->GetRoutingID(); |
| 1580 } | 1611 } |
| 1581 | 1612 |
| 1582 void RenderFrameHostManager::CreateProxiesForChildFrame(FrameTreeNode* child) { | 1613 void RenderFrameHostManager::CreateProxiesForChildFrame(FrameTreeNode* child) { |
| 1583 for (const auto& pair : proxy_hosts_) { | 1614 for (const auto& pair : proxy_hosts_) { |
| 1584 child->render_manager()->CreateRenderFrameProxy( | 1615 child->render_manager()->CreateRenderFrameProxy( |
| 1585 pair.second->GetSiteInstance()); | 1616 pair.second->GetSiteInstance()); |
| 1586 } | 1617 } |
| 1587 } | 1618 } |
| 1588 | 1619 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1602 InitRenderView(render_view_host, opener_route_id, proxy->GetRoutingID(), | 1633 InitRenderView(render_view_host, opener_route_id, proxy->GetRoutingID(), |
| 1603 source->IsMainFrame()); | 1634 source->IsMainFrame()); |
| 1604 proxy->set_render_frame_proxy_created(true); | 1635 proxy->set_render_frame_proxy_created(true); |
| 1605 } | 1636 } |
| 1606 | 1637 |
| 1607 bool RenderFrameHostManager::InitRenderView( | 1638 bool RenderFrameHostManager::InitRenderView( |
| 1608 RenderViewHostImpl* render_view_host, | 1639 RenderViewHostImpl* render_view_host, |
| 1609 int opener_route_id, | 1640 int opener_route_id, |
| 1610 int proxy_routing_id, | 1641 int proxy_routing_id, |
| 1611 bool for_main_frame_navigation) { | 1642 bool for_main_frame_navigation) { |
| 1643 if (!render_view_host->GetProcess()->Init()) | |
|
Charlie Reis
2015/06/04 00:02:11
The same thing exists on line 1652. Why do we nee
nasko
2015/06/04 14:57:13
Mistake on my part, just needed to move up.
| |
| 1644 return false; | |
| 1645 | |
| 1612 // We may have initialized this RenderViewHost for another RenderFrameHost. | 1646 // We may have initialized this RenderViewHost for another RenderFrameHost. |
| 1613 if (render_view_host->IsRenderViewLive()) | 1647 if (render_view_host->IsRenderViewLive()) |
| 1614 return true; | 1648 return true; |
| 1615 | 1649 |
| 1616 // Ensure the renderer process is initialized before creating the | 1650 // Ensure the renderer process is initialized before creating the |
| 1617 // RenderView. | 1651 // RenderView. |
| 1618 if (!render_view_host->GetProcess()->Init()) | 1652 if (!render_view_host->GetProcess()->Init()) |
| 1619 return false; | 1653 return false; |
| 1620 | 1654 |
| 1621 // If the ongoing navigation is to a WebUI and the RenderView is not in a | 1655 // If the ongoing navigation is to a WebUI and the RenderView is not in a |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1816 | 1850 |
| 1817 // Swap out the old frame now that the new one is visible. | 1851 // Swap out the old frame now that the new one is visible. |
| 1818 // This will swap it out and then put it on the proxy list (if there are other | 1852 // This will swap it out and then put it on the proxy list (if there are other |
| 1819 // active views in its SiteInstance) or schedule it for deletion when the swap | 1853 // active views in its SiteInstance) or schedule it for deletion when the swap |
| 1820 // out ack arrives (or immediately if the process isn't live). | 1854 // out ack arrives (or immediately if the process isn't live). |
| 1821 // In the --site-per-process case, old subframe RHFs are not kept alive inside | 1855 // In the --site-per-process case, old subframe RHFs are not kept alive inside |
| 1822 // the proxy. | 1856 // the proxy. |
| 1823 SwapOutOldFrame(old_render_frame_host.Pass()); | 1857 SwapOutOldFrame(old_render_frame_host.Pass()); |
| 1824 | 1858 |
| 1825 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1859 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1826 switches::kSitePerProcess) && | 1860 switches::kSitePerProcess)) { |
| 1827 !is_main_frame) { | |
| 1828 // Since the new RenderFrameHost is now committed, there must be no proxies | 1861 // Since the new RenderFrameHost is now committed, there must be no proxies |
| 1829 // for its SiteInstance. Delete any existing ones. | 1862 // for its SiteInstance. Delete any existing ones. |
| 1830 RenderFrameProxyHostMap::iterator iter = | 1863 RenderFrameProxyHostMap::iterator iter = |
| 1831 proxy_hosts_.find(render_frame_host_->GetSiteInstance()->GetId()); | 1864 proxy_hosts_.find(render_frame_host_->GetSiteInstance()->GetId()); |
| 1832 if (iter != proxy_hosts_.end()) { | 1865 if (iter != proxy_hosts_.end()) { |
| 1833 delete iter->second; | 1866 delete iter->second; |
| 1834 proxy_hosts_.erase(iter); | 1867 proxy_hosts_.erase(iter); |
| 1835 } | 1868 } |
| 1836 | 1869 |
| 1837 // If this is a subframe, it should have a CrossProcessFrameConnector | 1870 // If this is a subframe, it should have a CrossProcessFrameConnector |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2119 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 2152 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
| 2120 SiteInstance* instance) { | 2153 SiteInstance* instance) { |
| 2121 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 2154 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
| 2122 if (iter != proxy_hosts_.end()) { | 2155 if (iter != proxy_hosts_.end()) { |
| 2123 delete iter->second; | 2156 delete iter->second; |
| 2124 proxy_hosts_.erase(iter); | 2157 proxy_hosts_.erase(iter); |
| 2125 } | 2158 } |
| 2126 } | 2159 } |
| 2127 | 2160 |
| 2128 } // namespace content | 2161 } // namespace content |
| OLD | NEW |