Index: net/disk_cache/blockfile/entry_impl.h |
diff --git a/net/disk_cache/blockfile/entry_impl.h b/net/disk_cache/blockfile/entry_impl.h |
index c0b332b7168e25d41bf624d4fb05e875ed2a4f7d..54a551f74f19086ce6e41eb3c8c9b0bffbfad59d 100644 |
--- a/net/disk_cache/blockfile/entry_impl.h |
+++ b/net/disk_cache/blockfile/entry_impl.h |
@@ -22,11 +22,11 @@ typedef StorageBlock<RankingsNode> CacheRankingsBlock; |
// This class implements the Entry interface. An object of this |
// class represents a single entry on the cache. |
-class NET_EXPORT_PRIVATE EntryImpl |
- : public Entry, |
- public base::RefCounted<EntryImpl> { |
+class NET_EXPORT_PRIVATE EntryImpl : public Entry, |
+ public base::RefCounted<EntryImpl> { |
friend class base::RefCounted<EntryImpl>; |
friend class SparseControl; |
+ |
public: |
enum Operation { |
kRead, |
@@ -42,25 +42,32 @@ class NET_EXPORT_PRIVATE EntryImpl |
// Background implementation of the Entry interface. |
void DoomImpl(); |
- int ReadDataImpl(int index, int offset, IOBuffer* buf, int buf_len, |
+ int ReadDataImpl(int index, |
+ int offset, |
+ IOBuffer* buf, |
+ int buf_len, |
const CompletionCallback& callback); |
- int WriteDataImpl(int index, int offset, IOBuffer* buf, int buf_len, |
- const CompletionCallback& callback, bool truncate); |
- int ReadSparseDataImpl(int64 offset, IOBuffer* buf, int buf_len, |
+ int WriteDataImpl(int index, |
+ int offset, |
+ IOBuffer* buf, |
+ int buf_len, |
+ const CompletionCallback& callback, |
+ bool truncate); |
+ int ReadSparseDataImpl(int64 offset, |
+ IOBuffer* buf, |
+ int buf_len, |
const CompletionCallback& callback); |
- int WriteSparseDataImpl(int64 offset, IOBuffer* buf, int buf_len, |
+ int WriteSparseDataImpl(int64 offset, |
+ IOBuffer* buf, |
+ int buf_len, |
const CompletionCallback& callback); |
int GetAvailableRangeImpl(int64 offset, int len, int64* start); |
void CancelSparseIOImpl(); |
int ReadyForSparseIOImpl(const CompletionCallback& callback); |
- inline CacheEntryBlock* entry() { |
- return &entry_; |
- } |
+ inline CacheEntryBlock* entry() { return &entry_; } |
- inline CacheRankingsBlock* rankings() { |
- return &node_; |
- } |
+ inline CacheRankingsBlock* rankings() { return &node_; } |
uint32 GetHash(); |
@@ -94,13 +101,9 @@ class NET_EXPORT_PRIVATE EntryImpl |
// is to be able to detect entries that are currently in use. |
bool Update(); |
- bool dirty() { |
- return dirty_; |
- } |
+ bool dirty() { return dirty_; } |
- bool doomed() { |
- return doomed_; |
- } |
+ bool doomed() { return doomed_; } |
// Marks this entry as dirty (in memory) if needed. This is intended only for |
// entries that are being read from disk, to be called during loading. |
@@ -153,35 +156,52 @@ class NET_EXPORT_PRIVATE EntryImpl |
virtual base::Time GetLastUsed() const OVERRIDE; |
virtual base::Time GetLastModified() const OVERRIDE; |
virtual int32 GetDataSize(int index) const OVERRIDE; |
- virtual int ReadData(int index, int offset, IOBuffer* buf, int buf_len, |
+ virtual int ReadData(int index, |
+ int offset, |
+ IOBuffer* buf, |
+ int buf_len, |
const CompletionCallback& callback) OVERRIDE; |
- virtual int WriteData(int index, int offset, IOBuffer* buf, int buf_len, |
+ virtual int WriteData(int index, |
+ int offset, |
+ IOBuffer* buf, |
+ int buf_len, |
const CompletionCallback& callback, |
bool truncate) OVERRIDE; |
- virtual int ReadSparseData(int64 offset, IOBuffer* buf, int buf_len, |
+ virtual int ReadSparseData(int64 offset, |
+ IOBuffer* buf, |
+ int buf_len, |
const CompletionCallback& callback) OVERRIDE; |
- virtual int WriteSparseData(int64 offset, IOBuffer* buf, int buf_len, |
+ virtual int WriteSparseData(int64 offset, |
+ IOBuffer* buf, |
+ int buf_len, |
const CompletionCallback& callback) OVERRIDE; |
- virtual int GetAvailableRange(int64 offset, int len, int64* start, |
+ virtual int GetAvailableRange(int64 offset, |
+ int len, |
+ int64* start, |
const CompletionCallback& callback) OVERRIDE; |
virtual bool CouldBeSparse() const OVERRIDE; |
virtual void CancelSparseIO() OVERRIDE; |
virtual int ReadyForSparseIO(const CompletionCallback& callback) OVERRIDE; |
private: |
- enum { |
- kNumStreams = 3 |
- }; |
+ enum { kNumStreams = 3 }; |
class UserBuffer; |
virtual ~EntryImpl(); |
// Do all the work for ReadDataImpl and WriteDataImpl. Implemented as |
// separate functions to make logging of results simpler. |
- int InternalReadData(int index, int offset, IOBuffer* buf, |
- int buf_len, const CompletionCallback& callback); |
- int InternalWriteData(int index, int offset, IOBuffer* buf, int buf_len, |
- const CompletionCallback& callback, bool truncate); |
+ int InternalReadData(int index, |
+ int offset, |
+ IOBuffer* buf, |
+ int buf_len, |
+ const CompletionCallback& callback); |
+ int InternalWriteData(int index, |
+ int offset, |
+ IOBuffer* buf, |
+ int buf_len, |
+ const CompletionCallback& callback, |
+ bool truncate); |
// Initializes the storage for an internal or external data block. |
bool CreateDataBlock(int index, int size); |
@@ -254,18 +274,18 @@ class NET_EXPORT_PRIVATE EntryImpl |
// Logs this entry to the internal trace buffer. |
void Log(const char* msg); |
- CacheEntryBlock entry_; // Key related information for this entry. |
- CacheRankingsBlock node_; // Rankings related information for this entry. |
+ CacheEntryBlock entry_; // Key related information for this entry. |
+ CacheRankingsBlock node_; // Rankings related information for this entry. |
base::WeakPtr<BackendImpl> backend_; // Back pointer to the cache. |
base::WeakPtr<InFlightBackendIO> background_queue_; // In-progress queue. |
- scoped_ptr<UserBuffer> user_buffers_[kNumStreams]; // Stores user data. |
+ scoped_ptr<UserBuffer> user_buffers_[kNumStreams]; // Stores user data. |
// Files to store external user data and key. |
scoped_refptr<File> files_[kNumStreams + 1]; |
mutable std::string key_; // Copy of the key. |
int unreported_size_[kNumStreams]; // Bytes not reported yet to the backend. |
- bool doomed_; // True if this entry was removed from the cache. |
- bool read_only_; // True if not yet writing. |
- bool dirty_; // True if we detected that this is a dirty entry. |
+ bool doomed_; // True if this entry was removed from the cache. |
+ bool read_only_; // True if not yet writing. |
+ bool dirty_; // True if we detected that this is a dirty entry. |
scoped_ptr<SparseControl> sparse_; // Support for sparse entries. |
net::BoundNetLog net_log_; |