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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/web_contents/render_view_host_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/logging.h" 10 #include "base/logging.h"
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 for (RenderViewHostMap::iterator iter = swapped_out_hosts_.begin(); 968 for (RenderViewHostMap::iterator iter = swapped_out_hosts_.begin();
969 iter != swapped_out_hosts_.end(); 969 iter != swapped_out_hosts_.end();
970 ++iter) { 970 ++iter) {
971 if (iter->second == rvh) { 971 if (iter->second == rvh) {
972 swapped_out_hosts_.erase(iter); 972 swapped_out_hosts_.erase(iter);
973 break; 973 break;
974 } 974 }
975 } 975 }
976 } 976 }
977 977
978 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { 978 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) const {
979 if (!rvh->GetSiteInstance()) 979 if (!rvh->GetSiteInstance())
980 return false; 980 return false;
981 981
982 return swapped_out_hosts_.find(rvh->GetSiteInstance()->GetId()) != 982 RenderViewHostMap::const_iterator iter = swapped_out_hosts_.find(
Charlie Reis 2013/04/15 21:14:02 Good catch. Can you add a comment here? Somethin
nasko 2013/04/15 21:52:46 Rename sounds like the better option. I like your
983 swapped_out_hosts_.end(); 983 rvh->GetSiteInstance()->GetId());
984 if (iter == swapped_out_hosts_.end())
985 return false;
986
987 return iter->second == rvh;
984 } 988 }
985 989
986 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( 990 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost(
987 SiteInstance* instance) { 991 SiteInstance* instance) {
988 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); 992 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId());
989 if (iter != swapped_out_hosts_.end()) 993 if (iter != swapped_out_hosts_.end())
990 return iter->second; 994 return iter->second;
991 995
992 return NULL; 996 return NULL;
993 } 997 }
994 998
995 } // namespace content 999 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/render_view_host_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698