Chromium Code Reviews| Index: base/containers/mru_cache.h |
| diff --git a/base/containers/mru_cache.h b/base/containers/mru_cache.h |
| index 15ea2fccdc4104dfbae4961cc24674c475230771..30974514244d2ed29bbfa47e9f398107d1b7dfb4 100644 |
| --- a/base/containers/mru_cache.h |
| +++ b/base/containers/mru_cache.h |
| @@ -140,7 +140,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(iterator pos) { |
| - deletor_(pos->second); |
| + deletor_(&pos->second); |
| index_.erase(pos->first); |
| return ordering_.erase(pos); |
| } |
| @@ -165,7 +165,7 @@ class MRUCacheBase { |
| void Clear() { |
| for (typename PayloadList::iterator i(ordering_.begin()); |
| i != ordering_.end(); ++i) |
| - deletor_(i->second); |
| + deletor_(&i->second); |
| index_.clear(); |
| ordering_.clear(); |
| } |
| @@ -213,8 +213,7 @@ class MRUCacheBase { |
| template<class PayloadType> |
| class MRUCacheNullDeletor { |
| public: |
| - void operator()(PayloadType& payload) { |
| - } |
| + void operator()(PayloadType* payload) {} |
| }; |
| // A container that does not do anything to free its data. Use this when storing |
| @@ -244,9 +243,7 @@ class MRUCache : public MRUCacheBase<KeyType, |
| template<class PayloadType> |
| class MRUCachePointerDeletor { |
| public: |
| - void operator()(PayloadType& payload) { |
| - delete payload; |
| - } |
| + void operator()(PayloadType* payload) { delete *payload; } |
|
Nico
2015/03/07 01:06:14
can't you just make this const PalyloadType& ? I t
|
| }; |
| // A cache that owns the payload type, which must be a non-const pointer type. |