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

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

Issue 3167020: Disk cache: Extend the internal buffering performed by each entry... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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') | net/disk_cache/backend_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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 #pragma once 9 #pragma once
10 10
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 // Returns the maximum size for a file to reside on the cache. 169 // Returns the maximum size for a file to reside on the cache.
170 int MaxFileSize() const; 170 int MaxFileSize() const;
171 171
172 // A user data block is being created, extended or truncated. 172 // A user data block is being created, extended or truncated.
173 void ModifyStorageSize(int32 old_size, int32 new_size); 173 void ModifyStorageSize(int32 old_size, int32 new_size);
174 174
175 // Logs requests that are denied due to being too big. 175 // Logs requests that are denied due to being too big.
176 void TooMuchStorageRequested(int32 size); 176 void TooMuchStorageRequested(int32 size);
177 177
178 // Returns true if a temporary buffer is allowed to be extended.
179 bool IsAllocAllowed(int current_size, int new_size);
180
181 // Tracks the release of |size| bytes by an entry buffer.
182 void BufferDeleted(int size);
183
184 // Only intended for testing the two previous methods.
185 int GetTotalBuffersSize() const {
186 return buffer_bytes_;
187 }
188
178 // Returns true if this instance seems to be under heavy load. 189 // Returns true if this instance seems to be under heavy load.
179 bool IsLoaded() const; 190 bool IsLoaded() const;
180 191
181 // Returns the full histogram name, for the given base |name| and experiment, 192 // Returns the full histogram name, for the given base |name| and experiment,
182 // and the current cache type. The name will be "DiskCache.t.name_e" where n 193 // and the current cache type. The name will be "DiskCache.t.name_e" where n
183 // is the cache type and e the provided |experiment|. 194 // is the cache type and e the provided |experiment|.
184 std::string HistogramName(const char* name, int experiment) const; 195 std::string HistogramName(const char* name, int experiment) const;
185 196
186 net::CacheType cache_type() const { 197 net::CacheType cache_type() const {
187 return cache_type_; 198 return cache_type_;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 318
308 // Performs basic checks on the index file. Returns false on failure. 319 // Performs basic checks on the index file. Returns false on failure.
309 bool CheckIndex(); 320 bool CheckIndex();
310 321
311 // Part of the selt test. Returns the number or dirty entries, or an error. 322 // Part of the selt test. Returns the number or dirty entries, or an error.
312 int CheckAllEntries(); 323 int CheckAllEntries();
313 324
314 // Part of the self test. Returns false if the entry is corrupt. 325 // Part of the self test. Returns false if the entry is corrupt.
315 bool CheckEntry(EntryImpl* cache_entry); 326 bool CheckEntry(EntryImpl* cache_entry);
316 327
328 // Returns the maximum total memory for the memory buffers.
329 int MaxBuffersSize();
330
317 InFlightBackendIO background_queue_; // The controller of pending operations. 331 InFlightBackendIO background_queue_; // The controller of pending operations.
318 scoped_refptr<MappedFile> index_; // The main cache index. 332 scoped_refptr<MappedFile> index_; // The main cache index.
319 FilePath path_; // Path to the folder used as backing storage. 333 FilePath path_; // Path to the folder used as backing storage.
320 Index* data_; // Pointer to the index data. 334 Index* data_; // Pointer to the index data.
321 BlockFiles block_files_; // Set of files used to store all data. 335 BlockFiles block_files_; // Set of files used to store all data.
322 Rankings rankings_; // Rankings to be able to trim the cache. 336 Rankings rankings_; // Rankings to be able to trim the cache.
323 uint32 mask_; // Binary mask to map a hash to the hash table. 337 uint32 mask_; // Binary mask to map a hash to the hash table.
324 int32 max_size_; // Maximum data size for this instance. 338 int32 max_size_; // Maximum data size for this instance.
325 Eviction eviction_; // Handler of the eviction algorithm. 339 Eviction eviction_; // Handler of the eviction algorithm.
326 EntriesMap open_entries_; // Map of open entries. 340 EntriesMap open_entries_; // Map of open entries.
327 int num_refs_; // Number of referenced cache entries. 341 int num_refs_; // Number of referenced cache entries.
328 int max_refs_; // Max number of referenced cache entries. 342 int max_refs_; // Max number of referenced cache entries.
329 int num_pending_io_; // Number of pending IO operations. 343 int num_pending_io_; // Number of pending IO operations.
330 int entry_count_; // Number of entries accessed lately. 344 int entry_count_; // Number of entries accessed lately.
331 int byte_count_; // Number of bytes read/written lately. 345 int byte_count_; // Number of bytes read/written lately.
346 int buffer_bytes_; // Total size of the temporary entries' buffers.
332 net::CacheType cache_type_; 347 net::CacheType cache_type_;
333 int uma_report_; // Controls transmision of UMA data. 348 int uma_report_; // Controls transmision of UMA data.
334 uint32 user_flags_; // Flags set by the user. 349 uint32 user_flags_; // Flags set by the user.
335 bool init_; // controls the initialization of the system. 350 bool init_; // controls the initialization of the system.
336 bool restarted_; 351 bool restarted_;
337 bool unit_test_; 352 bool unit_test_;
338 bool read_only_; // Prevents updates of the rankings data (used by tools). 353 bool read_only_; // Prevents updates of the rankings data (used by tools).
339 bool disabled_; 354 bool disabled_;
340 bool new_eviction_; // What eviction algorithm should be used. 355 bool new_eviction_; // What eviction algorithm should be used.
341 bool first_timer_; // True if the timer has not been called. 356 bool first_timer_; // True if the timer has not been called.
342 357
343 Stats stats_; // Usage statistcs. 358 Stats stats_; // Usage statistcs.
344 base::RepeatingTimer<BackendImpl> timer_; // Usage timer. 359 base::RepeatingTimer<BackendImpl> timer_; // Usage timer.
345 base::WaitableEvent done_; // Signals the end of background work. 360 base::WaitableEvent done_; // Signals the end of background work.
346 scoped_refptr<TraceObject> trace_object_; // Inits internal tracing. 361 scoped_refptr<TraceObject> trace_object_; // Inits internal tracing.
347 ScopedRunnableMethodFactory<BackendImpl> factory_; 362 ScopedRunnableMethodFactory<BackendImpl> factory_;
348 base::WeakPtrFactory<BackendImpl> ptr_factory_; 363 base::WeakPtrFactory<BackendImpl> ptr_factory_;
349 364
350 DISALLOW_COPY_AND_ASSIGN(BackendImpl); 365 DISALLOW_COPY_AND_ASSIGN(BackendImpl);
351 }; 366 };
352 367
353 // Returns the prefered max cache size given the available disk space. 368 // Returns the prefered max cache size given the available disk space.
354 int PreferedCacheSize(int64 available); 369 int PreferedCacheSize(int64 available);
355 370
356 } // namespace disk_cache 371 } // namespace disk_cache
357 372
358 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_ 373 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/backend_impl.cc » ('j') | net/disk_cache/backend_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698