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. 4 5 // See net/disk_cache/disk_cache.h for the public interface. 6 7 #ifndef NET_DISK_CACHE_MEM_RANKINGS_H__ 8 #define NET_DISK_CACHE_MEM_RANKINGS_H__ 9 #pragma once 10 11 #include "base/basictypes.h" 12 13 namespace disk_cache { 14 15 class MemEntryImpl; 16 17 // This class handles the ranking information for the memory-only cache. 18 class MemRankings { 19 public: 20 MemRankings() : head_(NULL), tail_(NULL) {} 21 ~MemRankings(); 22 23 // Inserts a given entry at the head of the queue. 24 void Insert(MemEntryImpl* node); 25 26 // Removes a given entry from the LRU list. 27 void Remove(MemEntryImpl* node); 28 29 // Moves a given entry to the head. 30 void UpdateRank(MemEntryImpl* node); 31 32 // Iterates through the list. 33 MemEntryImpl* GetNext(MemEntryImpl* node); 34 MemEntryImpl* GetPrev(MemEntryImpl* node); 35 36 private: 37 MemEntryImpl* head_; 38 MemEntryImpl* tail_; 39 40 DISALLOW_COPY_AND_ASSIGN(MemRankings); 41 }; 42 43 } // namespace disk_cache 44 45 #endif // NET_DISK_CACHE_MEM_RANKINGS_H__ 46