Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Side by Side Diff: net/disk_cache/eviction.h

Issue 14183: Disk cache: move eviction code to a separate file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/backend_impl.cc ('k') | net/disk_cache/eviction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 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 #ifndef NET_DISK_CACHE_EVICTION_H_
6 #define NET_DISK_CACHE_EVICTION_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/task.h"
11 #include "net/disk_cache/disk_format.h"
12 #include "net/disk_cache/rankings.h"
13
14 namespace disk_cache {
15
16 class BackendImpl;
17 class EntryImpl;
18
19 // This class implements the eviction algorithm for the cache and it is tightly
20 // integrated with BackendImpl.
21 class Eviction {
22 public:
23 Eviction() : backend_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {}
24 ~Eviction() {}
25
26 void Init(BackendImpl* backend);
27
28 // Deletes entries from the cache until the current size is below the limit.
29 // If empty is true, the whole cache will be trimmed, regardless of being in
30 // use.
31 void TrimCache(bool empty);
32
33 // Updates the ranking information for an entry.
34 void UpdateRank(EntryImpl* entry, bool modified);
35
36 // Notifications of interesting events for a given entry.
37 void OnOpenEntry(EntryImpl* entry);
38 void OnCreateEntry(EntryImpl* entry);
39 void OnDoomEntry(EntryImpl* entry);
40 void OnDestroyEntry(EntryImpl* entry);
41
42 private:
43 void ReportTrimTimes(EntryImpl* entry);
44 Rankings::List GetListForEntry(EntryImpl* entry);
45
46 BackendImpl* backend_;
47 Rankings* rankings_;
48 IndexHeader* header_;
49 int max_size_;
50 ScopedRunnableMethodFactory<Eviction> factory_;
51
52 DISALLOW_COPY_AND_ASSIGN(Eviction);
53 };
54
55 } // namespace disk_cache
56
57 #endif // NET_DISK_CACHE_EVICTION_H_
OLDNEW
« no previous file with comments | « net/disk_cache/backend_impl.cc ('k') | net/disk_cache/eviction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698