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

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

Issue 1492403002: Remove kuint32max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: http security header file Created 5 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
« no previous file with comments | « net/disk_cache/blockfile/backend_impl.cc ('k') | net/disk_cache/blockfile/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_BLOCKFILE_BACKEND_IMPL_V3_H_ 7 #ifndef NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_
8 #define NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ 8 #define NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_
9 9
10 #include <stdint.h>
11
10 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
11 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
12 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
13 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
14 #include "net/disk_cache/blockfile/block_bitmaps_v3.h" 16 #include "net/disk_cache/blockfile/block_bitmaps_v3.h"
15 #include "net/disk_cache/blockfile/block_files.h" 17 #include "net/disk_cache/blockfile/block_files.h"
16 #include "net/disk_cache/blockfile/eviction_v3.h" 18 #include "net/disk_cache/blockfile/eviction_v3.h"
17 #include "net/disk_cache/blockfile/index_table_v3.h" 19 #include "net/disk_cache/blockfile/index_table_v3.h"
18 #include "net/disk_cache/blockfile/stats.h" 20 #include "net/disk_cache/blockfile/stats.h"
19 #include "net/disk_cache/blockfile/stress_support.h" 21 #include "net/disk_cache/blockfile/stress_support.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // This method must be called after all resources for an entry have been 81 // This method must be called after all resources for an entry have been
80 // released. 82 // released.
81 void OnEntryDestroyEnd(); 83 void OnEntryDestroyEnd();
82 84
83 // If the |address| corresponds to an open entry, returns a pointer to that 85 // If the |address| corresponds to an open entry, returns a pointer to that
84 // entry, otherwise returns NULL. Note that this method does not increase the 86 // entry, otherwise returns NULL. Note that this method does not increase the
85 // ref counter for the entry. 87 // ref counter for the entry.
86 EntryImplV3* GetOpenEntry(Addr address) const; 88 EntryImplV3* GetOpenEntry(Addr address) const;
87 89
88 // Returns the id being used on this run of the cache. 90 // Returns the id being used on this run of the cache.
89 int32 GetCurrentEntryId() const; 91 int32_t GetCurrentEntryId() const;
90 92
91 // Returns the maximum size for a file to reside on the cache. 93 // Returns the maximum size for a file to reside on the cache.
92 int MaxFileSize() const; 94 int MaxFileSize() const;
93 95
94 // A user data block is being created, extended or truncated. 96 // A user data block is being created, extended or truncated.
95 void ModifyStorageSize(int32 old_size, int32 new_size); 97 void ModifyStorageSize(int32_t old_size, int32_t new_size);
96 98
97 // Logs requests that are denied due to being too big. 99 // Logs requests that are denied due to being too big.
98 void TooMuchStorageRequested(int32 size); 100 void TooMuchStorageRequested(int32_t size);
99 101
100 // Returns true if a temporary buffer is allowed to be extended. 102 // Returns true if a temporary buffer is allowed to be extended.
101 bool IsAllocAllowed(int current_size, int new_size); 103 bool IsAllocAllowed(int current_size, int new_size);
102 104
103 // Tracks the release of |size| bytes by an entry buffer. 105 // Tracks the release of |size| bytes by an entry buffer.
104 void BufferDeleted(int size); 106 void BufferDeleted(int size);
105 107
106 // Only intended for testing the two previous methods. 108 // Only intended for testing the two previous methods.
107 int GetTotalBuffersSize() const { 109 int GetTotalBuffersSize() const {
108 return buffer_bytes_; 110 return buffer_bytes_;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Sets internal parameters to enable unit testing mode. 149 // Sets internal parameters to enable unit testing mode.
148 void SetUnitTestMode(); 150 void SetUnitTestMode();
149 151
150 // Sets internal parameters to enable upgrade mode (for internal tools). 152 // Sets internal parameters to enable upgrade mode (for internal tools).
151 void SetUpgradeMode(); 153 void SetUpgradeMode();
152 154
153 // Sets the eviction algorithm to version 2. 155 // Sets the eviction algorithm to version 2.
154 void SetNewEviction(); 156 void SetNewEviction();
155 157
156 // Sets an explicit set of BackendFlags. 158 // Sets an explicit set of BackendFlags.
157 void SetFlags(uint32 flags); 159 void SetFlags(uint32_t flags);
158 160
159 // Sends a dummy operation through the operation queue, for unit tests. 161 // Sends a dummy operation through the operation queue, for unit tests.
160 int FlushQueueForTest(const CompletionCallback& callback); 162 int FlushQueueForTest(const CompletionCallback& callback);
161 163
162 // Trims an entry (all if |empty| is true) from the list of deleted 164 // Trims an entry (all if |empty| is true) from the list of deleted
163 // entries. This method should be called directly on the cache thread. 165 // entries. This method should be called directly on the cache thread.
164 void TrimForTest(bool empty); 166 void TrimForTest(bool empty);
165 167
166 // Trims an entry (all if |empty| is true) from the list of deleted 168 // Trims an entry (all if |empty| is true) from the list of deleted
167 // entries. This method should be called directly on the cache thread. 169 // entries. This method should be called directly on the cache thread.
168 void TrimDeletedListForTest(bool empty); 170 void TrimDeletedListForTest(bool empty);
169 171
170 // Performs a simple self-check, and returns the number of dirty items 172 // Performs a simple self-check, and returns the number of dirty items
171 // or an error code (negative value). 173 // or an error code (negative value).
172 int SelfCheck(); 174 int SelfCheck();
173 175
174 // Backend implementation. 176 // Backend implementation.
175 net::CacheType GetCacheType() const override; 177 net::CacheType GetCacheType() const override;
176 int32 GetEntryCount() const override; 178 int32_t GetEntryCount() const override;
177 int OpenEntry(const std::string& key, 179 int OpenEntry(const std::string& key,
178 Entry** entry, 180 Entry** entry,
179 const CompletionCallback& callback) override; 181 const CompletionCallback& callback) override;
180 int CreateEntry(const std::string& key, 182 int CreateEntry(const std::string& key,
181 Entry** entry, 183 Entry** entry,
182 const CompletionCallback& callback) override; 184 const CompletionCallback& callback) override;
183 int DoomEntry(const std::string& key, 185 int DoomEntry(const std::string& key,
184 const CompletionCallback& callback) override; 186 const CompletionCallback& callback) override;
185 int DoomAllEntries(const CompletionCallback& callback) override; 187 int DoomAllEntries(const CompletionCallback& callback) override;
186 int DoomEntriesBetween(base::Time initial_time, 188 int DoomEntriesBetween(base::Time initial_time,
(...skipping 22 matching lines...) Expand all
209 void PrepareForRestart(); 211 void PrepareForRestart();
210 212
211 // Performs final cleanup. 213 // Performs final cleanup.
212 void CleanupCache(); 214 void CleanupCache();
213 215
214 // Creates a new entry object. Returns zero on success, or a disk_cache error 216 // Creates a new entry object. Returns zero on success, or a disk_cache error
215 // on failure. 217 // on failure.
216 int NewEntry(Addr address, EntryImplV3** entry); 218 int NewEntry(Addr address, EntryImplV3** entry);
217 219
218 // Handles the used storage count. 220 // Handles the used storage count.
219 void AddStorageSize(int32 bytes); 221 void AddStorageSize(int32_t bytes);
220 void SubstractStorageSize(int32 bytes); 222 void SubstractStorageSize(int32_t bytes);
221 223
222 // Update the number of referenced cache entries. 224 // Update the number of referenced cache entries.
223 void IncreaseNumRefs(); 225 void IncreaseNumRefs();
224 void DecreaseNumRefs(); 226 void DecreaseNumRefs();
225 void IncreaseNumEntries(); 227 void IncreaseNumEntries();
226 void DecreaseNumEntries(); 228 void DecreaseNumEntries();
227 229
228 // Dumps current cache statistics to the log. 230 // Dumps current cache statistics to the log.
229 void LogStats(); 231 void LogStats();
230 232
(...skipping 11 matching lines...) Expand all
242 244
243 // Part of the self test. Returns false if the entry is corrupt. 245 // Part of the self test. Returns false if the entry is corrupt.
244 bool CheckEntry(EntryImplV3* cache_entry); 246 bool CheckEntry(EntryImplV3* cache_entry);
245 247
246 // Returns the maximum total memory for the memory buffers. 248 // Returns the maximum total memory for the memory buffers.
247 int MaxBuffersSize(); 249 int MaxBuffersSize();
248 250
249 IndexTable index_; 251 IndexTable index_;
250 base::FilePath path_; // Path to the folder used as backing storage. 252 base::FilePath path_; // Path to the folder used as backing storage.
251 BlockBitmaps block_files_; 253 BlockBitmaps block_files_;
252 int32 max_size_; // Maximum data size for this instance. 254 int32_t max_size_; // Maximum data size for this instance.
253 EvictionV3 eviction_; // Handler of the eviction algorithm. 255 EvictionV3 eviction_; // Handler of the eviction algorithm.
254 EntriesMap open_entries_; 256 EntriesMap open_entries_;
255 int num_refs_; // Number of referenced cache entries. 257 int num_refs_; // Number of referenced cache entries.
256 int max_refs_; // Max number of referenced cache entries. 258 int max_refs_; // Max number of referenced cache entries.
257 int entry_count_; // Number of entries accessed lately. 259 int entry_count_; // Number of entries accessed lately.
258 int byte_count_; // Number of bytes read/written lately. 260 int byte_count_; // Number of bytes read/written lately.
259 int buffer_bytes_; // Total size of the temporary entries' buffers. 261 int buffer_bytes_; // Total size of the temporary entries' buffers.
260 int up_ticks_; // The number of timer ticks received (OnTimerTick). 262 int up_ticks_; // The number of timer ticks received (OnTimerTick).
261 net::CacheType cache_type_; 263 net::CacheType cache_type_;
262 int uma_report_; // Controls transmission of UMA data. 264 int uma_report_; // Controls transmission of UMA data.
263 uint32 user_flags_; // Flags set by the user. 265 uint32_t user_flags_; // Flags set by the user.
264 bool init_; // controls the initialization of the system. 266 bool init_; // controls the initialization of the system.
265 bool restarted_; 267 bool restarted_;
266 bool read_only_; // Prevents updates of the rankings data (used by tools). 268 bool read_only_; // Prevents updates of the rankings data (used by tools).
267 bool disabled_; 269 bool disabled_;
268 bool lru_eviction_; // What eviction algorithm should be used. 270 bool lru_eviction_; // What eviction algorithm should be used.
269 bool first_timer_; // True if the timer has not been called. 271 bool first_timer_; // True if the timer has not been called.
270 bool user_load_; // True if we see a high load coming from the caller. 272 bool user_load_; // True if we see a high load coming from the caller.
271 273
272 net::NetLog* net_log_; 274 net::NetLog* net_log_;
273 275
274 Stats stats_; // Usage statistics. 276 Stats stats_; // Usage statistics.
275 scoped_ptr<base::RepeatingTimer> timer_; // Usage timer. 277 scoped_ptr<base::RepeatingTimer> timer_; // Usage timer.
276 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. 278 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing.
277 base::WeakPtrFactory<BackendImplV3> ptr_factory_; 279 base::WeakPtrFactory<BackendImplV3> ptr_factory_;
278 280
279 DISALLOW_COPY_AND_ASSIGN(BackendImplV3); 281 DISALLOW_COPY_AND_ASSIGN(BackendImplV3);
280 }; 282 };
281 283
282 } // namespace disk_cache 284 } // namespace disk_cache
283 285
284 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_ 286 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_V3_H_
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/backend_impl.cc ('k') | net/disk_cache/blockfile/backend_impl_v3.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698