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

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

Issue 236003002: Revert 263352 "Introduce RenderFrameProxyHost object and use it ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "content/browser/child_process_security_policy_impl.h" 12 #include "content/browser/child_process_security_policy_impl.h"
13 #include "content/browser/devtools/render_view_devtools_agent_host.h" 13 #include "content/browser/devtools/render_view_devtools_agent_host.h"
14 #include "content/browser/frame_host/cross_process_frame_connector.h" 14 #include "content/browser/frame_host/cross_process_frame_connector.h"
15 #include "content/browser/frame_host/cross_site_transferring_request.h" 15 #include "content/browser/frame_host/cross_site_transferring_request.h"
16 #include "content/browser/frame_host/debug_urls.h" 16 #include "content/browser/frame_host/debug_urls.h"
17 #include "content/browser/frame_host/interstitial_page_impl.h" 17 #include "content/browser/frame_host/interstitial_page_impl.h"
18 #include "content/browser/frame_host/navigation_controller_impl.h" 18 #include "content/browser/frame_host/navigation_controller_impl.h"
19 #include "content/browser/frame_host/navigation_entry_impl.h" 19 #include "content/browser/frame_host/navigation_entry_impl.h"
20 #include "content/browser/frame_host/navigator.h" 20 #include "content/browser/frame_host/navigator.h"
21 #include "content/browser/frame_host/render_frame_host_factory.h" 21 #include "content/browser/frame_host/render_frame_host_factory.h"
22 #include "content/browser/frame_host/render_frame_host_impl.h" 22 #include "content/browser/frame_host/render_frame_host_impl.h"
23 #include "content/browser/frame_host/render_frame_proxy_host.h"
24 #include "content/browser/renderer_host/render_process_host_impl.h" 23 #include "content/browser/renderer_host/render_process_host_impl.h"
25 #include "content/browser/renderer_host/render_view_host_factory.h" 24 #include "content/browser/renderer_host/render_view_host_factory.h"
26 #include "content/browser/renderer_host/render_view_host_impl.h" 25 #include "content/browser/renderer_host/render_view_host_impl.h"
27 #include "content/browser/site_instance_impl.h" 26 #include "content/browser/site_instance_impl.h"
28 #include "content/browser/webui/web_ui_controller_factory_registry.h" 27 #include "content/browser/webui/web_ui_controller_factory_registry.h"
29 #include "content/browser/webui/web_ui_impl.h" 28 #include "content/browser/webui/web_ui_impl.h"
30 #include "content/common/view_messages.h" 29 #include "content/common/view_messages.h"
31 #include "content/port/browser/render_widget_host_view_port.h" 30 #include "content/port/browser/render_widget_host_view_port.h"
32 #include "content/public/browser/content_browser_client.h" 31 #include "content/public/browser/content_browser_client.h"
33 #include "content/public/browser/notification_service.h" 32 #include "content/public/browser/notification_service.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 RenderFrameHostManager::~RenderFrameHostManager() { 82 RenderFrameHostManager::~RenderFrameHostManager() {
84 if (pending_render_frame_host_) 83 if (pending_render_frame_host_)
85 CancelPending(); 84 CancelPending();
86 85
87 if (cross_process_frame_connector_) 86 if (cross_process_frame_connector_)
88 delete cross_process_frame_connector_; 87 delete cross_process_frame_connector_;
89 88
90 // We should always have a current RenderFrameHost except in some tests. 89 // We should always have a current RenderFrameHost except in some tests.
91 render_frame_host_.reset(); 90 render_frame_host_.reset();
92 91
92 // TODO(creis): Now that we aren't using Shutdown, make RenderFrameHostMap
93 // use scoped_ptrs.
93 // Delete any swapped out RenderFrameHosts. 94 // Delete any swapped out RenderFrameHosts.
94 for (RenderFrameProxyHostMap::iterator iter = proxy_hosts_.begin(); 95 for (RenderFrameHostMap::iterator iter = swapped_out_hosts_.begin();
95 iter != proxy_hosts_.end(); 96 iter != swapped_out_hosts_.end();
96 ++iter) { 97 ++iter) {
97 delete iter->second; 98 delete iter->second;
98 } 99 }
99 } 100 }
100 101
101 void RenderFrameHostManager::Init(BrowserContext* browser_context, 102 void RenderFrameHostManager::Init(BrowserContext* browser_context,
102 SiteInstance* site_instance, 103 SiteInstance* site_instance,
103 int view_routing_id, 104 int view_routing_id,
104 int frame_routing_id) { 105 int frame_routing_id) {
105 // Create a RenderViewHost and RenderFrameHost, once we have an instance. It 106 // Create a RenderViewHost and RenderFrameHost, once we have an instance. It
106 // is important to immediately give this SiteInstance to a RenderViewHost so 107 // is important to immediately give this SiteInstance to a RenderViewHost so
107 // that the SiteInstance is ref counted. 108 // that the SiteInstance is ref counted.
108 if (!site_instance) 109 if (!site_instance)
109 site_instance = SiteInstance::Create(browser_context); 110 site_instance = SiteInstance::Create(browser_context);
110 111
111 render_frame_host_ = CreateRenderFrameHost(site_instance, 112 render_frame_host_ = make_scoped_ptr(
112 view_routing_id, 113 CreateRenderFrameHost(site_instance, view_routing_id, frame_routing_id,
113 frame_routing_id, 114 false, delegate_->IsHidden()));
114 false,
115 delegate_->IsHidden());
116 115
117 // Keep track of renderer processes as they start to shut down or are 116 // Keep track of renderer processes as they start to shut down or are
118 // crashed/killed. 117 // crashed/killed.
119 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED, 118 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED,
120 NotificationService::AllSources()); 119 NotificationService::AllSources());
121 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSING, 120 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSING,
122 NotificationService::AllSources()); 121 NotificationService::AllSources());
123 } 122 }
124 123
125 RenderViewHostImpl* RenderFrameHostManager::current_host() const { 124 RenderViewHostImpl* RenderFrameHostManager::current_host() const {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 cross_navigation_pending_ = false; 440 cross_navigation_pending_ = false;
442 } else { 441 } else {
443 // No one else should be sending us DidNavigate in this state. 442 // No one else should be sending us DidNavigate in this state.
444 DCHECK(false); 443 DCHECK(false);
445 } 444 }
446 } 445 }
447 446
448 // TODO(creis): Take in RenderFrameHost instead, since frames can have openers. 447 // TODO(creis): Take in RenderFrameHost instead, since frames can have openers.
449 void RenderFrameHostManager::DidDisownOpener(RenderViewHost* render_view_host) { 448 void RenderFrameHostManager::DidDisownOpener(RenderViewHost* render_view_host) {
450 // Notify all swapped out hosts, including the pending RVH. 449 // Notify all swapped out hosts, including the pending RVH.
451 for (RenderFrameProxyHostMap::iterator iter = proxy_hosts_.begin(); 450 for (RenderFrameHostMap::iterator iter = swapped_out_hosts_.begin();
452 iter != proxy_hosts_.end(); 451 iter != swapped_out_hosts_.end();
453 ++iter) { 452 ++iter) {
454 DCHECK_NE(iter->second->GetSiteInstance(), 453 DCHECK_NE(iter->second->GetSiteInstance(),
455 current_frame_host()->GetSiteInstance()); 454 current_frame_host()->GetSiteInstance());
456 iter->second->render_view_host()->DisownOpener(); 455 iter->second->render_view_host()->DisownOpener();
457 } 456 }
458 } 457 }
459 458
460 void RenderFrameHostManager::RendererProcessClosing( 459 void RenderFrameHostManager::RendererProcessClosing(
461 RenderProcessHost* render_process_host) { 460 RenderProcessHost* render_process_host) {
462 // Remove any swapped out RVHs from this process, so that we don't try to 461 // Remove any swapped out RVHs from this process, so that we don't try to
463 // swap them back in while the process is exiting. Start by finding them, 462 // swap them back in while the process is exiting. Start by finding them,
464 // since there could be more than one. 463 // since there could be more than one.
465 std::list<int> ids_to_remove; 464 std::list<int> ids_to_remove;
466 for (RenderFrameProxyHostMap::iterator iter = proxy_hosts_.begin(); 465 for (RenderFrameHostMap::iterator iter = swapped_out_hosts_.begin();
467 iter != proxy_hosts_.end(); 466 iter != swapped_out_hosts_.end();
468 ++iter) { 467 ++iter) {
469 if (iter->second->GetProcess() == render_process_host) 468 if (iter->second->GetProcess() == render_process_host)
470 ids_to_remove.push_back(iter->first); 469 ids_to_remove.push_back(iter->first);
471 } 470 }
472 471
473 // Now delete them. 472 // Now delete them.
474 while (!ids_to_remove.empty()) { 473 while (!ids_to_remove.empty()) {
475 delete proxy_hosts_[ids_to_remove.back()]; 474 delete swapped_out_hosts_[ids_to_remove.back()];
476 proxy_hosts_.erase(ids_to_remove.back()); 475 swapped_out_hosts_.erase(ids_to_remove.back());
477 ids_to_remove.pop_back(); 476 ids_to_remove.pop_back();
478 } 477 }
479 } 478 }
480 479
481 void RenderFrameHostManager::SwapOutOldPage() { 480 void RenderFrameHostManager::SwapOutOldPage() {
482 // Should only see this while we have a pending renderer or transfer. 481 // Should only see this while we have a pending renderer or transfer.
483 CHECK(cross_navigation_pending_ || pending_nav_params_.get()); 482 CHECK(cross_navigation_pending_ || pending_nav_params_.get());
484 483
485 // Tell the renderer to suppress any further modal dialogs so that we can swap 484 // Tell the renderer to suppress any further modal dialogs so that we can swap
486 // it out. This must be done before canceling any current dialog, in case 485 // it out. This must be done before canceling any current dialog, in case
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 case NOTIFICATION_RENDERER_PROCESS_CLOSING: 541 case NOTIFICATION_RENDERER_PROCESS_CLOSING:
543 RendererProcessClosing( 542 RendererProcessClosing(
544 Source<RenderProcessHost>(source).ptr()); 543 Source<RenderProcessHost>(source).ptr());
545 break; 544 break;
546 545
547 default: 546 default:
548 NOTREACHED(); 547 NOTREACHED();
549 } 548 }
550 } 549 }
551 550
552 bool RenderFrameHostManager::ClearProxiesInSiteInstance( 551 bool RenderFrameHostManager::ClearSwappedOutRFHsInSiteInstance(
553 int32 site_instance_id, 552 int32 site_instance_id,
554 FrameTreeNode* node) { 553 FrameTreeNode* node) {
555 RenderFrameProxyHostMap::iterator iter = 554 RenderFrameHostMap::iterator iter =
556 node->render_manager()->proxy_hosts_.find(site_instance_id); 555 node->render_manager()->swapped_out_hosts_.find(site_instance_id);
557 if (iter != node->render_manager()->proxy_hosts_.end()) { 556 if (iter != node->render_manager()->swapped_out_hosts_.end()) {
558 RenderFrameProxyHost* proxy = iter->second; 557 RenderFrameHostImpl* swapped_out_rfh = iter->second;
559 // If the RVH is pending swap out, it needs to switch state to 558 // If the RVH is pending swap out, it needs to switch state to
560 // pending shutdown. Otherwise it is deleted. 559 // pending shutdown. Otherwise it is deleted.
561 if (proxy->render_view_host()->rvh_state() == 560 if (swapped_out_rfh->render_view_host()->rvh_state() ==
562 RenderViewHostImpl::STATE_PENDING_SWAP_OUT) { 561 RenderViewHostImpl::STATE_PENDING_SWAP_OUT) {
563 scoped_ptr<RenderFrameHostImpl> swapped_out_rfh = proxy->PassFrameHost();
564
565 swapped_out_rfh->SetPendingShutdown(base::Bind( 562 swapped_out_rfh->SetPendingShutdown(base::Bind(
566 &RenderFrameHostManager::ClearPendingShutdownRFHForSiteInstance, 563 &RenderFrameHostManager::ClearPendingShutdownRFHForSiteInstance,
567 node->render_manager()->weak_factory_.GetWeakPtr(), 564 node->render_manager()->weak_factory_.GetWeakPtr(),
568 site_instance_id, 565 site_instance_id,
569 swapped_out_rfh.get())); 566 swapped_out_rfh));
570 RFHPendingDeleteMap::iterator pending_delete_iter = 567 RFHPendingDeleteMap::iterator pending_delete_iter =
571 node->render_manager()->pending_delete_hosts_.find(site_instance_id); 568 node->render_manager()->pending_delete_hosts_.find(site_instance_id);
572 if (pending_delete_iter == 569 if (pending_delete_iter ==
573 node->render_manager()->pending_delete_hosts_.end() || 570 node->render_manager()->pending_delete_hosts_.end() ||
574 pending_delete_iter->second.get() != swapped_out_rfh) { 571 pending_delete_iter->second.get() != iter->second) {
575 node->render_manager()->pending_delete_hosts_[site_instance_id] = 572 node->render_manager()->pending_delete_hosts_[site_instance_id] =
576 linked_ptr<RenderFrameHostImpl>(swapped_out_rfh.release()); 573 linked_ptr<RenderFrameHostImpl>(swapped_out_rfh);
577 } 574 }
578 } else { 575 } else {
579 delete proxy; 576 delete swapped_out_rfh;
580 } 577 }
581 node->render_manager()->proxy_hosts_.erase(site_instance_id); 578 node->render_manager()->swapped_out_hosts_.erase(site_instance_id);
582 } 579 }
583 580
584 return true; 581 return true;
585 } 582 }
586 583
587 bool RenderFrameHostManager::ShouldTransitionCrossSite() { 584 bool RenderFrameHostManager::ShouldTransitionCrossSite() {
588 // False in the single-process mode, as it makes RVHs to accumulate 585 // False in the single-process mode, as it makes RVHs to accumulate
589 // in swapped_out_hosts_. 586 // in swapped_out_hosts_.
590 // True if we are using process-per-site-instance (default) or 587 // True if we are using process-per-site-instance (default) or
591 // process-per-site (kProcessPerSite). 588 // process-per-site (kProcessPerSite).
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 } 826 }
830 827
831 // Start the new renderer in a new SiteInstance, but in the current 828 // Start the new renderer in a new SiteInstance, but in the current
832 // BrowsingInstance. It is important to immediately give this new 829 // BrowsingInstance. It is important to immediately give this new
833 // SiteInstance to a RenderViewHost (if it is different than our current 830 // SiteInstance to a RenderViewHost (if it is different than our current
834 // SiteInstance), so that it is ref counted. This will happen in 831 // SiteInstance), so that it is ref counted. This will happen in
835 // CreateRenderView. 832 // CreateRenderView.
836 return current_instance->GetRelatedSiteInstance(dest_url); 833 return current_instance->GetRelatedSiteInstance(dest_url);
837 } 834 }
838 835
839 scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::CreateRenderFrameHost( 836 RenderFrameHostImpl* RenderFrameHostManager::CreateRenderFrameHost(
840 SiteInstance* site_instance, 837 SiteInstance* site_instance,
841 int view_routing_id, 838 int view_routing_id,
842 int frame_routing_id, 839 int frame_routing_id,
843 bool swapped_out, 840 bool swapped_out,
844 bool hidden) { 841 bool hidden) {
845 if (frame_routing_id == MSG_ROUTING_NONE) 842 if (frame_routing_id == MSG_ROUTING_NONE)
846 frame_routing_id = site_instance->GetProcess()->GetNextRoutingID(); 843 frame_routing_id = site_instance->GetProcess()->GetNextRoutingID();
847 844
848 // Create a RVH for main frames, or find the existing one for subframes. 845 // Create a RVH for main frames, or find the existing one for subframes.
849 FrameTree* frame_tree = frame_tree_node_->frame_tree(); 846 FrameTree* frame_tree = frame_tree_node_->frame_tree();
850 RenderViewHostImpl* render_view_host = NULL; 847 RenderViewHostImpl* render_view_host = NULL;
851 if (frame_tree_node_->IsMainFrame()) { 848 if (frame_tree_node_->IsMainFrame()) {
852 render_view_host = frame_tree->CreateRenderViewHostForMainFrame( 849 render_view_host = frame_tree->CreateRenderViewHostForMainFrame(
853 site_instance, view_routing_id, frame_routing_id, swapped_out, hidden); 850 site_instance, view_routing_id, frame_routing_id, swapped_out, hidden);
854 } else { 851 } else {
855 render_view_host = frame_tree->GetRenderViewHostForSubFrame(site_instance); 852 render_view_host = frame_tree->GetRenderViewHostForSubFrame(site_instance);
856 853
857 // If we haven't found a RVH for a subframe RFH, it's because we currently 854 // If we haven't found a RVH for a subframe RFH, it's because we currently
858 // do not create top-level RFHs for pending subframe navigations. Create 855 // do not create top-level RFHs for pending subframe navigations. Create
859 // the RVH here for now. 856 // the RVH here for now.
860 // TODO(creis): Mirror the frame tree so this check isn't necessary. 857 // TODO(creis): Mirror the frame tree so this check isn't necessary.
861 if (!render_view_host) { 858 if (!render_view_host) {
862 render_view_host = frame_tree->CreateRenderViewHostForMainFrame( 859 render_view_host = frame_tree->CreateRenderViewHostForMainFrame(
863 site_instance, view_routing_id, frame_routing_id, swapped_out, 860 site_instance, view_routing_id, frame_routing_id, swapped_out,
864 hidden); 861 hidden);
865 } 862 }
866 } 863 }
867 864
865 // TODO(creis): Make render_frame_host a scoped_ptr.
868 // TODO(creis): Pass hidden to RFH. 866 // TODO(creis): Pass hidden to RFH.
869 scoped_ptr<RenderFrameHostImpl> render_frame_host = 867 RenderFrameHostImpl* render_frame_host =
870 make_scoped_ptr(RenderFrameHostFactory::Create(render_view_host, 868 RenderFrameHostFactory::Create(render_view_host,
871 render_frame_delegate_, 869 render_frame_delegate_,
872 frame_tree, 870 frame_tree,
873 frame_tree_node_, 871 frame_tree_node_,
874 frame_routing_id, 872 frame_routing_id,
875 swapped_out).release()); 873 swapped_out).release();
876 return render_frame_host.Pass(); 874 return render_frame_host;
877 } 875 }
878 876
879 int RenderFrameHostManager::CreateRenderFrame( 877 int RenderFrameHostManager::CreateRenderFrame(
880 SiteInstance* instance, 878 SiteInstance* instance,
881 int opener_route_id, 879 int opener_route_id,
882 bool swapped_out, 880 bool swapped_out,
883 bool hidden) { 881 bool hidden) {
884 CHECK(instance); 882 CHECK(instance);
885 DCHECK(!swapped_out || hidden); // Swapped out views should always be hidden. 883 DCHECK(!swapped_out || hidden); // Swapped out views should always be hidden.
886 884
887 scoped_ptr<RenderFrameHostImpl> new_render_frame_host;
888 int routing_id = MSG_ROUTING_NONE;
889
890 // We are creating a pending or swapped out RFH here. We should never create 885 // We are creating a pending or swapped out RFH here. We should never create
891 // it in the same SiteInstance as our current RFH. 886 // it in the same SiteInstance as our current RFH.
892 CHECK_NE(render_frame_host_->GetSiteInstance(), instance); 887 CHECK_NE(render_frame_host_->GetSiteInstance(), instance);
893 888
894 // Check if we've already created an RFH for this SiteInstance. If so, try 889 // Check if we've already created an RFH for this SiteInstance. If so, try
895 // to re-use the existing one, which has already been initialized. We'll 890 // to re-use the existing one, which has already been initialized. We'll
896 // remove it from the list of swapped out hosts if it commits. 891 // remove it from the list of swapped out hosts if it commits.
897 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); 892 RenderFrameHostImpl* new_render_frame_host =
893 GetSwappedOutRenderFrameHost(instance);
898 894
899 FrameTreeNode* parent_node = NULL; 895 FrameTreeNode* parent_node = NULL;
900 if (frame_tree_node_) 896 if (frame_tree_node_)
901 parent_node = frame_tree_node_->parent(); 897 parent_node = frame_tree_node_->parent();
902 898
903 if (proxy) { 899 if (new_render_frame_host) {
904 routing_id = proxy->render_view_host()->GetRoutingID();
905 // Delete the existing RenderFrameProxyHost, but reuse the RenderFrameHost.
906 // Prevent the process from exiting while we're trying to use it. 900 // Prevent the process from exiting while we're trying to use it.
907 if (!swapped_out) { 901 if (!swapped_out) {
908 new_render_frame_host = proxy->PassFrameHost();
909 new_render_frame_host->GetProcess()->AddPendingView(); 902 new_render_frame_host->GetProcess()->AddPendingView();
910
911 proxy_hosts_.erase(instance->GetId());
912 delete proxy;
913 } else { 903 } else {
914 // Detect if this is a cross-process child frame that is navigating 904 // Detect if this is a cross-process child frame that is navigating
915 // back to the same SiteInstance as its parent. 905 // back to the same SiteInstance as its parent.
916 if (parent_node && cross_process_frame_connector_ && 906 if (parent_node && cross_process_frame_connector_ &&
917 render_frame_host_->GetSiteInstance() == parent_node-> 907 render_frame_host_->GetSiteInstance() == parent_node->
918 render_manager()->current_frame_host()->GetSiteInstance()) { 908 render_manager()->current_frame_host()->GetSiteInstance()) {
919 delete cross_process_frame_connector_; 909 delete cross_process_frame_connector_;
920 cross_process_frame_connector_ = NULL; 910 cross_process_frame_connector_ = NULL;
921 } 911 }
922 } 912 }
923 } else { 913 } else {
924 // Create a new RenderFrameHost if we don't find an existing one. 914 // Create a new RenderFrameHost if we don't find an existing one.
925 new_render_frame_host = CreateRenderFrameHost( 915 // TODO(creis): Make new_render_frame_host a scoped_ptr.
926 instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE, swapped_out, hidden); 916 new_render_frame_host = CreateRenderFrameHost(instance, MSG_ROUTING_NONE,
917 MSG_ROUTING_NONE, swapped_out,
918 hidden);
919
920 // If the new RFH is swapped out already, store it. Otherwise prevent the
921 // process from exiting while we're trying to navigate in it.
922 if (swapped_out) {
923 swapped_out_hosts_[instance->GetId()] = new_render_frame_host;
924 } else {
925 new_render_frame_host->GetProcess()->AddPendingView();
926 }
927
927 RenderViewHostImpl* render_view_host = 928 RenderViewHostImpl* render_view_host =
928 new_render_frame_host->render_view_host(); 929 new_render_frame_host->render_view_host();
929
930 // Prevent the process from exiting while we're trying to navigate in it.
931 // Otherwise, if the new RFH is swapped out already, store it.
932 if (!swapped_out) {
933 new_render_frame_host->GetProcess()->AddPendingView();
934 } else {
935 proxy_hosts_[instance->GetId()] = new RenderFrameProxyHost(
936 new_render_frame_host.Pass());
937 }
938
939 bool success = InitRenderView(render_view_host, opener_route_id); 930 bool success = InitRenderView(render_view_host, opener_route_id);
940 if (success && frame_tree_node_->IsMainFrame()) { 931 if (success && frame_tree_node_->IsMainFrame()) {
941 // Don't show the main frame's view until we get a DidNavigate from it. 932 // Don't show the main frame's view until we get a DidNavigate from it.
942 render_view_host->GetView()->Hide(); 933 render_view_host->GetView()->Hide();
943 } else if (!swapped_out && pending_render_frame_host_) { 934 } else if (!swapped_out && pending_render_frame_host_) {
944 CancelPending(); 935 CancelPending();
945 } 936 }
946 routing_id = render_view_host->GetRoutingID();
947 } 937 }
948 938
949 // Use this as our new pending RFH if it isn't swapped out. 939 // Use this as our new pending RFH if it isn't swapped out.
950 if (!swapped_out) 940 if (!swapped_out)
951 pending_render_frame_host_ = new_render_frame_host.Pass(); 941 pending_render_frame_host_.reset(new_render_frame_host);
952 942
953 return routing_id; 943 return new_render_frame_host->render_view_host()->GetRoutingID();
954 } 944 }
955 945
956 bool RenderFrameHostManager::InitRenderView(RenderViewHost* render_view_host, 946 bool RenderFrameHostManager::InitRenderView(RenderViewHost* render_view_host,
957 int opener_route_id) { 947 int opener_route_id) {
958 // We may have initialized this RenderViewHost for another RenderFrameHost. 948 // We may have initialized this RenderViewHost for another RenderFrameHost.
959 if (render_view_host->IsRenderViewLive()) 949 if (render_view_host->IsRenderViewLive())
960 return true; 950 return true;
961 951
962 // If the pending navigation is to a WebUI and the RenderView is not in a 952 // If the pending navigation is to a WebUI and the RenderView is not in a
963 // guest process, tell the RenderViewHost about any bindings it will need 953 // guest process, tell the RenderViewHost about any bindings it will need
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 bool focus_render_view = !will_focus_location_bar && 1010 bool focus_render_view = !will_focus_location_bar &&
1021 render_frame_host_->render_view_host()->GetView() && 1011 render_frame_host_->render_view_host()->GetView() &&
1022 render_frame_host_->render_view_host()->GetView()->HasFocus(); 1012 render_frame_host_->render_view_host()->GetView()->HasFocus();
1023 1013
1024 // TODO(creis): As long as show/hide are on RVH, we don't want to do them for 1014 // TODO(creis): As long as show/hide are on RVH, we don't want to do them for
1025 // subframe navigations or they'll interfere with the top-level page. 1015 // subframe navigations or they'll interfere with the top-level page.
1026 bool is_main_frame = frame_tree_node_->IsMainFrame(); 1016 bool is_main_frame = frame_tree_node_->IsMainFrame();
1027 1017
1028 // Swap in the pending frame and make it active. Also ensure the FrameTree 1018 // Swap in the pending frame and make it active. Also ensure the FrameTree
1029 // stays in sync. 1019 // stays in sync.
1030 scoped_ptr<RenderFrameHostImpl> old_render_frame_host = 1020 RenderFrameHostImpl* old_render_frame_host = render_frame_host_.release();
1031 render_frame_host_.Pass();
1032 render_frame_host_ = pending_render_frame_host_.Pass(); 1021 render_frame_host_ = pending_render_frame_host_.Pass();
1033 if (is_main_frame) 1022 if (is_main_frame)
1034 render_frame_host_->render_view_host()->AttachToFrameTree(); 1023 render_frame_host_->render_view_host()->AttachToFrameTree();
1035 1024
1036 // The process will no longer try to exit, so we can decrement the count. 1025 // The process will no longer try to exit, so we can decrement the count.
1037 render_frame_host_->GetProcess()->RemovePendingView(); 1026 render_frame_host_->GetProcess()->RemovePendingView();
1038 1027
1039 // If the view is gone, then this RenderViewHost died while it was hidden. 1028 // If the view is gone, then this RenderViewHost died while it was hidden.
1040 // We ignored the RenderProcessGone call at the time, so we should send it now 1029 // We ignored the RenderProcessGone call at the time, so we should send it now
1041 // to make sure the sad tab shows up, etc. 1030 // to make sure the sad tab shows up, etc.
1042 if (!render_frame_host_->render_view_host()->GetView()) { 1031 if (!render_frame_host_->render_view_host()->GetView()) {
1043 delegate_->RenderProcessGoneFromRenderManager( 1032 delegate_->RenderProcessGoneFromRenderManager(
1044 render_frame_host_->render_view_host()); 1033 render_frame_host_->render_view_host());
1045 } else if (!delegate_->IsHidden()) { 1034 } else if (!delegate_->IsHidden()) {
1046 render_frame_host_->render_view_host()->GetView()->Show(); 1035 render_frame_host_->render_view_host()->GetView()->Show();
1047 } 1036 }
1048 1037
1049 // If the old view is live and top-level, hide it now that the new one is 1038 // If the old view is live and top-level, hide it now that the new one is
1050 // visible. 1039 // visible.
1051 int32 old_site_instance_id = 1040 int32 old_site_instance_id =
1052 old_render_frame_host->GetSiteInstance()->GetId(); 1041 old_render_frame_host->GetSiteInstance()->GetId();
1053 if (old_render_frame_host->render_view_host()->GetView()) { 1042 if (old_render_frame_host->render_view_host()->GetView()) {
1054 if (is_main_frame) { 1043 if (is_main_frame) {
1055 old_render_frame_host->render_view_host()->GetView()->Hide(); 1044 old_render_frame_host->render_view_host()->GetView()->Hide();
1056 old_render_frame_host->render_view_host()->WasSwappedOut(base::Bind( 1045 old_render_frame_host->render_view_host()->WasSwappedOut(base::Bind(
1057 &RenderFrameHostManager::ClearPendingShutdownRFHForSiteInstance, 1046 &RenderFrameHostManager::ClearPendingShutdownRFHForSiteInstance,
1058 weak_factory_.GetWeakPtr(), 1047 weak_factory_.GetWeakPtr(),
1059 old_site_instance_id, 1048 old_site_instance_id,
1060 old_render_frame_host.get())); 1049 old_render_frame_host));
1061 } else { 1050 } else {
1062 // TODO(creis): We'll need to set this back to false if we navigate back. 1051 // TODO(creis): We'll need to set this back to false if we navigate back.
1063 old_render_frame_host->set_swapped_out(true); 1052 old_render_frame_host->set_swapped_out(true);
1064 } 1053 }
1065 } 1054 }
1066 1055
1067 // Make sure the size is up to date. (Fix for bug 1079768.) 1056 // Make sure the size is up to date. (Fix for bug 1079768.)
1068 delegate_->UpdateRenderViewSizeForRenderManager(); 1057 delegate_->UpdateRenderViewSizeForRenderManager();
1069 1058
1070 if (will_focus_location_bar) { 1059 if (will_focus_location_bar) {
1071 delegate_->SetFocusToLocationBar(false); 1060 delegate_->SetFocusToLocationBar(false);
1072 } else if (focus_render_view && 1061 } else if (focus_render_view &&
1073 render_frame_host_->render_view_host()->GetView()) { 1062 render_frame_host_->render_view_host()->GetView()) {
1074 RenderWidgetHostViewPort::FromRWHV( 1063 RenderWidgetHostViewPort::FromRWHV(
1075 render_frame_host_->render_view_host()->GetView())->Focus(); 1064 render_frame_host_->render_view_host()->GetView())->Focus();
1076 } 1065 }
1077 1066
1078 // Notify that we've swapped RenderFrameHosts. We do this before shutting down 1067 // Notify that we've swapped RenderFrameHosts. We do this before shutting down
1079 // the RFH so that we can clean up RendererResources related to the RFH first. 1068 // the RFH so that we can clean up RendererResources related to the RFH first.
1080 // TODO(creis): Only do this on top-level RFHs for now, and later update it to 1069 // TODO(creis): Only do this on top-level RFHs for now, and later update it to
1081 // pass the RFHs. 1070 // pass the RFHs.
1082 if (is_main_frame) { 1071 if (is_main_frame) {
1083 delegate_->NotifySwappedFromRenderManager( 1072 delegate_->NotifySwappedFromRenderManager(
1084 old_render_frame_host->render_view_host(), 1073 old_render_frame_host->render_view_host(),
1085 render_frame_host_->render_view_host()); 1074 render_frame_host_->render_view_host());
1086 } 1075 }
1087 1076
1088 // If the old RFH is not live, just return as there is no work to do. 1077 // If the pending frame was on the swapped out list, we can remove it.
1089 if (!old_render_frame_host->render_view_host()->IsRenderViewLive()) { 1078 swapped_out_hosts_.erase(render_frame_host_->GetSiteInstance()->GetId());
1090 return;
1091 }
1092 1079
1093 // If the old RFH is live, we are swapping it out and should keep track of 1080 if (old_render_frame_host->render_view_host()->IsRenderViewLive()) {
1094 // it in case we navigate back to it, or it is waiting for the unload event 1081 // If the old RFH is live, we are swapping it out and should keep track of
1095 // to execute in the background. 1082 // it in case we navigate back to it, or it is waiting for the unload event
1096 // TODO(creis): Swap out the subframe in --site-per-process. 1083 // to execute in the background.
1097 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) 1084 // TODO(creis): Swap out the subframe in --site-per-process.
1098 DCHECK(old_render_frame_host->is_swapped_out() || 1085 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess))
1099 !RenderViewHostImpl::IsRVHStateActive( 1086 DCHECK(old_render_frame_host->is_swapped_out() ||
1100 old_render_frame_host->render_view_host()->rvh_state())); 1087 !RenderViewHostImpl::IsRVHStateActive(
1101 // Temp fix for http://crbug.com/90867 until we do a better cleanup to make 1088 old_render_frame_host->render_view_host()->rvh_state()));
1102 // sure we don't get different rvh instances for the same site instance 1089 // Temp fix for http://crbug.com/90867 until we do a better cleanup to make
1103 // in the same rvhmgr. 1090 // sure we don't get different rvh instances for the same site instance
1104 // TODO(creis): Clean this up. 1091 // in the same rvhmgr.
1105 RenderFrameProxyHostMap::iterator iter = 1092 // TODO(creis): Clean this up.
1106 proxy_hosts_.find(old_site_instance_id); 1093 RenderFrameHostMap::iterator iter =
1107 if (iter != proxy_hosts_.end() && 1094 swapped_out_hosts_.find(old_site_instance_id);
1108 iter->second->render_frame_host() != old_render_frame_host) { 1095 if (iter != swapped_out_hosts_.end() &&
1109 // Delete the proxy that will be replaced in the map to avoid a leak. 1096 iter->second != old_render_frame_host) {
1110 delete iter->second; 1097 // Delete the RFH that will be replaced in the map to avoid a leak.
1111 } 1098 delete iter->second;
1099 }
1100 // If the RenderViewHost backing the RenderFrameHost is pending shutdown,
1101 // the RenderFrameHost should be put in the map of RenderFrameHosts pending
1102 // shutdown. Otherwise, it is stored in the map of swapped out
1103 // RenderFrameHosts.
1104 if (old_render_frame_host->render_view_host()->rvh_state() ==
1105 RenderViewHostImpl::STATE_PENDING_SHUTDOWN) {
1106 swapped_out_hosts_.erase(old_site_instance_id);
1107 RFHPendingDeleteMap::iterator pending_delete_iter =
1108 pending_delete_hosts_.find(old_site_instance_id);
1109 if (pending_delete_iter == pending_delete_hosts_.end() ||
1110 pending_delete_iter->second.get() != old_render_frame_host) {
1111 pending_delete_hosts_[old_site_instance_id] =
1112 linked_ptr<RenderFrameHostImpl>(old_render_frame_host);
1113 }
1114 } else {
1115 swapped_out_hosts_[old_site_instance_id] = old_render_frame_host;
1116 }
1112 1117
1113 // If the RenderViewHost backing the RenderFrameHost is pending shutdown,
1114 // the RenderFrameHost should be put in the map of RenderFrameHosts pending
1115 // shutdown. Otherwise, it is stored in the map of proxy hosts.
1116 if (old_render_frame_host->render_view_host()->rvh_state() ==
1117 RenderViewHostImpl::STATE_PENDING_SHUTDOWN) {
1118 proxy_hosts_.erase(old_site_instance_id);
1119 RFHPendingDeleteMap::iterator pending_delete_iter =
1120 pending_delete_hosts_.find(old_site_instance_id);
1121 if (pending_delete_iter == pending_delete_hosts_.end() ||
1122 pending_delete_iter->second.get() != old_render_frame_host) {
1123 pending_delete_hosts_[old_site_instance_id] =
1124 linked_ptr<RenderFrameHostImpl>(old_render_frame_host.release());
1125 }
1126 } else {
1127 // If there are no active views in this SiteInstance, it means that 1118 // If there are no active views in this SiteInstance, it means that
1128 // this RFH was the last active one in the SiteInstance. Now that we 1119 // this RFH was the last active one in the SiteInstance. Now that we
1129 // know that all RFHs are swapped out, we can delete all the RFHs and RVHs 1120 // know that all RFHs are swapped out, we can delete all the RFHs and RVHs
1130 // in this SiteInstance. We do this after ensuring the RFH is on the 1121 // in this SiteInstance. We do this after ensuring the RFH is on the
1131 // swapped out list to simplify the deletion. 1122 // swapped out list to simplify the deletion.
1132 if (!static_cast<SiteInstanceImpl*>( 1123 if (!static_cast<SiteInstanceImpl*>(
1133 old_render_frame_host->GetSiteInstance())->active_view_count()) { 1124 old_render_frame_host->GetSiteInstance())->active_view_count()) {
1134 old_render_frame_host.reset();
1135 ShutdownRenderFrameHostsInSiteInstance(old_site_instance_id); 1125 ShutdownRenderFrameHostsInSiteInstance(old_site_instance_id);
1136 } else { 1126 // This is deleted while cleaning up the SiteInstance's views.
1137 proxy_hosts_[old_site_instance_id] = new RenderFrameProxyHost( 1127 old_render_frame_host = NULL;
1138 old_render_frame_host.Pass());
1139 } 1128 }
1129 } else {
1130 delete old_render_frame_host;
1140 } 1131 }
1141 } 1132 }
1142 1133
1143 void RenderFrameHostManager::ShutdownRenderFrameHostsInSiteInstance( 1134 void RenderFrameHostManager::ShutdownRenderFrameHostsInSiteInstance(
1144 int32 site_instance_id) { 1135 int32 site_instance_id) {
1145 // First remove any swapped out RFH for this SiteInstance from our own list. 1136 // First remove any swapped out RFH for this SiteInstance from our own list.
1146 ClearProxiesInSiteInstance(site_instance_id, frame_tree_node_); 1137 ClearSwappedOutRFHsInSiteInstance(site_instance_id, frame_tree_node_);
1147 1138
1148 // Use the safe RenderWidgetHost iterator for now to find all RenderViewHosts 1139 // Use the safe RenderWidgetHost iterator for now to find all RenderViewHosts
1149 // in the SiteInstance, then tell their respective FrameTrees to remove all 1140 // in the SiteInstance, then tell their respective FrameTrees to remove all
1150 // RenderFrameProxyHosts corresponding to them. 1141 // swapped out RenderFrameHosts corresponding to them.
1151 // TODO(creis): Replace this with a RenderFrameHostIterator that protects 1142 // TODO(creis): Replace this with a RenderFrameHostIterator that protects
1152 // against use-after-frees if a later element is deleted before getting to it. 1143 // against use-after-frees if a later element is deleted before getting to it.
1153 scoped_ptr<RenderWidgetHostIterator> widgets( 1144 scoped_ptr<RenderWidgetHostIterator> widgets(
1154 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); 1145 RenderWidgetHostImpl::GetAllRenderWidgetHosts());
1155 while (RenderWidgetHost* widget = widgets->GetNextHost()) { 1146 while (RenderWidgetHost* widget = widgets->GetNextHost()) {
1156 if (!widget->IsRenderView()) 1147 if (!widget->IsRenderView())
1157 continue; 1148 continue;
1158 RenderViewHostImpl* rvh = 1149 RenderViewHostImpl* rvh =
1159 static_cast<RenderViewHostImpl*>(RenderViewHost::From(widget)); 1150 static_cast<RenderViewHostImpl*>(RenderViewHost::From(widget));
1160 if (site_instance_id == rvh->GetSiteInstance()->GetId()) { 1151 if (site_instance_id == rvh->GetSiteInstance()->GetId()) {
1161 // This deletes all RenderFrameHosts using the |rvh|, which then causes 1152 // This deletes all RenderFrameHosts using the |rvh|, which then causes
1162 // |rvh| to Shutdown. 1153 // |rvh| to Shutdown.
1163 FrameTree* tree = rvh->GetDelegate()->GetFrameTree(); 1154 FrameTree* tree = rvh->GetDelegate()->GetFrameTree();
1164 tree->ForEach(base::Bind( 1155 tree->ForEach(base::Bind(
1165 &RenderFrameHostManager::ClearProxiesInSiteInstance, 1156 &RenderFrameHostManager::ClearSwappedOutRFHsInSiteInstance,
1166 site_instance_id)); 1157 site_instance_id));
1167 } 1158 }
1168 } 1159 }
1169 } 1160 }
1170 1161
1171 RenderFrameHostImpl* RenderFrameHostManager::UpdateRendererStateForNavigate( 1162 RenderFrameHostImpl* RenderFrameHostManager::UpdateRendererStateForNavigate(
1172 const NavigationEntryImpl& entry) { 1163 const NavigationEntryImpl& entry) {
1173 // If we are currently navigating cross-process, we want to get back to normal 1164 // If we are currently navigating cross-process, we want to get back to normal
1174 // and then navigate as usual. 1165 // and then navigate as usual.
1175 if (cross_navigation_pending_) { 1166 if (cross_navigation_pending_) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 RenderFrameHostImpl* pending_render_frame_host = 1324 RenderFrameHostImpl* pending_render_frame_host =
1334 pending_render_frame_host_.release(); 1325 pending_render_frame_host_.release();
1335 1326
1336 RenderViewDevToolsAgentHost::OnCancelPendingNavigation( 1327 RenderViewDevToolsAgentHost::OnCancelPendingNavigation(
1337 pending_render_frame_host->render_view_host(), 1328 pending_render_frame_host->render_view_host(),
1338 render_frame_host_->render_view_host()); 1329 render_frame_host_->render_view_host());
1339 1330
1340 // We no longer need to prevent the process from exiting. 1331 // We no longer need to prevent the process from exiting.
1341 pending_render_frame_host->GetProcess()->RemovePendingView(); 1332 pending_render_frame_host->GetProcess()->RemovePendingView();
1342 1333
1343 // If the SiteInstance for the pending RFH is being used by others, don't 1334 // The pending RFH may already be on the swapped out list if we started to
1344 // delete the RFH, just swap it out and it can be reused at a later point. 1335 // swap it back in and then canceled. If so, make sure it gets swapped out
1345 SiteInstanceImpl* site_instance = static_cast<SiteInstanceImpl*>( 1336 // again. If it's not on the swapped out list (e.g., aborting a pending
1346 pending_render_frame_host->GetSiteInstance()); 1337 // load), then it's safe to shut down.
1347 if (site_instance->active_view_count() > 1) { 1338 if (IsOnSwappedOutList(pending_render_frame_host)) {
1348 // Any currently suspended navigations are no longer needed. 1339 // Any currently suspended navigations are no longer needed.
1349 pending_render_frame_host->render_view_host()->CancelSuspendedNavigations(); 1340 pending_render_frame_host->render_view_host()->CancelSuspendedNavigations();
1350 1341
1351 pending_render_frame_host->SwapOut(); 1342 pending_render_frame_host->SwapOut();
1352 } else { 1343 } else {
1353 // We won't be coming back, so shut this one down. 1344 // We won't be coming back, so shut this one down.
1354 delete pending_render_frame_host; 1345 delete pending_render_frame_host;
1355 } 1346 }
1356 1347
1357 pending_web_ui_.reset(); 1348 pending_web_ui_.reset();
(...skipping 13 matching lines...) Expand all
1371 NOTREACHED(); 1362 NOTREACHED();
1372 pending_render_frame_host_.reset(); 1363 pending_render_frame_host_.reset();
1373 } 1364 }
1374 1365
1375 // Make sure deleted RVHs are not kept in the swapped out list while we are 1366 // Make sure deleted RVHs are not kept in the swapped out list while we are
1376 // still alive. (If render_frame_host_ is null, we're already being deleted.) 1367 // still alive. (If render_frame_host_ is null, we're already being deleted.)
1377 if (!render_frame_host_) 1368 if (!render_frame_host_)
1378 return; 1369 return;
1379 1370
1380 // We can't look it up by SiteInstance ID, which may no longer be valid. 1371 // We can't look it up by SiteInstance ID, which may no longer be valid.
1381 for (RenderFrameProxyHostMap::iterator iter = proxy_hosts_.begin(); 1372 for (RenderFrameHostMap::iterator iter = swapped_out_hosts_.begin();
1382 iter != proxy_hosts_.end(); 1373 iter != swapped_out_hosts_.end();
1383 ++iter) { 1374 ++iter) {
1384 if (iter->second->render_view_host() == rvh) { 1375 if (iter->second->render_view_host() == rvh) {
1385 proxy_hosts_.erase(iter); 1376 swapped_out_hosts_.erase(iter);
1386 break; 1377 break;
1387 } 1378 }
1388 } 1379 }
1389 } 1380 }
1390 1381
1391 bool RenderFrameHostManager::IsRVHOnSwappedOutList( 1382 bool RenderFrameHostManager::IsRVHOnSwappedOutList(
1392 RenderViewHostImpl* rvh) const { 1383 RenderViewHostImpl* rvh) const {
1393 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost( 1384 RenderFrameHostImpl* render_frame_host = GetSwappedOutRenderFrameHost(
1394 rvh->GetSiteInstance()); 1385 rvh->GetSiteInstance());
1395 if (!proxy) 1386 if (!render_frame_host)
1396 return false; 1387 return false;
1397 return IsOnSwappedOutList(proxy->render_frame_host()); 1388 return IsOnSwappedOutList(render_frame_host);
1398 } 1389 }
1399 1390
1400 bool RenderFrameHostManager::IsOnSwappedOutList( 1391 bool RenderFrameHostManager::IsOnSwappedOutList(
1401 RenderFrameHostImpl* rfh) const { 1392 RenderFrameHostImpl* rfh) const {
1402 if (!rfh->GetSiteInstance()) 1393 if (!rfh->GetSiteInstance())
1403 return false; 1394 return false;
1404 1395
1405 RenderFrameProxyHostMap::const_iterator iter = proxy_hosts_.find( 1396 RenderFrameHostMap::const_iterator iter = swapped_out_hosts_.find(
1406 rfh->GetSiteInstance()->GetId()); 1397 rfh->GetSiteInstance()->GetId());
1407 if (iter == proxy_hosts_.end()) 1398 if (iter == swapped_out_hosts_.end())
1408 return false; 1399 return false;
1409 1400
1410 return iter->second->render_frame_host() == rfh; 1401 return iter->second == rfh;
1411 } 1402 }
1412 1403
1413 RenderViewHostImpl* RenderFrameHostManager::GetSwappedOutRenderViewHost( 1404 RenderViewHostImpl* RenderFrameHostManager::GetSwappedOutRenderViewHost(
1414 SiteInstance* instance) const { 1405 SiteInstance* instance) const {
1415 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); 1406 RenderFrameHostImpl* render_frame_host =
1416 if (proxy) 1407 GetSwappedOutRenderFrameHost(instance);
1417 return proxy->render_view_host(); 1408 if (render_frame_host)
1409 return render_frame_host->render_view_host();
1418 return NULL; 1410 return NULL;
1419 } 1411 }
1420 1412
1421 RenderFrameProxyHost* RenderFrameHostManager::GetRenderFrameProxyHost( 1413 RenderFrameHostImpl* RenderFrameHostManager::GetSwappedOutRenderFrameHost(
1422 SiteInstance* instance) const { 1414 SiteInstance* instance) const {
1423 RenderFrameProxyHostMap::const_iterator iter = 1415 RenderFrameHostMap::const_iterator iter =
1424 proxy_hosts_.find(instance->GetId()); 1416 swapped_out_hosts_.find(instance->GetId());
1425 if (iter != proxy_hosts_.end()) 1417 if (iter != swapped_out_hosts_.end())
1426 return iter->second; 1418 return iter->second;
1427 1419
1428 return NULL; 1420 return NULL;
1429 } 1421 }
1430 1422
1431 } // namespace content 1423 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698