summaryrefslogtreecommitdiffstats
path: root/base/memory/mru_cache.h
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-21 18:36:52 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-21 18:36:52 +0000
commit9ddc30b65bae399276008ac7847fbaebc7459b18 (patch)
tree666ecdb1cd677d117c740fccb5215daa602ad214 /base/memory/mru_cache.h
parent6ad09701cc8b3f044579181247da0ff7b9c183f2 (diff)
downloadchromium_src-9ddc30b65bae399276008ac7847fbaebc7459b18.zip
chromium_src-9ddc30b65bae399276008ac7847fbaebc7459b18.tar.gz
chromium_src-9ddc30b65bae399276008ac7847fbaebc7459b18.tar.bz2
Revert 115350 - causes MRUCacheTest.KeyReplacement to crash
Coverity fixlet: fix PASS_BY_VALUE R=jar@chromium.org CID=102145 BUG= TEST= Review URL: http://codereview.chromium.org/9006030 TBR=scr@chromium.org Review URL: http://codereview.chromium.org/8949045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115365 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/memory/mru_cache.h')
-rw-r--r--base/memory/mru_cache.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/base/memory/mru_cache.h b/base/memory/mru_cache.h
index a99f189..29db3cf 100644
--- a/base/memory/mru_cache.h
+++ b/base/memory/mru_cache.h
@@ -135,7 +135,7 @@ class MRUCacheBase {
// 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(const iterator& pos) {
+ iterator Erase(iterator pos) {
deletor_(pos->second);
index_.erase(pos->first);
return ordering_.erase(pos);
@@ -143,12 +143,11 @@ class MRUCacheBase {
// MRUCache entries are often processed in reverse order, so we add this
// convenience function (not typically defined by STL containers).
- reverse_iterator Erase(const reverse_iterator& pos) {
+ reverse_iterator Erase(reverse_iterator pos) {
// We have to actually give it the incremented iterator to delete, since
// the forward iterator that base() returns is actually one past the item
// being iterated over.
- reverse_iterator next = pos;
- return reverse_iterator(Erase((++next).base()));
+ return reverse_iterator(Erase((++pos).base()));
}
// Shrinks the cache so it only holds |new_size| items. If |new_size| is