| 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_INDEX_FILE_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_ |
| 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 uint64_t entry_count, | 60 uint64_t entry_count, |
| 61 uint64_t cache_size); | 61 uint64_t cache_size); |
| 62 | 62 |
| 63 virtual void Serialize(base::Pickle* pickle) const; | 63 virtual void Serialize(base::Pickle* pickle) const; |
| 64 bool Deserialize(base::PickleIterator* it); | 64 bool Deserialize(base::PickleIterator* it); |
| 65 | 65 |
| 66 bool CheckIndexMetadata(); | 66 bool CheckIndexMetadata(); |
| 67 | 67 |
| 68 SimpleIndex::IndexWriteToDiskReason reason() const { return reason_; } | 68 SimpleIndex::IndexWriteToDiskReason reason() const { return reason_; } |
| 69 uint64_t entry_count() const { return entry_count_; } | 69 uint64_t entry_count() const { return entry_count_; } |
| 70 bool has_entry_in_memory_data() const { return version_ >= 8; } |
| 70 | 71 |
| 71 private: | 72 private: |
| 72 FRIEND_TEST_ALL_PREFIXES(IndexMetadataTest, Basics); | 73 FRIEND_TEST_ALL_PREFIXES(IndexMetadataTest, Basics); |
| 73 FRIEND_TEST_ALL_PREFIXES(IndexMetadataTest, Serialize); | 74 FRIEND_TEST_ALL_PREFIXES(IndexMetadataTest, Serialize); |
| 74 FRIEND_TEST_ALL_PREFIXES(IndexMetadataTest, ReadV6Format); | 75 FRIEND_TEST_ALL_PREFIXES(IndexMetadataTest, ReadV6Format); |
| 76 FRIEND_TEST_ALL_PREFIXES(SimpleIndexFileTest, ReadV7Format); |
| 75 friend class V6IndexMetadataForTest; | 77 friend class V6IndexMetadataForTest; |
| 78 friend class V7IndexMetadataForTest; |
| 76 | 79 |
| 77 uint64_t magic_number_; | 80 uint64_t magic_number_; |
| 78 uint32_t version_; | 81 uint32_t version_; |
| 79 SimpleIndex::IndexWriteToDiskReason reason_; | 82 SimpleIndex::IndexWriteToDiskReason reason_; |
| 80 uint64_t entry_count_; | 83 uint64_t entry_count_; |
| 81 uint64_t cache_size_; // Total cache storage size in bytes. | 84 uint64_t cache_size_; // Total cache storage size in bytes. |
| 82 }; | 85 }; |
| 83 | 86 |
| 84 SimpleIndexFile(const scoped_refptr<base::SequencedTaskRunner>& cache_runner, | 87 SimpleIndexFile(const scoped_refptr<base::SequencedTaskRunner>& cache_runner, |
| 85 const scoped_refptr<base::TaskRunner>& worker_pool, | 88 const scoped_refptr<base::TaskRunner>& worker_pool, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 static const char kIndexFileName[]; | 198 static const char kIndexFileName[]; |
| 196 static const char kTempIndexFileName[]; | 199 static const char kTempIndexFileName[]; |
| 197 | 200 |
| 198 DISALLOW_COPY_AND_ASSIGN(SimpleIndexFile); | 201 DISALLOW_COPY_AND_ASSIGN(SimpleIndexFile); |
| 199 }; | 202 }; |
| 200 | 203 |
| 201 | 204 |
| 202 } // namespace disk_cache | 205 } // namespace disk_cache |
| 203 | 206 |
| 204 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_ | 207 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_ |
| OLD | NEW |