OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 // Loads the external file to this object's memory buffer. | 144 // Loads the external file to this object's memory buffer. |
145 bool ImportSeparateFile(int index, int offset, int buf_len); | 145 bool ImportSeparateFile(int index, int offset, int buf_len); |
146 | 146 |
147 // Flush the in-memory data to the backing storage. | 147 // Flush the in-memory data to the backing storage. |
148 bool Flush(int index, int size, bool async); | 148 bool Flush(int index, int size, bool async); |
149 | 149 |
150 // Initializes the sparse control object. Returns a net error code. | 150 // Initializes the sparse control object. Returns a net error code. |
151 int InitSparseData(); | 151 int InitSparseData(); |
152 | 152 |
| 153 // Adds the provided |flags| to the current EntryFlags for this entry. |
| 154 void SetEntryFlags(uint32 flags); |
| 155 |
| 156 // Returns the current EntryFlags for this entry. |
| 157 uint32 GetEntryFlags(); |
| 158 |
| 159 // Gets the data stored at the given index. If the information is in memory, |
| 160 // a buffer will be allocated and the data will be copied to it (the caller |
| 161 // can find out the size of the buffer before making this call). Otherwise, |
| 162 // the cache address of the data will be returned, and that address will be |
| 163 // removed from the regular book keeping of this entry so the caller is |
| 164 // responsible for deleting the block (or file) from the backing store at some |
| 165 // point; there is no need to report any storage-size change, only to do the |
| 166 // actual cleanup. |
| 167 void GetData(int index, char** buffer, Addr* address); |
| 168 |
153 // Generates a histogram for the time spent working on this operation. | 169 // Generates a histogram for the time spent working on this operation. |
154 void ReportIOTime(Operation op, const base::Time& start); | 170 void ReportIOTime(Operation op, const base::Time& start); |
155 | 171 |
156 // Logs this entry to the internal trace buffer. | 172 // Logs this entry to the internal trace buffer. |
157 void Log(const char* msg); | 173 void Log(const char* msg); |
158 | 174 |
159 CacheEntryBlock entry_; // Key related information for this entry. | 175 CacheEntryBlock entry_; // Key related information for this entry. |
160 CacheRankingsBlock node_; // Rankings related information for this entry. | 176 CacheRankingsBlock node_; // Rankings related information for this entry. |
161 BackendImpl* backend_; // Back pointer to the cache. | 177 BackendImpl* backend_; // Back pointer to the cache. |
162 scoped_array<char> user_buffers_[kNumStreams]; // Store user data. | 178 scoped_array<char> user_buffers_[kNumStreams]; // Store user data. |
163 scoped_refptr<File> files_[kNumStreams + 1]; // Files to store external | 179 scoped_refptr<File> files_[kNumStreams + 1]; // Files to store external |
164 // user data and key. | 180 // user data and key. |
165 int unreported_size_[kNumStreams]; // Bytes not reported yet to the backend. | 181 int unreported_size_[kNumStreams]; // Bytes not reported yet to the backend. |
166 bool doomed_; // True if this entry was removed from the cache. | 182 bool doomed_; // True if this entry was removed from the cache. |
167 scoped_ptr<SparseControl> sparse_; // Support for sparse entries. | 183 scoped_ptr<SparseControl> sparse_; // Support for sparse entries. |
168 | 184 |
169 DISALLOW_EVIL_CONSTRUCTORS(EntryImpl); | 185 DISALLOW_EVIL_CONSTRUCTORS(EntryImpl); |
170 }; | 186 }; |
171 | 187 |
172 } // namespace disk_cache | 188 } // namespace disk_cache |
173 | 189 |
174 #endif // NET_DISK_CACHE_ENTRY_IMPL_H_ | 190 #endif // NET_DISK_CACHE_ENTRY_IMPL_H_ |
OLD | NEW |