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

Side by Side Diff: net/disk_cache/v3/backend_impl_v3.h

Issue 17507006: Disk cache v3 ref2 Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Incl IndexTable cl Created 7 years, 1 month 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/storage_block-inl.h ('k') | net/disk_cache/v3/backend_impl_v3.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // See net/disk_cache/disk_cache.h for the public interface of the cache. 5 // See net/disk_cache/disk_cache.h for the public interface of the cache.
6 6
7 #ifndef NET_DISK_CACHE_BACKEND_IMPL_H_ 7 #ifndef NET_DISK_CACHE_V3_BACKEND_IMPL_V3_H_
8 #define NET_DISK_CACHE_BACKEND_IMPL_H_ 8 #define NET_DISK_CACHE_V3_BACKEND_IMPL_V3_H_
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/synchronization/waitable_event.h"
12 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
13 #include "net/disk_cache/block_files.h" 14 #include "net/disk_cache/block_files.h"
14 #include "net/disk_cache/disk_cache.h" 15 #include "net/disk_cache/disk_cache.h"
15 #include "net/disk_cache/eviction.h"
16 #include "net/disk_cache/in_flight_backend_io.h"
17 #include "net/disk_cache/rankings.h"
18 #include "net/disk_cache/stats.h" 16 #include "net/disk_cache/stats.h"
19 #include "net/disk_cache/stress_support.h" 17 #include "net/disk_cache/stress_support.h"
20 #include "net/disk_cache/trace.h" 18 #include "net/disk_cache/trace.h"
19 #include "net/disk_cache/v3/block_bitmaps.h"
20 #include "net/disk_cache/v3/eviction_v3.h"
21 #include "net/disk_cache/v3/index_table.h"
21 22
22 namespace net { 23 namespace net {
23 class NetLog; 24 class NetLog;
24 } // namespace net 25 } // namespace net
25 26
26 namespace disk_cache { 27 namespace disk_cache {
27 28
28 enum BackendFlags { 29 class EntryImplV3;
29 kNone = 0,
30 kMask = 1, // A mask (for the index table) was specified.
31 kMaxSize = 1 << 1, // A maximum size was provided.
32 kUnitTestMode = 1 << 2, // We are modifying the behavior for testing.
33 kUpgradeMode = 1 << 3, // This is the upgrade tool (dump).
34 kNewEviction = 1 << 4, // Use of new eviction was specified.
35 kNoRandom = 1 << 5, // Don't add randomness to the behavior.
36 kNoLoadProtection = 1 << 6, // Don't act conservatively under load.
37 kNoBuffering = 1 << 7 // Disable extended IO buffering.
38 };
39 30
40 // This class implements the Backend interface. An object of this 31 // This class implements the Backend interface. An object of this
41 // class handles the operations of the cache for a particular profile. 32 // class handles the operations of the cache for a particular profile.
42 class NET_EXPORT_PRIVATE BackendImpl : public Backend { 33 class NET_EXPORT_PRIVATE BackendImplV3
43 friend class Eviction; 34 : public Backend,
35 public IndexTableBackend {
36 friend class EvictionV3;
44 public: 37 public:
45 BackendImpl(const base::FilePath& path, base::MessageLoopProxy* cache_thread, 38 enum BackendFlags {
39 MAX_SIZE = 1 << 1, // A maximum size was provided.
40 UNIT_TEST_MODE = 1 << 2, // We are modifying the behavior for testing.
41 UPGRADE_MODE = 1 << 3, // This is the upgrade tool (dump).
42 EVICTION_V2 = 1 << 4, // Use of new eviction was specified.
43 BASIC_UNIT_TEST = 1 << 5, // Identifies almost all unit tests.
44 NO_LOAD_PROTECTION = 1 << 6, // Don't act conservatively under load.
45 NO_BUFFERING = 1 << 7, // Disable extended IO buffering.
46 NO_CLEAN_ON_EXIT // Avoid saving data at exit time.
47 };
48
49 BackendImplV3(const base::FilePath& path, base::MessageLoopProxy* cache_thread ,
46 net::NetLog* net_log); 50 net::NetLog* net_log);
47 // mask can be used to limit the usable size of the hash table, for testing. 51 virtual ~BackendImplV3();
48 BackendImpl(const base::FilePath& path, uint32 mask,
49 base::MessageLoopProxy* cache_thread, net::NetLog* net_log);
50 virtual ~BackendImpl();
51 52
52 // Performs general initialization for this current instance of the cache. 53 // Performs general initialization for this current instance of the cache.
53 int Init(const CompletionCallback& callback); 54 int Init(const CompletionCallback& callback);
54 55
55 // Same behavior as OpenNextEntry but walks the list from back to front. 56 // Same behavior as OpenNextEntry but walks the list from back to front.
56 int OpenPrevEntry(void** iter, Entry** prev_entry, 57 int OpenPrevEntry(void** iter, Entry** prev_entry,
57 const CompletionCallback& callback); 58 const CompletionCallback& callback);
58 59
59 // Sets the maximum size for the total amount of data stored by this instance. 60 // Sets the maximum size for the total amount of data stored by this instance.
60 bool SetMaxSize(int max_bytes); 61 bool SetMaxSize(int max_bytes);
61 62
62 // Sets the cache type for this backend. 63 // Sets the cache type for this backend.
63 void SetType(net::CacheType type); 64 void SetType(net::CacheType type);
64 65
65 // Creates a new storage block of size block_count. 66 // Creates a new storage block of size block_count.
66 bool CreateBlock(FileType block_type, int block_count, 67 bool CreateBlock(FileType block_type, int block_count,
67 Addr* block_address); 68 Addr* block_address);
68 69
69 // Updates the ranking information for an entry. 70 // Updates the ranking information for an entry.
70 void UpdateRank(EntryImpl* entry, bool modified); 71 void UpdateRank(EntryImplV3* entry, bool modified);
71 72
72 // Permanently deletes an entry, but still keeps track of it. 73 // Permanently deletes an entry, but still keeps track of it.
73 void InternalDoomEntry(EntryImpl* entry); 74 void InternalDoomEntry(EntryImplV3* entry);
75
76 // Returns true is te entry should be deleted at this time. Otherwise, the
77 // entry will receive another Close() in later on.
78 bool ShouldDeleteNow(EntryImplV3* entry);
79
80 // Called when an entry is about to destroyed, after the data has been saved.
81 // The backend may extend the lifetime of the entry waiting for a call to
82 // OpenEntry().
83 void OnEntryCleanup(EntryImplV3* entry);
74 84
75 // This method must be called when an entry is released for the last time, so 85 // This method must be called when an entry is released for the last time, so
76 // the entry should not be used anymore. |address| is the cache address of the 86 // the entry should not be used anymore. |address| is the cache address of the
77 // entry. 87 // entry.
78 void OnEntryDestroyBegin(Addr address); 88 void OnEntryDestroyBegin(Addr address);
79 89
80 // This method must be called after all resources for an entry have been 90 // This method must be called after all resources for an entry have been
81 // released. 91 // released.
82 void OnEntryDestroyEnd(); 92 void OnEntryDestroyEnd();
83 93
84 // If the data stored by the provided |rankings| points to an open entry, 94 // Callen when an entry is modified for the first time.
85 // returns a pointer to that entry, otherwise returns NULL. Note that this 95 void OnEntryModified(EntryImplV3* entry);
86 // method does NOT increase the ref counter for the entry.
87 EntryImpl* GetOpenEntry(CacheRankingsBlock* rankings) const;
88 96
89 // Returns the id being used on this run of the cache. 97 // Methods that perform file IO. Each method result in a task posted to the
90 int32 GetCurrentEntryId() const; 98 // cache thread, with the |callback| invoked when the operation completes.
99 // Any error would result in the |entry| being automatically deleted. Note
100 // that these methods do not operate directly on entries, but rather on the
101 // |address| provided. For example, Delete() deletes the data pointed by
102 // |address|, it doesn't delete |entry|.
103 void ReadData(EntryImplV3* entry, Addr address, int offset,
104 net::IOBuffer* buffer, int buffer_len,
105 const CompletionCallback& callback);
106 void WriteData(EntryImplV3* entry, Addr address, int offset,
107 net::IOBuffer* buffer, int buffer_len,
108 const CompletionCallback& callback);
109 void MoveData(EntryImplV3* entry, Addr source, Addr destination, int len,
110 const CompletionCallback& callback);
111 void Truncate(EntryImplV3* entry, Addr address, int offset);
112 void Delete(EntryImplV3* entry, Addr address);
113 void Close(EntryImplV3* entry, Addr address);
114
115 // Evicts the entry located at |address|, with the given |hash|. Returns true
116 // if the entry can be evicted and the caller should expect a completion
117 // notification, false otherwise.
118 // This method is used by the eviction module, and OnEvictEntryComplete() will
119 // be called to notify the end of the operation.
120 bool EvictEntry(uint32 hash, Addr address);
121
122 // If the |address| corresponds to an open entry, returns a pointer to that
123 // entry, otherwise returns NULL. Note that this method increases the ref
124 // counter for the entry.
125 EntryImplV3* GetOpenEntry(Addr address) const;
91 126
92 // Returns the maximum size for a file to reside on the cache. 127 // Returns the maximum size for a file to reside on the cache.
93 int MaxFileSize() const; 128 int MaxFileSize() const;
94 129
95 // A user data block is being created, extended or truncated. 130 // A user data block is being created, extended or truncated.
96 void ModifyStorageSize(int32 old_size, int32 new_size); 131 void ModifyStorageSize(int32 old_size, int32 new_size);
97 132
98 // Logs requests that are denied due to being too big. 133 // Logs requests that are denied due to being too big.
99 void TooMuchStorageRequested(int32 size); 134 void TooMuchStorageRequested(int32 size);
100 135
101 // Returns true if a temporary buffer is allowed to be extended. 136 // Returns true if a temporary buffer is allowed to be extended.
102 bool IsAllocAllowed(int current_size, int new_size); 137 bool IsAllocAllowed(int current_size, int new_size, bool force);
103 138
104 // Tracks the release of |size| bytes by an entry buffer. 139 // Tracks the release of |size| bytes by an entry buffer.
105 void BufferDeleted(int size); 140 void BufferDeleted(int size);
106 141
107 // Only intended for testing the two previous methods. 142 // Only intended for testing the two previous methods.
108 int GetTotalBuffersSize() const { 143 int GetTotalBuffersSize() const {
109 return buffer_bytes_; 144 return buffer_bytes_;
110 } 145 }
111 146
112 // Returns true if this instance seems to be under heavy load. 147 // Returns true if this instance seems to be under heavy load.
113 bool IsLoaded() const; 148 bool IsLoaded() const;
114 149
150 // Returns the current time. For tests to run properly, use this method
151 // instead of calling base::Time::Now() directly.
152 base::Time GetCurrentTime() const;
153
115 // Returns the full histogram name, for the given base |name| and experiment, 154 // Returns the full histogram name, for the given base |name| and experiment,
116 // and the current cache type. The name will be "DiskCache.t.name_e" where n 155 // and the current cache type. The name will be "DiskCache.t.name_e" where n
117 // is the cache type and e the provided |experiment|. 156 // is the cache type and e the provided |experiment|.
118 std::string HistogramName(const char* name, int experiment) const; 157 std::string HistogramName(const char* name, int experiment) const;
119 158
120 net::CacheType cache_type() const { 159 net::CacheType cache_type() const {
121 return cache_type_; 160 return cache_type_;
122 } 161 }
123 162
124 bool read_only() const { 163 bool read_only() const {
125 return read_only_; 164 return read_only_;
126 } 165 }
127 166
128 // Returns a weak pointer to this object. 167 // Returns a weak pointer to this object.
129 base::WeakPtr<BackendImpl> GetWeakPtr(); 168 base::WeakPtr<BackendImplV3> GetWeakPtr();
130 169
131 // Returns true if we should send histograms for this user again. The caller 170 // Returns true if we should send histograms for this user again. The caller
132 // must call this function only once per run (because it returns always the 171 // must call this function only once per run (because it returns always the
133 // same thing on a given run). 172 // same thing on a given run).
134 bool ShouldReportAgain(); 173 bool ShouldReportAgain();
135 174
136 // Reports some data when we filled up the cache. 175 // Reports some data when we filled up the cache.
137 void FirstEviction(); 176 void FirstEviction();
138 177
139 // Called when an interesting event should be logged (counted). 178 // Called when an interesting event should be logged (counted).
140 void OnEvent(Stats::Counters an_event); 179 void OnEvent(Stats::Counters an_event);
141 180
142 // Keeps track of payload access (doesn't include metadata). 181 // Keeps track of payload access (doesn't include metadata).
143 void OnRead(int bytes); 182 void OnRead(int bytes);
144 void OnWrite(int bytes); 183 void OnWrite(int bytes);
145 184
146 // Timer callback to calculate usage statistics. 185 // Increases the size of the block files.
147 void OnStatsTimer(); 186 void GrowBlockFiles();
187
188 // Timer callback to calculate usage statistics and perform backups.
189 void OnTimerTick();
148 190
149 // Sets internal parameters to enable unit testing mode. 191 // Sets internal parameters to enable unit testing mode.
150 void SetUnitTestMode(); 192 void SetUnitTestMode();
151 193
152 // Sets internal parameters to enable upgrade mode (for internal tools). 194 // Sets internal parameters to enable upgrade mode (for internal tools).
153 void SetUpgradeMode(); 195 void SetUpgradeMode();
154 196
155 // Sets the eviction algorithm to version 2. 197 // Sets the eviction algorithm to version 2.
156 void SetNewEviction(); 198 void SetNewEviction();
157 199
158 // Sets an explicit set of BackendFlags. 200 // Sets an explicit set of BackendFlags.
159 void SetFlags(uint32 flags); 201 void SetFlags(uint32 flags);
160 202
161 // Sends a dummy operation through the operation queue, for unit tests. 203 // Sends a dummy operation through the operation queue, for unit tests.
162 int FlushQueueForTest(const CompletionCallback& callback); 204 int FlushQueueForTest(const CompletionCallback& callback);
163 205
206 // Performs final cleanup, for unit tests.
207 int CleanupForTest(const CompletionCallback& callback);
208
164 // Trims an entry (all if |empty| is true) from the list of deleted 209 // Trims an entry (all if |empty| is true) from the list of deleted
165 // entries. This method should be called directly on the cache thread. 210 // entries. This method should be called directly on the cache thread.
166 void TrimForTest(bool empty); 211 void TrimForTest(bool empty);
167 212
168 // Trims an entry (all if |empty| is true) from the list of deleted 213 // Trims an entry (all if |empty| is true) from the list of deleted
169 // entries. This method should be called directly on the cache thread. 214 // entries. This method should be called directly on the cache thread.
170 void TrimDeletedListForTest(bool empty); 215 void TrimDeletedListForTest(bool empty);
171 216
217 // Simulates that aditional |seconds| have elapsed, for testing purposes.
218 void AddDelayForTest(int seconds);
219
220 // Returns a net error code to inform the caller when the entry with the
221 // desired |key| is completely closed.
222 int WaitForEntryToCloseForTest(const std::string& key,
223 const CompletionCallback& callback);
224
172 // Performs a simple self-check, and returns the number of dirty items 225 // Performs a simple self-check, and returns the number of dirty items
173 // or an error code (negative value). 226 // or an error code (negative value).
174 int SelfCheck(); 227 int SelfCheck();
175 228
229 // IndexTableBackend implementation.
230 virtual void GrowIndex() OVERRIDE;
231 virtual void SaveIndex(net::IOBuffer* buffer, int buffer_len) OVERRIDE;
232 virtual void DeleteCell(EntryCell cell) OVERRIDE;
233 virtual void FixCell(EntryCell cell) OVERRIDE;
234
176 // Backend implementation. 235 // Backend implementation.
177 virtual net::CacheType GetCacheType() const OVERRIDE; 236 virtual net::CacheType GetCacheType() const OVERRIDE;
178 virtual int32 GetEntryCount() const OVERRIDE; 237 virtual int32 GetEntryCount() const OVERRIDE;
179 virtual int OpenEntry(const std::string& key, Entry** entry, 238 virtual int OpenEntry(const std::string& key, Entry** entry,
180 const CompletionCallback& callback) OVERRIDE; 239 const CompletionCallback& callback) OVERRIDE;
181 virtual int CreateEntry(const std::string& key, Entry** entry, 240 virtual int CreateEntry(const std::string& key, Entry** entry,
182 const CompletionCallback& callback) OVERRIDE; 241 const CompletionCallback& callback) OVERRIDE;
183 virtual int DoomEntry(const std::string& key, 242 virtual int DoomEntry(const std::string& key,
184 const CompletionCallback& callback) OVERRIDE; 243 const CompletionCallback& callback) OVERRIDE;
185 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; 244 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE;
186 virtual int DoomEntriesBetween(base::Time initial_time, 245 virtual int DoomEntriesBetween(base::Time initial_time,
187 base::Time end_time, 246 base::Time end_time,
188 const CompletionCallback& callback) OVERRIDE; 247 const CompletionCallback& callback) OVERRIDE;
189 virtual int DoomEntriesSince(base::Time initial_time, 248 virtual int DoomEntriesSince(base::Time initial_time,
190 const CompletionCallback& callback) OVERRIDE; 249 const CompletionCallback& callback) OVERRIDE;
191 virtual int OpenNextEntry(void** iter, Entry** next_entry, 250 virtual int OpenNextEntry(void** iter, Entry** next_entry,
192 const CompletionCallback& callback) OVERRIDE; 251 const CompletionCallback& callback) OVERRIDE;
193 virtual void EndEnumeration(void** iter) OVERRIDE; 252 virtual void EndEnumeration(void** iter) OVERRIDE;
194 virtual void GetStats(StatsItems* stats) OVERRIDE; 253 virtual void GetStats(StatsItems* stats) OVERRIDE;
195 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; 254 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE;
196 255
197 private: 256 private:
198 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap; 257 typedef base::hash_map<CacheAddr, EntryImplV3*> EntriesMap;
258 typedef base::hash_set<EntryImplV3*> EntriesSet;
259 class IOCallback;
260 class Worker;
261 class WorkItem;
199 262
200 void AdjustMaxCacheSize(int table_len); 263 void AdjustMaxCacheSize();
201 264 bool InitStats(void* stats_data);
202 bool InitStats();
203 void StoreStats(); 265 void StoreStats();
204 266
205 // Deletes the cache and starts again. 267 // Deletes the cache and starts again.
206 void RestartCache(bool failure); 268 void RestartCache(const CompletionCallback& callback);
207 void PrepareForRestart(); 269 void PrepareForRestart();
208 270
271 // Performs final cleanup.
209 void CleanupCache(); 272 void CleanupCache();
210 273
211 // Creates a new entry object. Returns zero on success, or a disk_cache error 274 // Creates a new entry object. Returns zero on success, or a disk_cache error
212 // on failure. 275 // on failure.
213 int NewEntry(Addr address, EntryImpl** entry); 276 int NewEntry(WorkItem* work_item, EntryImplV3** entry);
277
278 // Scans |entries| and the list of open entries looking for a match. Returns
279 // NULL if no match is fouond.
280 EntryImplV3* LookupOpenEntry(const EntrySet& entries, const std::string key);
214 281
215 // Opens the next or previous entry on a cache iteration. 282 // Opens the next or previous entry on a cache iteration.
216 EntryImpl* OpenFollowingEntry(bool forward, void** iter); 283 int OpenFollowingEntry(bool forward, void** iter, Entry** next_entry,
284 const CompletionCallback& callback);
285
286 // Continue an enumeration by getting more cells or the next entry to open.
287 bool GetMoreCells(WorkItem* work_item);
288 int OpenNext(WorkItem* work_item);
289
290 // Doom |entry| if directed by the work_item.
291 void Doom(EntryImplV3* entry, WorkItem* work_item);
292
293 // Updates the user visible iterator an tell the user about it.
294 void UpdateIterator(EntryImplV3* entry, WorkItem* work_item);
295
296 // Deletes entries that are waiting for deletion.
297 void CloseDoomedEntries();
298
299 // Releases recent_entries_.
300 void ReleaseRecentEntries();
301
302 // Updates the cells for entries already gone.
303 void UpdateDeletedEntries();
217 304
218 // Handles the used storage count. 305 // Handles the used storage count.
219 void AddStorageSize(int32 bytes); 306 void AddStorageSize(int32 bytes);
220 void SubstractStorageSize(int32 bytes); 307 void SubstractStorageSize(int32 bytes);
221 308
222 // Update the number of referenced cache entries. 309 // Update the number of referenced cache entries.
223 void IncreaseNumRefs(); 310 void IncreaseNumRefs();
224 void DecreaseNumRefs(); 311 void DecreaseNumRefs();
225 void IncreaseNumEntries(); 312 void IncreaseNumEntries();
226 void DecreaseNumEntries(); 313 void DecreaseNumEntries();
227 314
315 // Methods to post and receive notifications about tasks executed on the
316 // cache thread.
317 void PostWorkItem(WorkItem* work_item);
318 void OnWorkDone(WorkItem* work_item);
319 void OnInitComplete(WorkItem* work_item);
320 void OnGrowIndexComplete(WorkItem* work_item);
321 void OnGrowFilesComplete(WorkItem* work_item);
322 void OnOperationComplete(WorkItem* work_item);
323 void OnOpenEntryComplete(WorkItem* work_item);
324 void OnOpenForResurrectComplete(WorkItem* work_item);
325 void OnEvictEntryComplete(WorkItem* work_item);
326 void OnOpenNextComplete(WorkItem* work_item);
327
328 // Last part of CreateEntry(). |short_record| may point to stored data about
329 // a previously evicted entry matching this |key|.
330 int OnCreateEntryComplete(const std::string& key, uint32 hash,
331 ShortEntryRecord* short_record, Entry** entry,
332 const CompletionCallback& callback);
333
228 // Dumps current cache statistics to the log. 334 // Dumps current cache statistics to the log.
229 void LogStats(); 335 void LogStats();
230 336
231 // Send UMA stats. 337 // Send UMA stats.
232 void ReportStats(); 338 void ReportStats();
233 339
234 // Reports an uncommon, recoverable error. 340 // Reports an uncommon, recoverable error.
235 void ReportError(int error); 341 void ReportError(int error);
236 342
237 // Performs basic checks on the index file. Returns false on failure. 343 // Performs basic checks on the index file. Returns false on failure.
238 bool CheckIndex(); 344 bool CheckIndex();
239 345
240 // Part of the self test. Returns the number or dirty entries, or an error. 346 // Part of the self test. Returns the number or dirty entries, or an error.
241 int CheckAllEntries(); 347 int CheckAllEntries();
242 348
243 // Part of the self test. Returns false if the entry is corrupt. 349 // Part of the self test. Returns false if the entry is corrupt.
244 bool CheckEntry(EntryImpl* cache_entry); 350 bool CheckEntry(EntryImplV3* cache_entry);
245 351
246 // Returns the maximum total memory for the memory buffers. 352 // Returns the maximum total memory for the memory buffers.
247 int MaxBuffersSize(); 353 int MaxBuffersSize();
248 354
249 scoped_refptr<MappedFile> index_; // The main cache index. 355 IndexTable index_;
250 base::FilePath path_; // Path to the folder used as backing storage. 356 base::FilePath path_; // Path to the folder used as backing storage.
251 BlockFiles block_files_; // Set of files used to store all data. 357 BlockBitmaps block_files_;
252 int32 max_size_; // Maximum data size for this instance. 358 int32 max_size_; // Maximum data size for this instance.
253 Eviction eviction_; // Handler of the eviction algorithm. 359 EvictionV3 eviction_; // Handler of the eviction algorithm.
254 EntriesMap open_entries_; // Map of open entries. 360 EntriesMap open_entries_;
361 EntriesMap doomed_entries_;
362 EntriesMap entries_to_delete_;
363 EntriesSet recent_entries_; // May still be open, or recently closed.
364 CellList deleted_entries_;
255 int num_refs_; // Number of referenced cache entries. 365 int num_refs_; // Number of referenced cache entries.
256 int max_refs_; // Max number of referenced cache entries. 366 int max_refs_; // Max number of referenced cache entries.
257 int entry_count_; // Number of entries accessed lately. 367 int entry_count_; // Number of entries accessed lately.
258 int byte_count_; // Number of bytes read/written lately. 368 int byte_count_; // Number of bytes read/written lately.
259 int buffer_bytes_; // Total size of the temporary entries' buffers. 369 int buffer_bytes_; // Total size of the temporary entries' buffers.
260 int up_ticks_; // The number of timer ticks received (OnStatsTimer). 370 int up_ticks_; // The number of timer ticks received (OnTimerTick).
371 int test_seconds_; // The "current time" for tests.
261 net::CacheType cache_type_; 372 net::CacheType cache_type_;
262 int uma_report_; // Controls transmission of UMA data. 373 int uma_report_; // Controls transmission of UMA data.
263 uint32 user_flags_; // Flags set by the user. 374 uint32 user_flags_; // Flags set by the user.
264 bool init_; // controls the initialization of the system. 375 bool init_; // controls the initialization of the system.
265 bool restarted_; 376 bool restarted_;
266 bool unit_test_;
267 bool read_only_; // Prevents updates of the rankings data (used by tools). 377 bool read_only_; // Prevents updates of the rankings data (used by tools).
268 bool disabled_; 378 bool disabled_;
269 bool new_eviction_; // What eviction algorithm should be used. 379 bool lru_eviction_; // What eviction algorithm should be used.
270 bool first_timer_; // True if the timer has not been called. 380 bool first_timer_; // True if the timer has not been called.
271 bool user_load_; // True if we see a high load coming from the caller. 381 bool user_load_; // True if we see a high load coming from the caller.
382 bool growing_index_;
383 bool growing_files_;
272 384
273 net::NetLog* net_log_; 385 net::NetLog* net_log_;
274 386
275 Stats stats_; // Usage statistics. 387 Stats stats_; // Usage statistics.
276 scoped_ptr<base::RepeatingTimer<BackendImpl> > timer_; // Usage timer. 388 scoped_ptr<base::RepeatingTimer<BackendImplV3> > timer_; // Usage timer.
277 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. 389 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing.
278 base::WeakPtrFactory<BackendImpl> ptr_factory_; 390 scoped_refptr<base::MessageLoopProxy> cache_thread_;
391 scoped_refptr<Worker> worker_;
392 base::WeakPtrFactory<BackendImplV3> ptr_factory_;
279 393
280 DISALLOW_COPY_AND_ASSIGN(BackendImpl); 394 DISALLOW_COPY_AND_ASSIGN(BackendImplV3);
281 }; 395 };
282 396
283 // Returns the preferred max cache size given the available disk space.
284 NET_EXPORT_PRIVATE int PreferedCacheSize(int64 available);
285
286 } // namespace disk_cache 397 } // namespace disk_cache
287 398
288 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_ 399 #endif // NET_DISK_CACHE_V3_BACKEND_IMPL_V3_H_
OLDNEW
« no previous file with comments | « net/disk_cache/storage_block-inl.h ('k') | net/disk_cache/v3/backend_impl_v3.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698