blob: 166224f883e0e0e05e65de04341ff7a35cd18e39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// See net/disk_cache/disk_cache.h for the public interface.
#ifndef NET_DISK_CACHE_MEM_RANKINGS_H__
#define NET_DISK_CACHE_MEM_RANKINGS_H__
#pragma once
#include "base/basictypes.h"
namespace disk_cache {
class MemEntryImpl;
// This class handles the ranking information for the memory-only cache.
class MemRankings {
public:
MemRankings() : head_(NULL), tail_(NULL) {}
~MemRankings();
// Inserts a given entry at the head of the queue.
void Insert(MemEntryImpl* node);
// Removes a given entry from the LRU list.
void Remove(MemEntryImpl* node);
// Moves a given entry to the head.
void UpdateRank(MemEntryImpl* node);
// Iterates through the list.
MemEntryImpl* GetNext(MemEntryImpl* node);
MemEntryImpl* GetPrev(MemEntryImpl* node);
private:
MemEntryImpl* head_;
MemEntryImpl* tail_;
DISALLOW_COPY_AND_ASSIGN(MemRankings);
};
} // namespace disk_cache
#endif // NET_DISK_CACHE_MEM_RANKINGS_H__
|