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

Unified Diff: base/containers/mru_cache.h

Issue 17106004: Add discardable memory emulation for non-android/mac platforms (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix MemoryAfterUnlock test Created 7 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
Index: base/containers/mru_cache.h
diff --git a/base/containers/mru_cache.h b/base/containers/mru_cache.h
index e59e909839165e9fd9cd1b1f106e35736ecd01a5..15ea2fccdc4104dfbae4961cc24674c475230771 100644
--- a/base/containers/mru_cache.h
+++ b/base/containers/mru_cache.h
@@ -123,8 +123,6 @@ class MRUCacheBase {
// Retrieves the payload associated with a given key and returns it via
// result without affecting the ordering (unlike Get).
- //
- // TODO(brettw) We may want a const version of this function in the future.
iterator Peek(const KeyType& key) {
typename KeyIndex::const_iterator index_iter = index_.find(key);
if (index_iter == index_.end())
@@ -132,6 +130,13 @@ class MRUCacheBase {
return index_iter->second;
}
+ const_iterator Peek(const KeyType& key) const {
+ typename KeyIndex::const_iterator index_iter = index_.find(key);
+ if (index_iter == index_.end())
+ return end();
+ return index_iter->second;
+ }
+
// Erases the item referenced by the given iterator. An iterator to the item
// following it will be returned. The iterator must be valid.
iterator Erase(iterator pos) {

Powered by Google App Engine
This is Rietveld 408576698