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

Unified Diff: base/memory/discardable_memory_manager.cc

Issue 652663005: base: Use range-based for loops in DiscardableMemoryManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_memory_manager.cc
diff --git a/base/memory/discardable_memory_manager.cc b/base/memory/discardable_memory_manager.cc
index 3647b7b2f91a682d2805c2752a981ad771f99e40..5f5e604cf47a935f40b2f57fbf9f50f239e76225 100644
--- a/base/memory/discardable_memory_manager.cc
+++ b/base/memory/discardable_memory_manager.cc
@@ -5,6 +5,7 @@
#include "base/memory/discardable_memory_manager.h"
#include "base/bind.h"
+#include "base/containers/adapters.h"
#include "base/containers/hash_tables.h"
#include "base/containers/mru_cache.h"
#include "base/debug/crash_logging.h"
@@ -177,11 +178,9 @@ void DiscardableMemoryManager::
lock_.AssertAcquired();
size_t bytes_allocated_before_purging = bytes_allocated_;
- for (AllocationMap::reverse_iterator it = allocations_.rbegin();
- it != allocations_.rend();
- ++it) {
- Allocation* allocation = it->first;
- AllocationInfo* info = &it->second;
+ for (auto& entry : base::Reversed(allocations_)) {
+ Allocation* allocation = entry.first;
+ AllocationInfo* info = &entry.second;
if (bytes_allocated_ <= limit)
break;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698