Commit 340d4610 authored by reveman's avatar reveman Committed by Commit bot

base: Use range-based for loops in DiscardableMemoryManager.

BUG=422953
TBR=danakj@chromium.org

Review URL: https://codereview.chromium.org/652663005

Cr-Commit-Position: refs/heads/master@{#299343}
parent f165e0a8
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "base/memory/discardable_memory_manager.h" #include "base/memory/discardable_memory_manager.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/containers/adapters.h"
#include "base/containers/hash_tables.h" #include "base/containers/hash_tables.h"
#include "base/containers/mru_cache.h" #include "base/containers/mru_cache.h"
#include "base/debug/crash_logging.h" #include "base/debug/crash_logging.h"
...@@ -177,11 +178,9 @@ void DiscardableMemoryManager:: ...@@ -177,11 +178,9 @@ void DiscardableMemoryManager::
lock_.AssertAcquired(); lock_.AssertAcquired();
size_t bytes_allocated_before_purging = bytes_allocated_; size_t bytes_allocated_before_purging = bytes_allocated_;
for (AllocationMap::reverse_iterator it = allocations_.rbegin(); for (auto& entry : base::Reversed(allocations_)) {
it != allocations_.rend(); Allocation* allocation = entry.first;
++it) { AllocationInfo* info = &entry.second;
Allocation* allocation = it->first;
AllocationInfo* info = &it->second;
if (bytes_allocated_ <= limit) if (bytes_allocated_ <= limit)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment