diff options
author | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-30 16:33:30 +0000 |
---|---|---|
committer | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-30 16:33:30 +0000 |
commit | cef6c76ff40bf74edbcf8df0a19dc0c08fb7daca (patch) | |
tree | 56d1e3257dc3bea4d04dbaa36b84b4fd655c7c50 /base/containers | |
parent | 1bc20daed0a965dadbe4a140ee53057a1dac280a (diff) | |
download | chromium_src-cef6c76ff40bf74edbcf8df0a19dc0c08fb7daca.zip chromium_src-cef6c76ff40bf74edbcf8df0a19dc0c08fb7daca.tar.gz chromium_src-cef6c76ff40bf74edbcf8df0a19dc0c08fb7daca.tar.bz2 |
Add discardable memory emulation for non-android/mac platforms
Adds support for emulated discardable memory. The memory is managed by a
provider which listens for memory pressure notifications from the platform.
Currently, only android pushes these notifications, but in future patches, we
will apply pressure on other platforms in certain situations (e.g., when a tab
gets backgrounded).
BUG=237681
Review URL: https://codereview.chromium.org/17106004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231845 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/containers')
-rw-r--r-- | base/containers/mru_cache.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/base/containers/mru_cache.h b/base/containers/mru_cache.h index e59e909..15ea2fc 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) { |