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

Unified Diff: content/browser/web_contents/render_view_host_manager.cc

Issue 14267002: Change IsSwappedOut to const and do a more restrictive check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renaming IsSwappedOut to better reflect what it does. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/render_view_host_manager.cc
diff --git a/content/browser/web_contents/render_view_host_manager.cc b/content/browser/web_contents/render_view_host_manager.cc
index 3f14460dfde1edcf93baaf9be8ed98558ae8f65a..1ec7b2e8ce3931a4dbd18488c1f9215c34a6e094 100644
--- a/content/browser/web_contents/render_view_host_manager.cc
+++ b/content/browser/web_contents/render_view_host_manager.cc
@@ -931,7 +931,7 @@ void RenderViewHostManager::CancelPending() {
// swap it back in and then canceled. If so, make sure it gets swapped out
// again. If it's not on the swapped out list (e.g., aborting a pending
// load), then it's safe to shut down.
- if (IsSwappedOut(pending_render_view_host)) {
+ if (IsOnSwappedOutList(pending_render_view_host)) {
// Any currently suspended navigations are no longer needed.
pending_render_view_host->CancelSuspendedNavigations();
@@ -975,12 +975,16 @@ void RenderViewHostManager::RenderViewDeleted(RenderViewHost* rvh) {
}
}
-bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) {
+bool RenderViewHostManager::IsOnSwappedOutList(RenderViewHost* rvh) const {
if (!rvh->GetSiteInstance())
return false;
- return swapped_out_hosts_.find(rvh->GetSiteInstance()->GetId()) !=
- swapped_out_hosts_.end();
+ RenderViewHostMap::const_iterator iter = swapped_out_hosts_.find(
+ rvh->GetSiteInstance()->GetId());
+ if (iter == swapped_out_hosts_.end())
+ return false;
+
+ return iter->second == rvh;
}
RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost(

Powered by Google App Engine
This is Rietveld 408576698