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

Unified Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 166533002: [wip] Introduce SiteInstanceKeepAlive. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index cbcbedc796cbb0c12ad14f5812b10543cae701bd..5b135d51ab115d2a0098306b766ad1086bb85ace 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -124,6 +124,31 @@ void RenderFrameHostManager::Init(BrowserContext* browser_context,
NotificationService::AllSources());
}
+void RenderFrameHostManager::ShutdownRenderFrameHostsInSiteInstance(
+ int32 site_instance_id) {
+ // Use the safe RenderWidgetHost iterator for now to find all RenderViewHosts
+ // in the SiteInstance, then tell their respective FrameTrees to remove all
+ // swapped out RenderFrameHosts corresponding to them.
+ // TODO(creis): Replace this with a RenderFrameHostIterator that protects
+ // against use-after-frees if a later element is deleted before getting to it.
+ scoped_ptr<RenderWidgetHostIterator> widgets(
+ RenderWidgetHostImpl::GetAllRenderWidgetHosts());
+ while (RenderWidgetHost* widget = widgets->GetNextHost()) {
+ if (!widget->IsRenderView())
+ continue;
+ RenderViewHostImpl* rvh =
+ static_cast<RenderViewHostImpl*>(RenderViewHost::From(widget));
+ if (site_instance_id == rvh->GetSiteInstance()->GetId()) {
+ // This deletes all RenderFrameHosts using the |rvh|, which then causes
+ // |rvh| to Shutdown.
+ FrameTree* tree = rvh->GetDelegate()->GetFrameTree();
+ tree->ForEach(base::Bind(
+ &RenderFrameHostManager::ClearSwappedOutRFHsInSiteInstance,
+ site_instance_id));
+ }
+ }
+}
+
RenderViewHostImpl* RenderFrameHostManager::current_host() const {
if (!render_frame_host_)
return NULL;
@@ -1156,34 +1181,6 @@ void RenderFrameHostManager::CommitPending() {
}
}
-void RenderFrameHostManager::ShutdownRenderFrameHostsInSiteInstance(
- int32 site_instance_id) {
- // First remove any swapped out RFH for this SiteInstance from our own list.
- ClearSwappedOutRFHsInSiteInstance(site_instance_id, frame_tree_node_);
sadrul 2014/02/14 13:20:51 I removed this line when making this a static func
-
- // Use the safe RenderWidgetHost iterator for now to find all RenderViewHosts
- // in the SiteInstance, then tell their respective FrameTrees to remove all
- // swapped out RenderFrameHosts corresponding to them.
- // TODO(creis): Replace this with a RenderFrameHostIterator that protects
- // against use-after-frees if a later element is deleted before getting to it.
- scoped_ptr<RenderWidgetHostIterator> widgets(
- RenderWidgetHostImpl::GetAllRenderWidgetHosts());
- while (RenderWidgetHost* widget = widgets->GetNextHost()) {
- if (!widget->IsRenderView())
- continue;
- RenderViewHostImpl* rvh =
- static_cast<RenderViewHostImpl*>(RenderViewHost::From(widget));
- if (site_instance_id == rvh->GetSiteInstance()->GetId()) {
- // This deletes all RenderFrameHosts using the |rvh|, which then causes
- // |rvh| to Shutdown.
- FrameTree* tree = rvh->GetDelegate()->GetFrameTree();
- tree->ForEach(base::Bind(
- &RenderFrameHostManager::ClearSwappedOutRFHsInSiteInstance,
- site_instance_id));
- }
- }
-}
-
RenderFrameHostImpl* RenderFrameHostManager::UpdateRendererStateForNavigate(
const NavigationEntryImpl& entry) {
// If we are currently navigating cross-process, we want to get back to normal

Powered by Google App Engine
This is Rietveld 408576698