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

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

Issue 160485: Disk cache: Open the disk cache experiment for new users.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 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
« no previous file with comments | « no previous file | net/disk_cache/backend_impl.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) 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 // 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_BACKEND_IMPL_H_
8 #define NET_DISK_CACHE_BACKEND_IMPL_H_ 8 #define NET_DISK_CACHE_BACKEND_IMPL_H_
9 9
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
11 #include "base/timer.h" 11 #include "base/timer.h"
12 #include "net/disk_cache/block_files.h" 12 #include "net/disk_cache/block_files.h"
13 #include "net/disk_cache/disk_cache.h" 13 #include "net/disk_cache/disk_cache.h"
14 #include "net/disk_cache/eviction.h" 14 #include "net/disk_cache/eviction.h"
15 #include "net/disk_cache/rankings.h" 15 #include "net/disk_cache/rankings.h"
16 #include "net/disk_cache/stats.h" 16 #include "net/disk_cache/stats.h"
17 #include "net/disk_cache/trace.h" 17 #include "net/disk_cache/trace.h"
18 18
19 namespace disk_cache { 19 namespace disk_cache {
20 20
21 enum BackendFlags { 21 enum BackendFlags {
22 kMask = 1, 22 kMask = 1,
23 kMaxSize = 1 << 1, 23 kMaxSize = 1 << 1,
24 kUnitTestMode = 1 << 2, 24 kUnitTestMode = 1 << 2,
25 kUpgradeMode = 1 << 3, 25 kUpgradeMode = 1 << 3,
26 kNewEviction = 1 << 4 26 kNewEviction = 1 << 4,
27 kNoRandom = 1 << 5
27 }; 28 };
28 29
29 // This class implements the Backend interface. An object of this 30 // This class implements the Backend interface. An object of this
30 // class handles the operations of the cache for a particular profile. 31 // class handles the operations of the cache for a particular profile.
31 class BackendImpl : public Backend { 32 class BackendImpl : public Backend {
32 friend class Eviction; 33 friend class Eviction;
33 public: 34 public:
34 explicit BackendImpl(const std::wstring& path) 35 explicit BackendImpl(const std::wstring& path)
35 : path_(path), block_files_(path), mask_(0), max_size_(0), 36 : path_(path), block_files_(path), mask_(0), max_size_(0),
36 cache_type_(net::DISK_CACHE), uma_report_(0), user_flags_(0), 37 cache_type_(net::DISK_CACHE), uma_report_(0), user_flags_(0),
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 164
164 // Sets internal parameters to enable unit testing mode. 165 // Sets internal parameters to enable unit testing mode.
165 void SetUnitTestMode(); 166 void SetUnitTestMode();
166 167
167 // Sets internal parameters to enable upgrade mode (for internal tools). 168 // Sets internal parameters to enable upgrade mode (for internal tools).
168 void SetUpgradeMode(); 169 void SetUpgradeMode();
169 170
170 // Sets the eviction algorithm to version 2. 171 // Sets the eviction algorithm to version 2.
171 void SetNewEviction(); 172 void SetNewEviction();
172 173
174 // Sets an explicit set of BackendFlags.
175 void SetFlags(uint32 flags);
176
173 // Clears the counter of references to test handling of corruptions. 177 // Clears the counter of references to test handling of corruptions.
174 void ClearRefCountForTest(); 178 void ClearRefCountForTest();
175 179
176 // Peforms a simple self-check, and returns the number of dirty items 180 // Peforms a simple self-check, and returns the number of dirty items
177 // or an error code (negative value). 181 // or an error code (negative value).
178 int SelfCheck(); 182 int SelfCheck();
179 183
180 // Same bahavior as OpenNextEntry but walks the list from back to front. 184 // Same bahavior as OpenNextEntry but walks the list from back to front.
181 bool OpenPrevEntry(void** iter, Entry** prev_entry); 185 bool OpenPrevEntry(void** iter, Entry** prev_entry);
182 186
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 283
280 DISALLOW_EVIL_CONSTRUCTORS(BackendImpl); 284 DISALLOW_EVIL_CONSTRUCTORS(BackendImpl);
281 }; 285 };
282 286
283 // Returns the prefered max cache size given the available disk space. 287 // Returns the prefered max cache size given the available disk space.
284 int PreferedCacheSize(int64 available); 288 int PreferedCacheSize(int64 available);
285 289
286 } // namespace disk_cache 290 } // namespace disk_cache
287 291
288 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_ 292 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698