| OLD | NEW |
| 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "net/disk_cache/storage_block.h" | 9 #include "net/disk_cache/storage_block.h" |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return; | 82 return; |
| 83 DCHECK(!modified_); | 83 DCHECK(!modified_); |
| 84 data_ = NULL; | 84 data_ = NULL; |
| 85 } | 85 } |
| 86 | 86 |
| 87 template<typename T> void StorageBlock<T>::set_modified() { | 87 template<typename T> void StorageBlock<T>::set_modified() { |
| 88 DCHECK(data_); | 88 DCHECK(data_); |
| 89 modified_ = true; | 89 modified_ = true; |
| 90 } | 90 } |
| 91 | 91 |
| 92 template<typename T> void StorageBlock<T>::clear_modified() { |
| 93 modified_ = false; |
| 94 } |
| 95 |
| 92 template<typename T> T* StorageBlock<T>::Data() { | 96 template<typename T> T* StorageBlock<T>::Data() { |
| 93 if (!data_) | 97 if (!data_) |
| 94 AllocateData(); | 98 AllocateData(); |
| 95 return data_; | 99 return data_; |
| 96 } | 100 } |
| 97 | 101 |
| 98 template<typename T> bool StorageBlock<T>::HasData() const { | 102 template<typename T> bool StorageBlock<T>::HasData() const { |
| 99 return (NULL != data_); | 103 return (NULL != data_); |
| 100 } | 104 } |
| 101 | 105 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 167 } |
| 164 } | 168 } |
| 165 | 169 |
| 166 template<typename T> uint32 StorageBlock<T>::CalculateHash() const { | 170 template<typename T> uint32 StorageBlock<T>::CalculateHash() const { |
| 167 return Hash(reinterpret_cast<char*>(data_), offsetof(T, self_hash)); | 171 return Hash(reinterpret_cast<char*>(data_), offsetof(T, self_hash)); |
| 168 } | 172 } |
| 169 | 173 |
| 170 } // namespace disk_cache | 174 } // namespace disk_cache |
| 171 | 175 |
| 172 #endif // NET_DISK_CACHE_STORAGE_BLOCK_INL_H_ | 176 #endif // NET_DISK_CACHE_STORAGE_BLOCK_INL_H_ |
| OLD | NEW |