| OLD | NEW |
| 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 #ifndef NET_DISK_CACHE_ENTRY_IMPL_H_ | 5 #ifndef NET_DISK_CACHE_ENTRY_IMPL_H_ |
| 6 #define NET_DISK_CACHE_ENTRY_IMPL_H_ | 6 #define NET_DISK_CACHE_ENTRY_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "net/disk_cache/disk_cache.h" | 9 #include "net/disk_cache/disk_cache.h" |
| 10 #include "net/disk_cache/storage_block.h" | 10 #include "net/disk_cache/storage_block.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 virtual int32 GetDataSize(int index) const; | 40 virtual int32 GetDataSize(int index) const; |
| 41 virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, | 41 virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, |
| 42 net::CompletionCallback* completion_callback); | 42 net::CompletionCallback* completion_callback); |
| 43 virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, | 43 virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, |
| 44 net::CompletionCallback* completion_callback, | 44 net::CompletionCallback* completion_callback, |
| 45 bool truncate); | 45 bool truncate); |
| 46 virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, | 46 virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, |
| 47 net::CompletionCallback* completion_callback); | 47 net::CompletionCallback* completion_callback); |
| 48 virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, | 48 virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, |
| 49 net::CompletionCallback* completion_callback); | 49 net::CompletionCallback* completion_callback); |
| 50 virtual int GetAvailableRange(int64 offset, int len, int64* start); | |
| 51 virtual int GetAvailableRange(int64 offset, int len, int64* start, | 50 virtual int GetAvailableRange(int64 offset, int len, int64* start, |
| 52 CompletionCallback* callback); | 51 CompletionCallback* callback); |
| 53 virtual bool CouldBeSparse() const; | 52 virtual bool CouldBeSparse() const; |
| 54 virtual void CancelSparseIO(); | 53 virtual void CancelSparseIO(); |
| 55 virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback); | 54 virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback); |
| 56 | 55 |
| 57 inline CacheEntryBlock* entry() { | 56 inline CacheEntryBlock* entry() { |
| 58 return &entry_; | 57 return &entry_; |
| 59 } | 58 } |
| 60 | 59 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // Generates a histogram for the time spent working on this operation. | 114 // Generates a histogram for the time spent working on this operation. |
| 116 void ReportIOTime(Operation op, const base::TimeTicks& start); | 115 void ReportIOTime(Operation op, const base::TimeTicks& start); |
| 117 | 116 |
| 118 private: | 117 private: |
| 119 enum { | 118 enum { |
| 120 kNumStreams = 3 | 119 kNumStreams = 3 |
| 121 }; | 120 }; |
| 122 | 121 |
| 123 ~EntryImpl(); | 122 ~EntryImpl(); |
| 124 | 123 |
| 124 // Old Entry interface. |
| 125 int GetAvailableRange(int64 offset, int len, int64* start); |
| 126 |
| 125 // Initializes the storage for an internal or external data block. | 127 // Initializes the storage for an internal or external data block. |
| 126 bool CreateDataBlock(int index, int size); | 128 bool CreateDataBlock(int index, int size); |
| 127 | 129 |
| 128 // Initializes the storage for an internal or external generic block. | 130 // Initializes the storage for an internal or external generic block. |
| 129 bool CreateBlock(int size, Addr* address); | 131 bool CreateBlock(int size, Addr* address); |
| 130 | 132 |
| 131 // Deletes the data pointed by address, maybe backed by files_[index]. | 133 // Deletes the data pointed by address, maybe backed by files_[index]. |
| 132 void DeleteData(Addr address, int index); | 134 void DeleteData(Addr address, int index); |
| 133 | 135 |
| 134 // Updates ranking information. | 136 // Updates ranking information. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 int unreported_size_[kNumStreams]; // Bytes not reported yet to the backend. | 191 int unreported_size_[kNumStreams]; // Bytes not reported yet to the backend. |
| 190 bool doomed_; // True if this entry was removed from the cache. | 192 bool doomed_; // True if this entry was removed from the cache. |
| 191 scoped_ptr<SparseControl> sparse_; // Support for sparse entries. | 193 scoped_ptr<SparseControl> sparse_; // Support for sparse entries. |
| 192 | 194 |
| 193 DISALLOW_COPY_AND_ASSIGN(EntryImpl); | 195 DISALLOW_COPY_AND_ASSIGN(EntryImpl); |
| 194 }; | 196 }; |
| 195 | 197 |
| 196 } // namespace disk_cache | 198 } // namespace disk_cache |
| 197 | 199 |
| 198 #endif // NET_DISK_CACHE_ENTRY_IMPL_H_ | 200 #endif // NET_DISK_CACHE_ENTRY_IMPL_H_ |
| OLD | NEW |