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

Unified Diff: net/disk_cache/blockfile/backend_impl.h

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: net/disk_cache/blockfile/backend_impl.h
diff --git a/net/disk_cache/blockfile/backend_impl.h b/net/disk_cache/blockfile/backend_impl.h
index 3345258634751231dfbba14adeff7346ae5533c4..11b927031040c6cc440e33c76d0040213561c402 100644
--- a/net/disk_cache/blockfile/backend_impl.h
+++ b/net/disk_cache/blockfile/backend_impl.h
@@ -29,26 +29,30 @@ struct Index;
enum BackendFlags {
kNone = 0,
- kMask = 1, // A mask (for the index table) was specified.
- kMaxSize = 1 << 1, // A maximum size was provided.
- kUnitTestMode = 1 << 2, // We are modifying the behavior for testing.
- kUpgradeMode = 1 << 3, // This is the upgrade tool (dump).
- kNewEviction = 1 << 4, // Use of new eviction was specified.
- kNoRandom = 1 << 5, // Don't add randomness to the behavior.
- kNoLoadProtection = 1 << 6, // Don't act conservatively under load.
- kNoBuffering = 1 << 7 // Disable extended IO buffering.
+ kMask = 1, // A mask (for the index table) was specified.
+ kMaxSize = 1 << 1, // A maximum size was provided.
+ kUnitTestMode = 1 << 2, // We are modifying the behavior for testing.
+ kUpgradeMode = 1 << 3, // This is the upgrade tool (dump).
+ kNewEviction = 1 << 4, // Use of new eviction was specified.
+ kNoRandom = 1 << 5, // Don't add randomness to the behavior.
+ kNoLoadProtection = 1 << 6, // Don't act conservatively under load.
+ kNoBuffering = 1 << 7 // Disable extended IO buffering.
};
// This class implements the Backend interface. An object of this
// class handles the operations of the cache for a particular profile.
class NET_EXPORT_PRIVATE BackendImpl : public Backend {
friend class Eviction;
+
public:
- BackendImpl(const base::FilePath& path, base::MessageLoopProxy* cache_thread,
+ BackendImpl(const base::FilePath& path,
+ base::MessageLoopProxy* cache_thread,
net::NetLog* net_log);
// mask can be used to limit the usable size of the hash table, for testing.
- BackendImpl(const base::FilePath& path, uint32 mask,
- base::MessageLoopProxy* cache_thread, net::NetLog* net_log);
+ BackendImpl(const base::FilePath& path,
+ uint32 mask,
+ base::MessageLoopProxy* cache_thread,
+ net::NetLog* net_log);
virtual ~BackendImpl();
// Performs general initialization for this current instance of the cache.
@@ -59,7 +63,8 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
void CleanupCache();
// Same behavior as OpenNextEntry but walks the list from back to front.
- int OpenPrevEntry(void** iter, Entry** prev_entry,
+ int OpenPrevEntry(void** iter,
+ Entry** prev_entry,
const CompletionCallback& callback);
// Synchronous implementation of the asynchronous interface.
@@ -67,8 +72,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
int SyncCreateEntry(const std::string& key, Entry** entry);
int SyncDoomEntry(const std::string& key);
int SyncDoomAllEntries();
- int SyncDoomEntriesBetween(base::Time initial_time,
- base::Time end_time);
+ int SyncDoomEntriesBetween(base::Time initial_time, base::Time end_time);
int SyncDoomEntriesSince(base::Time initial_time);
int SyncOpenNextEntry(void** iter, Entry** next_entry);
int SyncOpenPrevEntry(void** iter, Entry** prev_entry);
@@ -100,8 +104,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
bool CreateExternalFile(Addr* address);
// Creates a new storage block of size block_count.
- bool CreateBlock(FileType block_type, int block_count,
- Addr* block_address);
+ bool CreateBlock(FileType block_type, int block_count, Addr* block_address);
// Deletes a given storage block. deep set to true can be used to zero-fill
// the related storage in addition of releasing the related block.
@@ -164,9 +167,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
void BufferDeleted(int size);
// Only intended for testing the two previous methods.
- int GetTotalBuffersSize() const {
- return buffer_bytes_;
- }
+ int GetTotalBuffersSize() const { return buffer_bytes_; }
// Returns true if this instance seems to be under heavy load.
bool IsLoaded() const;
@@ -176,13 +177,9 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
// is the cache type and e the provided |experiment|.
std::string HistogramName(const char* name, int experiment) const;
- net::CacheType cache_type() const {
- return cache_type_;
- }
+ net::CacheType cache_type() const { return cache_type_; }
- bool read_only() const {
- return read_only_;
- }
+ bool read_only() const { return read_only_; }
// Returns a weak pointer to this object.
base::WeakPtr<BackendImpl> GetWeakPtr();
@@ -259,9 +256,11 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
// Backend implementation.
virtual net::CacheType GetCacheType() const OVERRIDE;
virtual int32 GetEntryCount() const OVERRIDE;
- virtual int OpenEntry(const std::string& key, Entry** entry,
+ virtual int OpenEntry(const std::string& key,
+ Entry** entry,
const CompletionCallback& callback) OVERRIDE;
- virtual int CreateEntry(const std::string& key, Entry** entry,
+ virtual int CreateEntry(const std::string& key,
+ Entry** entry,
const CompletionCallback& callback) OVERRIDE;
virtual int DoomEntry(const std::string& key,
const CompletionCallback& callback) OVERRIDE;
@@ -271,7 +270,8 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
const CompletionCallback& callback) OVERRIDE;
virtual int DoomEntriesSince(base::Time initial_time,
const CompletionCallback& callback) OVERRIDE;
- virtual int OpenNextEntry(void** iter, Entry** next_entry,
+ virtual int OpenNextEntry(void** iter,
+ Entry** next_entry,
const CompletionCallback& callback) OVERRIDE;
virtual void EndEnumeration(void** iter) OVERRIDE;
virtual void GetStats(StatsItems* stats) OVERRIDE;
@@ -303,8 +303,11 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
// if it doesn't match the entry on the index, we know that it was replaced
// with a new entry; in this case |*match_error| will be set to true and the
// return value will be NULL.
- EntryImpl* MatchEntry(const std::string& key, uint32 hash, bool find_parent,
- Addr entry_addr, bool* match_error);
+ EntryImpl* MatchEntry(const std::string& key,
+ uint32 hash,
+ bool find_parent,
+ Addr entry_addr,
+ bool* match_error);
// Opens the next or previous entry on a cache iteration.
EntryImpl* OpenFollowingEntry(bool forward, void** iter);
@@ -312,7 +315,8 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
// Opens the next or previous entry on a single list. If successful,
// |from_entry| will be updated to point to the new entry, otherwise it will
// be set to NULL; in other words, it is used as an explicit iterator.
- bool OpenFollowingEntryFromList(bool forward, Rankings::List list,
+ bool OpenFollowingEntryFromList(bool forward,
+ Rankings::List list,
CacheRankingsBlock** from_entry,
EntryImpl** next_entry);
@@ -356,37 +360,37 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
int MaxBuffersSize();
InFlightBackendIO background_queue_; // The controller of pending operations.
- scoped_refptr<MappedFile> index_; // The main cache index.
- base::FilePath path_; // Path to the folder used as backing storage.
- Index* data_; // Pointer to the index data.
- BlockFiles block_files_; // Set of files used to store all data.
- Rankings rankings_; // Rankings to be able to trim the cache.
- uint32 mask_; // Binary mask to map a hash to the hash table.
- int32 max_size_; // Maximum data size for this instance.
- Eviction eviction_; // Handler of the eviction algorithm.
+ scoped_refptr<MappedFile> index_; // The main cache index.
+ base::FilePath path_; // Path to the folder used as backing storage.
+ Index* data_; // Pointer to the index data.
+ BlockFiles block_files_; // Set of files used to store all data.
+ Rankings rankings_; // Rankings to be able to trim the cache.
+ uint32 mask_; // Binary mask to map a hash to the hash table.
+ int32 max_size_; // Maximum data size for this instance.
+ Eviction eviction_; // Handler of the eviction algorithm.
EntriesMap open_entries_; // Map of open entries.
- int num_refs_; // Number of referenced cache entries.
- int max_refs_; // Max number of referenced cache entries.
- int num_pending_io_; // Number of pending IO operations.
- int entry_count_; // Number of entries accessed lately.
- int byte_count_; // Number of bytes read/written lately.
- int buffer_bytes_; // Total size of the temporary entries' buffers.
+ int num_refs_; // Number of referenced cache entries.
+ int max_refs_; // Max number of referenced cache entries.
+ int num_pending_io_; // Number of pending IO operations.
+ int entry_count_; // Number of entries accessed lately.
+ int byte_count_; // Number of bytes read/written lately.
+ int buffer_bytes_; // Total size of the temporary entries' buffers.
int up_ticks_; // The number of timer ticks received (OnStatsTimer).
net::CacheType cache_type_;
- int uma_report_; // Controls transmission of UMA data.
+ int uma_report_; // Controls transmission of UMA data.
uint32 user_flags_; // Flags set by the user.
- bool init_; // controls the initialization of the system.
+ bool init_; // controls the initialization of the system.
bool restarted_;
bool unit_test_;
bool read_only_; // Prevents updates of the rankings data (used by tools).
bool disabled_;
bool new_eviction_; // What eviction algorithm should be used.
- bool first_timer_; // True if the timer has not been called.
- bool user_load_; // True if we see a high load coming from the caller.
+ bool first_timer_; // True if the timer has not been called.
+ bool user_load_; // True if we see a high load coming from the caller.
net::NetLog* net_log_;
- Stats stats_; // Usage statistics.
+ Stats stats_; // Usage statistics.
scoped_ptr<base::RepeatingTimer<BackendImpl> > timer_; // Usage timer.
base::WaitableEvent done_; // Signals the end of background work.
scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing.

Powered by Google App Engine
This is Rietveld 408576698