OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 26 matching lines...) Expand all Loading... |
37 SimpleEntryStat(base::Time last_used, | 37 SimpleEntryStat(base::Time last_used, |
38 base::Time last_modified, | 38 base::Time last_modified, |
39 const int32 data_size[], | 39 const int32 data_size[], |
40 const int32 sparse_data_size); | 40 const int32 sparse_data_size); |
41 | 41 |
42 int GetOffsetInFile(const std::string& key, | 42 int GetOffsetInFile(const std::string& key, |
43 int offset, | 43 int offset, |
44 int stream_index) const; | 44 int stream_index) const; |
45 int GetEOFOffsetInFile(const std::string& key, int stream_index) const; | 45 int GetEOFOffsetInFile(const std::string& key, int stream_index) const; |
46 int GetLastEOFOffsetInFile(const std::string& key, int file_index) const; | 46 int GetLastEOFOffsetInFile(const std::string& key, int file_index) const; |
47 int GetFileSize(const std::string& key, int file_index) const; | 47 int64 GetFileSize(const std::string& key, int file_index) const; |
48 | 48 |
49 base::Time last_used() const { return last_used_; } | 49 base::Time last_used() const { return last_used_; } |
50 base::Time last_modified() const { return last_modified_; } | 50 base::Time last_modified() const { return last_modified_; } |
51 void set_last_used(base::Time last_used) { last_used_ = last_used; } | 51 void set_last_used(base::Time last_used) { last_used_ = last_used; } |
52 void set_last_modified(base::Time last_modified) { | 52 void set_last_modified(base::Time last_modified) { |
53 last_modified_ = last_modified; | 53 last_modified_ = last_modified; |
54 } | 54 } |
55 | 55 |
56 int32 data_size(int stream_index) const { return data_size_[stream_index]; } | 56 int32 data_size(int stream_index) const { return data_size_[stream_index]; } |
57 void set_data_size(int stream_index, int data_size) { | 57 void set_data_size(int stream_index, int data_size) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 const SimpleEntryStat& entry_stat, | 151 const SimpleEntryStat& entry_stat, |
152 uint32 expected_crc32, | 152 uint32 expected_crc32, |
153 int* out_result) const; | 153 int* out_result) const; |
154 | 154 |
155 void ReadSparseData(const EntryOperationData& in_entry_op, | 155 void ReadSparseData(const EntryOperationData& in_entry_op, |
156 net::IOBuffer* out_buf, | 156 net::IOBuffer* out_buf, |
157 base::Time* out_last_used, | 157 base::Time* out_last_used, |
158 int* out_result); | 158 int* out_result); |
159 void WriteSparseData(const EntryOperationData& in_entry_op, | 159 void WriteSparseData(const EntryOperationData& in_entry_op, |
160 net::IOBuffer* in_buf, | 160 net::IOBuffer* in_buf, |
161 int64 max_sparse_data_size, | 161 uint64 max_sparse_data_size, |
162 SimpleEntryStat* out_entry_stat, | 162 SimpleEntryStat* out_entry_stat, |
163 int* out_result); | 163 int* out_result); |
164 void GetAvailableRange(const EntryOperationData& in_entry_op, | 164 void GetAvailableRange(const EntryOperationData& in_entry_op, |
165 int64* out_start, | 165 int64* out_start, |
166 int* out_result); | 166 int* out_result); |
167 | 167 |
168 // Close all streams, and add write EOF records to streams indicated by the | 168 // Close all streams, and add write EOF records to streams indicated by the |
169 // CRCRecord entries in |crc32s_to_write|. | 169 // CRCRecord entries in |crc32s_to_write|. |
170 void Close(const SimpleEntryStat& entry_stat, | 170 void Close(const SimpleEntryStat& entry_stat, |
171 scoped_ptr<std::vector<CRCRecord> > crc32s_to_write, | 171 scoped_ptr<std::vector<CRCRecord> > crc32s_to_write, |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 int64 sparse_tail_offset_; | 331 int64 sparse_tail_offset_; |
332 | 332 |
333 // True if the entry was created, or false if it was opened. Used to log | 333 // True if the entry was created, or false if it was opened. Used to log |
334 // SimpleCache.*.EntryCreatedWithStream2Omitted only for created entries. | 334 // SimpleCache.*.EntryCreatedWithStream2Omitted only for created entries. |
335 bool files_created_; | 335 bool files_created_; |
336 }; | 336 }; |
337 | 337 |
338 } // namespace disk_cache | 338 } // namespace disk_cache |
339 | 339 |
340 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ | 340 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
OLD | NEW |