summaryrefslogtreecommitdiffstats
path: root/chrome/common/mru_cache.h
diff options
context:
space:
mode:
authordeanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-02 15:11:22 +0000
committerdeanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-02 15:11:22 +0000
commita4feef8f23c9aed533bcd8b35e594fe3cf300a23 (patch)
tree9ce681a0ae7b0a30d00b54cb8bccc3a3ad7562c6 /chrome/common/mru_cache.h
parent5f945e0f45394453602083b22206acb4cde3db4f (diff)
downloadchromium_src-a4feef8f23c9aed533bcd8b35e594fe3cf300a23.zip
chromium_src-a4feef8f23c9aed533bcd8b35e594fe3cf300a23.tar.gz
chromium_src-a4feef8f23c9aed533bcd8b35e594fe3cf300a23.tar.bz2
Port some more of chrome/ to Linux.
Original review: http://codereview.chromium.org/4247 Patch from Pawel Hajdan Jr. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2793 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/mru_cache.h')
-rw-r--r--chrome/common/mru_cache.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/chrome/common/mru_cache.h b/chrome/common/mru_cache.h
index 615f614..d3478b1 100644
--- a/chrome/common/mru_cache.h
+++ b/chrome/common/mru_cache.h
@@ -70,7 +70,7 @@ class MRUCacheBase {
// will take ownership of the pointer.
iterator Put(const KeyType& key, const PayloadType& payload) {
// Remove any existing payload with that key.
- KeyIndex::iterator index_iter = index_.find(key);
+ typename KeyIndex::iterator index_iter = index_.find(key);
if (index_iter != index_.end()) {
// Erase the reference to it. This will call the deletor on the removed
// element. The index reference will be replaced in the code below.
@@ -92,10 +92,10 @@ class MRUCacheBase {
//
// TODO(brettw) We may want a const version of this function in the future.
iterator Get(const KeyType& key) {
- KeyIndex::iterator index_iter = index_.find(key);
+ typename KeyIndex::iterator index_iter = index_.find(key);
if (index_iter == index_.end())
return end();
- PayloadList::iterator iter = index_iter->second;
+ typename PayloadList::iterator iter = index_iter->second;
// Move the touched item to the front of the recency ordering.
ordering_.splice(ordering_.begin(), ordering_, iter);
@@ -107,7 +107,7 @@ class MRUCacheBase {
//
// TODO(brettw) We may want a const version of this function in the future.
iterator Peek(const KeyType& key) {
- KeyIndex::const_iterator index_iter = index_.find(key);
+ typename KeyIndex::const_iterator index_iter = index_.find(key);
if (index_iter == index_.end())
return end();
return index_iter->second;
@@ -190,15 +190,20 @@ template <class KeyType, class PayloadType>
class MRUCache : public MRUCacheBase<KeyType,
PayloadType,
MRUCacheNullDeletor<PayloadType> > {
+ private:
+ typedef MRUCacheBase<KeyType, PayloadType,
+ MRUCacheNullDeletor<PayloadType> > ParentType;
+
public:
// See MRUCacheBase, noting the possibility of using NO_AUTO_EVICT.
- MRUCache(size_type max_size) : MRUCacheBase(max_size) {
+ MRUCache(typename ParentType::size_type max_size)
+ : ParentType(max_size) {
}
virtual ~MRUCache() {
}
private:
- DISALLOW_EVIL_CONSTRUCTORS(MRUCache);
+ DISALLOW_COPY_AND_ASSIGN(MRUCache);
};
// OwningMRUCache --------------------------------------------------------------
@@ -219,15 +224,20 @@ class OwningMRUCache
: public MRUCacheBase<KeyType,
PayloadType,
MRUCachePointerDeletor<PayloadType> > {
+ private:
+ typedef MRUCacheBase<KeyType, PayloadType,
+ MRUCachePointerDeletor<PayloadType> > ParentType;
+
public:
// See MRUCacheBase, noting the possibility of using NO_AUTO_EVICT.
- OwningMRUCache(size_type max_size) : MRUCacheBase(max_size) {
+ OwningMRUCache(typename ParentType::size_type max_size)
+ : ParentType(max_size) {
}
virtual ~OwningMRUCache() {
}
private:
- DISALLOW_EVIL_CONSTRUCTORS(OwningMRUCache);
+ DISALLOW_COPY_AND_ASSIGN(OwningMRUCache);
};
#endif // CHROME_COMMON_MRU_CACHE_H__