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

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: Move global map insert/erase behind the flag. 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 int routing_id, 77 int routing_id,
78 int main_frame_routing_id) { 78 int main_frame_routing_id) {
79 // Create a RenderViewHost, once we have an instance. It is important to 79 // Create a RenderViewHost, once we have an instance. It is important to
80 // immediately give this SiteInstance to a RenderViewHost so that it is 80 // immediately give this SiteInstance to a RenderViewHost so that it is
81 // ref counted. 81 // ref counted.
82 if (!site_instance) 82 if (!site_instance)
83 site_instance = SiteInstance::Create(browser_context); 83 site_instance = SiteInstance::Create(browser_context);
84 render_view_host_ = static_cast<RenderViewHostImpl*>( 84 render_view_host_ = static_cast<RenderViewHostImpl*>(
85 RenderViewHostFactory::Create( 85 RenderViewHostFactory::Create(
86 site_instance, render_view_delegate_, render_widget_delegate_, 86 site_instance, render_view_delegate_, render_widget_delegate_,
87 routing_id, main_frame_routing_id, false, delegate_->IsHidden())); 87 routing_id, main_frame_routing_id, false,
88 delegate_->IsHidden()));
89 render_view_host_->AttachToFrameTree();
88 90
89 // Keep track of renderer processes as they start to shut down or are 91 // Keep track of renderer processes as they start to shut down or are
90 // crashed/killed. 92 // crashed/killed.
91 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED, 93 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSED,
92 NotificationService::AllSources()); 94 NotificationService::AllSources());
93 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSING, 95 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CLOSING,
94 NotificationService::AllSources()); 96 NotificationService::AllSources());
95 } 97 }
96 98
97 RenderViewHostImpl* RenderViewHostManager::current_host() const { 99 RenderViewHostImpl* RenderViewHostManager::current_host() const {
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 if (will_focus_location_bar) 743 if (will_focus_location_bar)
742 delegate_->SetFocusToLocationBar(false); 744 delegate_->SetFocusToLocationBar(false);
743 return; 745 return;
744 } 746 }
745 747
746 // Remember if the page was focused so we can focus the new renderer in 748 // Remember if the page was focused so we can focus the new renderer in
747 // that case. 749 // that case.
748 bool focus_render_view = !will_focus_location_bar && 750 bool focus_render_view = !will_focus_location_bar &&
749 render_view_host_->GetView() && render_view_host_->GetView()->HasFocus(); 751 render_view_host_->GetView() && render_view_host_->GetView()->HasFocus();
750 752
751 // Swap in the pending view and make it active. 753 // Swap in the pending view and make it active. Also ensure the FrameTree
754 // stays in sync.
752 RenderViewHostImpl* old_render_view_host = render_view_host_; 755 RenderViewHostImpl* old_render_view_host = render_view_host_;
753 render_view_host_ = pending_render_view_host_; 756 render_view_host_ = pending_render_view_host_;
754 pending_render_view_host_ = NULL; 757 pending_render_view_host_ = NULL;
758 render_view_host_->AttachToFrameTree();
755 759
756 // The process will no longer try to exit, so we can decrement the count. 760 // The process will no longer try to exit, so we can decrement the count.
757 render_view_host_->GetProcess()->RemovePendingView(); 761 render_view_host_->GetProcess()->RemovePendingView();
758 762
759 // If the view is gone, then this RenderViewHost died while it was hidden. 763 // If the view is gone, then this RenderViewHost died while it was hidden.
760 // We ignored the RenderProcessGone call at the time, so we should send it now 764 // We ignored the RenderProcessGone call at the time, so we should send it now
761 // to make sure the sad tab shows up, etc. 765 // to make sure the sad tab shows up, etc.
762 if (!render_view_host_->GetView()) 766 if (!render_view_host_->GetView())
763 delegate_->RenderProcessGoneFromRenderManager(render_view_host_); 767 delegate_->RenderProcessGoneFromRenderManager(render_view_host_);
764 else if (!delegate_->IsHidden()) 768 else if (!delegate_->IsHidden())
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( 1060 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost(
1057 SiteInstance* instance) { 1061 SiteInstance* instance) {
1058 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); 1062 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId());
1059 if (iter != swapped_out_hosts_.end()) 1063 if (iter != swapped_out_hosts_.end())
1060 return iter->second; 1064 return iter->second;
1061 1065
1062 return NULL; 1066 return NULL;
1063 } 1067 }
1064 1068
1065 } // namespace content 1069 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698