Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 |
| OLD | NEW |