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_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ |
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 private: | 62 private: |
63 friend class SimpleIndexFileTest; | 63 friend class SimpleIndexFileTest; |
64 | 64 |
65 // There are tens of thousands of instances of EntryMetadata in memory, so the | 65 // There are tens of thousands of instances of EntryMetadata in memory, so the |
66 // size of each entry matters. Even when the values used to set these members | 66 // size of each entry matters. Even when the values used to set these members |
67 // are originally calculated as >32-bit types, the actual necessary size for | 67 // are originally calculated as >32-bit types, the actual necessary size for |
68 // each shouldn't exceed 32 bits, so we use 32-bit types here. | 68 // each shouldn't exceed 32 bits, so we use 32-bit types here. |
69 uint32 last_used_time_seconds_since_epoch_; | 69 uint32 last_used_time_seconds_since_epoch_; |
70 int32 entry_size_; // Storage size in bytes. | 70 int32 entry_size_; // Storage size in bytes. |
71 }; | 71 }; |
72 COMPILE_ASSERT(sizeof(EntryMetadata) == 8, metadata_size); | 72 static_assert(sizeof(EntryMetadata) == 8, "incorrect metadata size"); |
73 | 73 |
74 // This class is not Thread-safe. | 74 // This class is not Thread-safe. |
75 class NET_EXPORT_PRIVATE SimpleIndex | 75 class NET_EXPORT_PRIVATE SimpleIndex |
76 : public base::SupportsWeakPtr<SimpleIndex> { | 76 : public base::SupportsWeakPtr<SimpleIndex> { |
77 public: | 77 public: |
78 typedef std::vector<uint64> HashList; | 78 typedef std::vector<uint64> HashList; |
79 | 79 |
80 SimpleIndex(const scoped_refptr<base::SingleThreadTaskRunner>& io_thread, | 80 SimpleIndex(const scoped_refptr<base::SingleThreadTaskRunner>& io_thread, |
81 SimpleIndexDelegate* delegate, | 81 SimpleIndexDelegate* delegate, |
82 net::CacheType cache_type, | 82 net::CacheType cache_type, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 // Set to true when the app is on the background. When the app is in the | 194 // Set to true when the app is on the background. When the app is in the |
195 // background we can write the index much more frequently, to insure fresh | 195 // background we can write the index much more frequently, to insure fresh |
196 // index on next startup. | 196 // index on next startup. |
197 bool app_on_background_; | 197 bool app_on_background_; |
198 }; | 198 }; |
199 | 199 |
200 } // namespace disk_cache | 200 } // namespace disk_cache |
201 | 201 |
202 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ | 202 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ |
OLD | NEW |