OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_STORAGE_BLOCK_INL_H_ | 5 #ifndef NET_DISK_CACHE_BLOCKFILE_STORAGE_BLOCK_INL_H_ |
6 #define NET_DISK_CACHE_STORAGE_BLOCK_INL_H_ | 6 #define NET_DISK_CACHE_BLOCKFILE_STORAGE_BLOCK_INL_H_ |
7 | 7 |
8 #include "net/disk_cache/storage_block.h" | 8 #include "net/disk_cache/blockfile/storage_block.h" |
9 | 9 |
10 #include "base/hash.h" | 10 #include "base/hash.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "net/disk_cache/trace.h" | 12 #include "net/disk_cache/blockfile/trace.h" |
13 | 13 |
14 namespace disk_cache { | 14 namespace disk_cache { |
15 | 15 |
16 template<typename T> StorageBlock<T>::StorageBlock(MappedFile* file, | 16 template<typename T> StorageBlock<T>::StorageBlock(MappedFile* file, |
17 Addr address) | 17 Addr address) |
18 : data_(NULL), file_(file), address_(address), modified_(false), | 18 : data_(NULL), file_(file), address_(address), modified_(false), |
19 own_data_(false), extended_(false) { | 19 own_data_(false), extended_(false) { |
20 if (address.num_blocks() > 1) | 20 if (address.num_blocks() > 1) |
21 extended_ = true; | 21 extended_ = true; |
22 DCHECK(!address.is_initialized() || sizeof(*data_) == address.BlockSize()); | 22 DCHECK(!address.is_initialized() || sizeof(*data_) == address.BlockSize()); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 own_data_ = false; | 195 own_data_ = false; |
196 } | 196 } |
197 } | 197 } |
198 | 198 |
199 template<typename T> uint32 StorageBlock<T>::CalculateHash() const { | 199 template<typename T> uint32 StorageBlock<T>::CalculateHash() const { |
200 return base::Hash(reinterpret_cast<char*>(data_), offsetof(T, self_hash)); | 200 return base::Hash(reinterpret_cast<char*>(data_), offsetof(T, self_hash)); |
201 } | 201 } |
202 | 202 |
203 } // namespace disk_cache | 203 } // namespace disk_cache |
204 | 204 |
205 #endif // NET_DISK_CACHE_STORAGE_BLOCK_INL_H_ | 205 #endif // NET_DISK_CACHE_BLOCKFILE_STORAGE_BLOCK_INL_H_ |
OLD | NEW |