| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> |
| 12 #include <string> | 13 #include <string> |
| 13 #include <utility> | 14 #include <utility> |
| 14 #include <vector> | 15 #include <vector> |
| 15 | 16 |
| 16 #include "base/files/file.h" | 17 #include "base/files/file.h" |
| 17 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
| 18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/scoped_ptr.h" | |
| 20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "net/base/cache_type.h" | 21 #include "net/base/cache_type.h" |
| 22 #include "net/base/net_export.h" | 22 #include "net/base/net_export.h" |
| 23 #include "net/disk_cache/simple/simple_entry_format.h" | 23 #include "net/disk_cache/simple/simple_entry_format.h" |
| 24 | 24 |
| 25 namespace net { | 25 namespace net { |
| 26 class GrowableIOBuffer; | 26 class GrowableIOBuffer; |
| 27 class IOBuffer; | 27 class IOBuffer; |
| 28 } | 28 } |
| 29 | 29 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 uint64_t max_sparse_data_size, | 169 uint64_t max_sparse_data_size, |
| 170 SimpleEntryStat* out_entry_stat, | 170 SimpleEntryStat* out_entry_stat, |
| 171 int* out_result); | 171 int* out_result); |
| 172 void GetAvailableRange(const EntryOperationData& in_entry_op, | 172 void GetAvailableRange(const EntryOperationData& in_entry_op, |
| 173 int64_t* out_start, | 173 int64_t* out_start, |
| 174 int* out_result); | 174 int* out_result); |
| 175 | 175 |
| 176 // Close all streams, and add write EOF records to streams indicated by the | 176 // Close all streams, and add write EOF records to streams indicated by the |
| 177 // CRCRecord entries in |crc32s_to_write|. | 177 // CRCRecord entries in |crc32s_to_write|. |
| 178 void Close(const SimpleEntryStat& entry_stat, | 178 void Close(const SimpleEntryStat& entry_stat, |
| 179 scoped_ptr<std::vector<CRCRecord> > crc32s_to_write, | 179 std::unique_ptr<std::vector<CRCRecord>> crc32s_to_write, |
| 180 net::GrowableIOBuffer* stream_0_data); | 180 net::GrowableIOBuffer* stream_0_data); |
| 181 | 181 |
| 182 const base::FilePath& path() const { return path_; } | 182 const base::FilePath& path() const { return path_; } |
| 183 std::string key() const { return key_; } | 183 std::string key() const { return key_; } |
| 184 | 184 |
| 185 private: | 185 private: |
| 186 enum CreateEntryResult { | 186 enum CreateEntryResult { |
| 187 CREATE_ENTRY_SUCCESS = 0, | 187 CREATE_ENTRY_SUCCESS = 0, |
| 188 CREATE_ENTRY_PLATFORM_FILE_ERROR = 1, | 188 CREATE_ENTRY_PLATFORM_FILE_ERROR = 1, |
| 189 CREATE_ENTRY_CANT_WRITE_HEADER = 2, | 189 CREATE_ENTRY_CANT_WRITE_HEADER = 2, |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 int64_t sparse_tail_offset_; | 340 int64_t sparse_tail_offset_; |
| 341 | 341 |
| 342 // True if the entry was created, or false if it was opened. Used to log | 342 // True if the entry was created, or false if it was opened. Used to log |
| 343 // SimpleCache.*.EntryCreatedWithStream2Omitted only for created entries. | 343 // SimpleCache.*.EntryCreatedWithStream2Omitted only for created entries. |
| 344 bool files_created_; | 344 bool files_created_; |
| 345 }; | 345 }; |
| 346 | 346 |
| 347 } // namespace disk_cache | 347 } // namespace disk_cache |
| 348 | 348 |
| 349 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ | 349 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
| OLD | NEW |