summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/storage_block-inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/disk_cache/storage_block-inl.h')
-rw-r--r--net/disk_cache/storage_block-inl.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/net/disk_cache/storage_block-inl.h b/net/disk_cache/storage_block-inl.h
index 9ec9fa0..909b717 100644
--- a/net/disk_cache/storage_block-inl.h
+++ b/net/disk_cache/storage_block-inl.h
@@ -62,6 +62,20 @@ template<typename T> void StorageBlock<T>::SetData(T* other) {
data_ = other;
}
+template<typename T> void StorageBlock<T>::Discard() {
+ if (!data_)
+ return;
+ if (!own_data_) {
+ NOTREACHED();
+ return;
+ }
+ DeleteData();
+ data_ = NULL;
+ modified_ = false;
+ own_data_ = false;
+ extended_ = false;
+}
+
template<typename T> void StorageBlock<T>::set_modified() {
DCHECK(data_);
modified_ = true;
@@ -97,7 +111,7 @@ template<typename T> bool StorageBlock<T>::Load() {
}
template<typename T> bool StorageBlock<T>::Store() {
- if (file_) {
+ if (file_ && data_) {
if (file_->Store(this)) {
modified_ = false;
return true;