Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Side by Side Diff: net/disk_cache/blockfile/disk_format.h

Issue 826973002: replace COMPILE_ASSERT with static_assert in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // The cache is stored on disk as a collection of block-files, plus an index 5 // The cache is stored on disk as a collection of block-files, plus an index
6 // file plus a collection of external files. 6 // file plus a collection of external files.
7 // 7 //
8 // Any data blob bigger than kMaxBlockSize (disk_cache/addr.h) will be stored in 8 // Any data blob bigger than kMaxBlockSize (disk_cache/addr.h) will be stored in
9 // a separate file named f_xxx where x is a hexadecimal number. Shorter data 9 // a separate file named f_xxx where x is a hexadecimal number. Shorter data
10 // will be stored as a series of blocks on a block-file. In any case, CacheAddr 10 // will be stored as a series of blocks on a block-file. In any case, CacheAddr
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 int32 key_len; 109 int32 key_len;
110 CacheAddr long_key; // Optional address of a long key. 110 CacheAddr long_key; // Optional address of a long key.
111 int32 data_size[4]; // We can store up to 4 data streams for each 111 int32 data_size[4]; // We can store up to 4 data streams for each
112 CacheAddr data_addr[4]; // entry. 112 CacheAddr data_addr[4]; // entry.
113 uint32 flags; // Any combination of EntryFlags. 113 uint32 flags; // Any combination of EntryFlags.
114 int32 pad[4]; 114 int32 pad[4];
115 uint32 self_hash; // The hash of EntryStore up to this point. 115 uint32 self_hash; // The hash of EntryStore up to this point.
116 char key[256 - 24 * 4]; // null terminated 116 char key[256 - 24 * 4]; // null terminated
117 }; 117 };
118 118
119 COMPILE_ASSERT(sizeof(EntryStore) == 256, bad_EntyStore); 119 static_assert(sizeof(EntryStore) == 256, "bad EntyStore");
Deprecated (see juliatuttle) 2015/01/05 22:22:38 Fix typo ("EntyStore" -> "EntryStore") while you'r
Mostyn Bramley-Moore 2015/01/06 00:07:07 Done.
120 const int kMaxInternalKeyLength = 4 * sizeof(EntryStore) - 120 const int kMaxInternalKeyLength = 4 * sizeof(EntryStore) -
121 offsetof(EntryStore, key) - 1; 121 offsetof(EntryStore, key) - 1;
122 122
123 // Possible states for a given entry. 123 // Possible states for a given entry.
124 enum EntryState { 124 enum EntryState {
125 ENTRY_NORMAL = 0, 125 ENTRY_NORMAL = 0,
126 ENTRY_EVICTED, // The entry was recently evicted from the cache. 126 ENTRY_EVICTED, // The entry was recently evicted from the cache.
127 ENTRY_DOOMED // The entry was doomed. 127 ENTRY_DOOMED // The entry was doomed.
128 }; 128 };
129 129
130 // Flags that can be applied to an entry. 130 // Flags that can be applied to an entry.
131 enum EntryFlags { 131 enum EntryFlags {
132 PARENT_ENTRY = 1, // This entry has children (sparse) entries. 132 PARENT_ENTRY = 1, // This entry has children (sparse) entries.
133 CHILD_ENTRY = 1 << 1 // Child entry that stores sparse data. 133 CHILD_ENTRY = 1 << 1 // Child entry that stores sparse data.
134 }; 134 };
135 135
136 #pragma pack(push, 4) 136 #pragma pack(push, 4)
137 // Rankings information for a given entry. 137 // Rankings information for a given entry.
138 struct RankingsNode { 138 struct RankingsNode {
139 uint64 last_used; // LRU info. 139 uint64 last_used; // LRU info.
140 uint64 last_modified; // LRU info. 140 uint64 last_modified; // LRU info.
141 CacheAddr next; // LRU list. 141 CacheAddr next; // LRU list.
142 CacheAddr prev; // LRU list. 142 CacheAddr prev; // LRU list.
143 CacheAddr contents; // Address of the EntryStore. 143 CacheAddr contents; // Address of the EntryStore.
144 int32 dirty; // The entry is being modifyied. 144 int32 dirty; // The entry is being modifyied.
145 uint32 self_hash; // RankingsNode's hash. 145 uint32 self_hash; // RankingsNode's hash.
146 }; 146 };
147 #pragma pack(pop) 147 #pragma pack(pop)
148 148
149 COMPILE_ASSERT(sizeof(RankingsNode) == 36, bad_RankingsNode); 149 static_assert(sizeof(RankingsNode) == 36, "bad RankingsNode");
150 150
151 } // namespace disk_cache 151 } // namespace disk_cache
152 152
153 #endif // NET_DISK_CACHE_BLOCKFILE_DISK_FORMAT_H_ 153 #endif // NET_DISK_CACHE_BLOCKFILE_DISK_FORMAT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698