| Index: net/disk_cache/storage_block-inl.h
|
| ===================================================================
|
| --- net/disk_cache/storage_block-inl.h (revision 7294)
|
| +++ net/disk_cache/storage_block-inl.h (working copy)
|
| @@ -23,8 +23,7 @@
|
| template<typename T> StorageBlock<T>::~StorageBlock() {
|
| if (modified_)
|
| Store();
|
| - if (own_data_)
|
| - delete data_;
|
| + DeleteData();
|
| }
|
|
|
| template<typename T> void* StorageBlock<T>::buffer() const {
|
| @@ -58,10 +57,7 @@
|
|
|
| template<typename T> void StorageBlock<T>::SetData(T* other) {
|
| DCHECK(!modified_);
|
| - if (own_data_) {
|
| - delete data_;
|
| - own_data_ = false;
|
| - }
|
| + DeleteData();
|
| data_ = other;
|
| }
|
|
|
| @@ -122,6 +118,18 @@
|
| own_data_ = true;
|
| }
|
|
|
| +template<typename T> void StorageBlock<T>::DeleteData() {
|
| + if (own_data_) {
|
| + if (!extended_) {
|
| + delete data_;
|
| + } else {
|
| + data_->~T();
|
| + delete[] reinterpret_cast<char*>(data_);
|
| + }
|
| + own_data_ = false;
|
| + }
|
| +}
|
| +
|
| } // namespace disk_cache
|
|
|
| #endif // NET_DISK_CACHE_CACHE_INTERNAL_INL_H__
|
|
|