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

Side by Side Diff: content/browser/web_contents/render_view_host_manager.cc

Issue 25503004: Create a new RenderFrameHost per child frame when --site-per-process is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on ToT. Created 7 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_contents/render_view_host_manager.h" 5 #include "content/browser/web_contents/render_view_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"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 int routing_id, 86 int routing_id,
87 int main_frame_routing_id) { 87 int main_frame_routing_id) {
88 // Create a RenderViewHost, once we have an instance. It is important to 88 // Create a RenderViewHost, once we have an instance. It is important to
89 // immediately give this SiteInstance to a RenderViewHost so that it is 89 // immediately give this SiteInstance to a RenderViewHost so that it is
90 // ref counted. 90 // ref counted.
91 if (!site_instance) 91 if (!site_instance)
92 site_instance = SiteInstance::Create(browser_context); 92 site_instance = SiteInstance::Create(browser_context);
93 render_view_host_ = static_cast<RenderViewHostImpl*>( 93 render_view_host_ = static_cast<RenderViewHostImpl*>(
94 RenderViewHostFactory::Create( 94 RenderViewHostFactory::Create(
95 site_instance, render_view_delegate_, render_widget_delegate_, 95 site_instance, render_view_delegate_, render_widget_delegate_,
96 routing_id, main_frame_routing_id, false, delegate_->IsHidden())); 96 routing_id, main_frame_routing_id, false,
97 delegate_->IsHidden()));
98 render_view_host_->AttachToFrameTree();
97 99
98 // Keep track of renderer processes as they start to shut down or are 100 // Keep track of renderer processes as they start to shut down or are
99 // crashed/killed. 101 // crashed/killed.
100 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED, 102 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED,
101 NotificationService::AllSources()); 103 NotificationService::AllSources());
102 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSING, 104 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSING,
103 NotificationService::AllSources()); 105 NotificationService::AllSources());
104 } 106 }
105 107
106 RenderViewHostImpl* RenderViewHostManager::current_host() const { 108 RenderViewHostImpl* RenderViewHostManager::current_host() const {
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 if (will_focus_location_bar) 771 if (will_focus_location_bar)
770 delegate_->SetFocusToLocationBar(false); 772 delegate_->SetFocusToLocationBar(false);
771 return; 773 return;
772 } 774 }
773 775
774 // Remember if the page was focused so we can focus the new renderer in 776 // Remember if the page was focused so we can focus the new renderer in
775 // that case. 777 // that case.
776 bool focus_render_view = !will_focus_location_bar && 778 bool focus_render_view = !will_focus_location_bar &&
777 render_view_host_->GetView() && render_view_host_->GetView()->HasFocus(); 779 render_view_host_->GetView() && render_view_host_->GetView()->HasFocus();
778 780
779 // Swap in the pending view and make it active. 781 // Swap in the pending view and make it active. Also ensure the FrameTree
782 // stays in sync.
780 RenderViewHostImpl* old_render_view_host = render_view_host_; 783 RenderViewHostImpl* old_render_view_host = render_view_host_;
781 render_view_host_ = pending_render_view_host_; 784 render_view_host_ = pending_render_view_host_;
782 pending_render_view_host_ = NULL; 785 pending_render_view_host_ = NULL;
786 render_view_host_->AttachToFrameTree();
783 787
784 // The process will no longer try to exit, so we can decrement the count. 788 // The process will no longer try to exit, so we can decrement the count.
785 render_view_host_->GetProcess()->RemovePendingView(); 789 render_view_host_->GetProcess()->RemovePendingView();
786 790
787 // If the view is gone, then this RenderViewHost died while it was hidden. 791 // If the view is gone, then this RenderViewHost died while it was hidden.
788 // We ignored the RenderProcessGone call at the time, so we should send it now 792 // We ignored the RenderProcessGone call at the time, so we should send it now
789 // to make sure the sad tab shows up, etc. 793 // to make sure the sad tab shows up, etc.
790 if (!render_view_host_->GetView()) 794 if (!render_view_host_->GetView())
791 delegate_->RenderProcessGoneFromRenderManager(render_view_host_); 795 delegate_->RenderProcessGoneFromRenderManager(render_view_host_);
792 else if (!delegate_->IsHidden()) 796 else if (!delegate_->IsHidden())
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( 1085 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost(
1082 SiteInstance* instance) { 1086 SiteInstance* instance) {
1083 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); 1087 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId());
1084 if (iter != swapped_out_hosts_.end()) 1088 if (iter != swapped_out_hosts_.end())
1085 return iter->second; 1089 return iter->second;
1086 1090
1087 return NULL; 1091 return NULL;
1088 } 1092 }
1089 1093
1090 } // namespace content 1094 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/interstitial_page_impl.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698