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

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

Issue 2854053: Disk cache: Stop evictions while performing final cleanup.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 5 months 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_DISK_CACHE_EVICTION_H_ 5 #ifndef NET_DISK_CACHE_EVICTION_H_
6 #define NET_DISK_CACHE_EVICTION_H_ 6 #define NET_DISK_CACHE_EVICTION_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/task.h" 10 #include "base/task.h"
11 #include "net/disk_cache/disk_format.h" 11 #include "net/disk_cache/disk_format.h"
12 #include "net/disk_cache/rankings.h" 12 #include "net/disk_cache/rankings.h"
13 13
14 namespace disk_cache { 14 namespace disk_cache {
15 15
16 class BackendImpl; 16 class BackendImpl;
17 class EntryImpl; 17 class EntryImpl;
18 18
19 // This class implements the eviction algorithm for the cache and it is tightly 19 // This class implements the eviction algorithm for the cache and it is tightly
20 // integrated with BackendImpl. 20 // integrated with BackendImpl.
21 class Eviction { 21 class Eviction {
22 public: 22 public:
23 Eviction() : backend_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {} 23 Eviction()
24 : backend_(NULL), init_(false),
25 ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {}
24 ~Eviction() {} 26 ~Eviction() {}
25 27
26 void Init(BackendImpl* backend); 28 void Init(BackendImpl* backend);
29 void Stop();
27 30
28 // Deletes entries from the cache until the current size is below the limit. 31 // 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 32 // If empty is true, the whole cache will be trimmed, regardless of being in
30 // use. 33 // use.
31 void TrimCache(bool empty); 34 void TrimCache(bool empty);
32 35
33 // Updates the ranking information for an entry. 36 // Updates the ranking information for an entry.
34 void UpdateRank(EntryImpl* entry, bool modified); 37 void UpdateRank(EntryImpl* entry, bool modified);
35 38
36 // Notifications of interesting events for a given entry. 39 // Notifications of interesting events for a given entry.
(...skipping 29 matching lines...) Expand all
66 69
67 BackendImpl* backend_; 70 BackendImpl* backend_;
68 Rankings* rankings_; 71 Rankings* rankings_;
69 IndexHeader* header_; 72 IndexHeader* header_;
70 int max_size_; 73 int max_size_;
71 int trim_delays_; 74 int trim_delays_;
72 bool new_eviction_; 75 bool new_eviction_;
73 bool first_trim_; 76 bool first_trim_;
74 bool trimming_; 77 bool trimming_;
75 bool delay_trim_; 78 bool delay_trim_;
79 bool init_;
76 ScopedRunnableMethodFactory<Eviction> factory_; 80 ScopedRunnableMethodFactory<Eviction> factory_;
77 81
78 DISALLOW_COPY_AND_ASSIGN(Eviction); 82 DISALLOW_COPY_AND_ASSIGN(Eviction);
79 }; 83 };
80 84
81 } // namespace disk_cache 85 } // namespace disk_cache
82 86
83 #endif // NET_DISK_CACHE_EVICTION_H_ 87 #endif // NET_DISK_CACHE_EVICTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698