Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / net / disk_cache / memory / mem_rankings.h
blobb75bfc14fb97f144a980f003c639fc7d402becc0
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // See net/disk_cache/disk_cache.h for the public interface.
7 #ifndef NET_DISK_CACHE_MEMORY_MEM_RANKINGS_H_
8 #define NET_DISK_CACHE_MEMORY_MEM_RANKINGS_H_
10 #include "base/basictypes.h"
12 namespace disk_cache {
14 class MemEntryImpl;
16 // This class handles the ranking information for the memory-only cache.
17 class MemRankings {
18 public:
19 MemRankings() : head_(NULL), tail_(NULL) {}
20 ~MemRankings();
22 // Inserts a given entry at the head of the queue.
23 void Insert(MemEntryImpl* node);
25 // Removes a given entry from the LRU list.
26 void Remove(MemEntryImpl* node);
28 // Moves a given entry to the head.
29 void UpdateRank(MemEntryImpl* node);
31 // Iterates through the list.
32 MemEntryImpl* GetNext(MemEntryImpl* node);
33 MemEntryImpl* GetPrev(MemEntryImpl* node);
35 private:
36 MemEntryImpl* head_;
37 MemEntryImpl* tail_;
39 DISALLOW_COPY_AND_ASSIGN(MemRankings);
42 } // namespace disk_cache
44 #endif // NET_DISK_CACHE_MEMORY_MEM_RANKINGS_H_