| 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_STORAGE_BLOCK_INL_H_ |
| 6 #define NET_DISK_CACHE_STORAGE_BLOCK_INL_H_ | 6 #define NET_DISK_CACHE_STORAGE_BLOCK_INL_H_ |
| 7 | 7 |
| 8 #include "net/disk_cache/storage_block.h" | 8 #include "net/disk_cache/storage_block.h" |
| 9 | 9 |
| 10 #include "base/hash.h" |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "net/disk_cache/hash.h" | |
| 12 #include "net/disk_cache/trace.h" | 12 #include "net/disk_cache/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; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 delete data_; | 160 delete data_; |
| 161 } else { | 161 } else { |
| 162 data_->~T(); | 162 data_->~T(); |
| 163 delete[] reinterpret_cast<char*>(data_); | 163 delete[] reinterpret_cast<char*>(data_); |
| 164 } | 164 } |
| 165 own_data_ = false; | 165 own_data_ = false; |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 template<typename T> uint32 StorageBlock<T>::CalculateHash() const { | 169 template<typename T> uint32 StorageBlock<T>::CalculateHash() const { |
| 170 return Hash(reinterpret_cast<char*>(data_), offsetof(T, self_hash)); | 170 return base::Hash(reinterpret_cast<char*>(data_), offsetof(T, self_hash)); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace disk_cache | 173 } // namespace disk_cache |
| 174 | 174 |
| 175 #endif // NET_DISK_CACHE_STORAGE_BLOCK_INL_H_ | 175 #endif // NET_DISK_CACHE_STORAGE_BLOCK_INL_H_ |
| OLD | NEW |