| Index: net/base/expiring_cache.h
|
| diff --git a/net/base/expiring_cache.h b/net/base/expiring_cache.h
|
| index 3fbde6594ff24c42557875552718a9425236c498..9f029aff9416000b34b1032f6f29bb5a428a7319 100644
|
| --- a/net/base/expiring_cache.h
|
| +++ b/net/base/expiring_cache.h
|
| @@ -14,17 +14,14 @@
|
|
|
| namespace net {
|
|
|
| -template <typename KeyType,
|
| - typename ValueType,
|
| - typename ExpirationType>
|
| +template <typename KeyType, typename ValueType, typename ExpirationType>
|
| class NoopEvictionHandler {
|
| public:
|
| void Handle(const KeyType& key,
|
| const ValueType& value,
|
| const ExpirationType& expiration,
|
| const ExpirationType& now,
|
| - bool onGet) const {
|
| - }
|
| + bool onGet) const {}
|
| };
|
|
|
| // Cache implementation where all entries have an explicit expiration policy. As
|
| @@ -68,9 +65,8 @@ template <typename KeyType,
|
| typename ValueType,
|
| typename ExpirationType,
|
| typename ExpirationCompare,
|
| - typename EvictionHandler = NoopEvictionHandler<KeyType,
|
| - ValueType,
|
| - ExpirationType> >
|
| + typename EvictionHandler =
|
| + NoopEvictionHandler<KeyType, ValueType, ExpirationType> >
|
| class ExpiringCache {
|
| private:
|
| // Intentionally violate the C++ Style Guide so that EntryMap is known to be
|
| @@ -91,9 +87,7 @@ class ExpiringCache {
|
| class Iterator {
|
| public:
|
| explicit Iterator(const ExpiringCache& cache)
|
| - : cache_(cache),
|
| - it_(cache_.entries_.begin()) {
|
| - }
|
| + : cache_(cache), it_(cache_.entries_.begin()) {}
|
| ~Iterator() {}
|
|
|
| bool HasNext() const { return it_ != cache_.entries_.end(); }
|
| @@ -112,7 +106,6 @@ class ExpiringCache {
|
| typename EntryMap::const_iterator it_;
|
| };
|
|
|
| -
|
| // Constructs an ExpiringCache that stores up to |max_entries|.
|
| explicit ExpiringCache(size_t max_entries) : max_entries_(max_entries) {}
|
| ~ExpiringCache() {}
|
| @@ -144,7 +137,7 @@ class ExpiringCache {
|
| typename EntryMap::iterator it = entries_.find(key);
|
| if (it == entries_.end()) {
|
| // Compact the cache if it grew beyond the limit.
|
| - if (entries_.size() == max_entries_ )
|
| + if (entries_.size() == max_entries_)
|
| Compact(now);
|
|
|
| // No existing entry. Creating a new one.
|
| @@ -157,9 +150,7 @@ class ExpiringCache {
|
| }
|
|
|
| // Empties the cache.
|
| - void Clear() {
|
| - entries_.clear();
|
| - }
|
| + void Clear() { entries_.clear(); }
|
|
|
| // Returns the number of entries in the cache.
|
| size_t size() const { return entries_.size(); }
|
| @@ -177,7 +168,7 @@ class ExpiringCache {
|
| void Compact(const ExpirationType& now) {
|
| // Clear out expired entries.
|
| typename EntryMap::iterator it;
|
| - for (it = entries_.begin(); it != entries_.end(); ) {
|
| + for (it = entries_.begin(); it != entries_.end();) {
|
| if (!expiration_comp_(now, it->second.second)) {
|
| Evict(it++, now, false);
|
| } else {
|
|
|