Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Unified Diff: net/disk_cache/storage_block-inl.h

Issue 17507006: Disk cache v3 ref2 Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Incl IndexTable cl Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/storage_block.h ('k') | net/disk_cache/v3/backend_impl_v3.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/storage_block-inl.h
===================================================================
--- net/disk_cache/storage_block-inl.h (revision 232523)
+++ net/disk_cache/storage_block-inl.h (working copy)
@@ -13,6 +13,14 @@
namespace disk_cache {
+template<typename T> StorageBlock<T>::StorageBlock()
+ : data_(NULL),
+ file_(NULL),
+ modified_(false),
+ own_data_(false),
+ extended_(false) {
+}
+
template<typename T> StorageBlock<T>::StorageBlock(MappedFile* file,
Addr address)
: data_(NULL), file_(file), address_(address), modified_(false),
@@ -98,6 +106,18 @@
return data_;
}
+template<typename T> T* StorageBlock<T>::ReleaseData() {
+ if (!own_data_ || !data_)
+ return NULL;
+
+ data_->self_hash = CalculateHash();
+ T* result = data_;
+ data_ = NULL;
+ own_data_ = false;
+ modified_ = false;
+ return result;
+}
+
template<typename T> bool StorageBlock<T>::HasData() const {
return (NULL != data_);
}
@@ -107,6 +127,10 @@
return (!data_->self_hash || data_->self_hash == hash);
}
+template<typename T> void StorageBlock<T>::UpdateHash() {
+ data_->self_hash = CalculateHash();
+}
+
template<typename T> bool StorageBlock<T>::own_data() const {
return own_data_;
}
« no previous file with comments | « net/disk_cache/storage_block.h ('k') | net/disk_cache/v3/backend_impl_v3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698