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

Unified Diff: net/disk_cache/addr.cc

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/addr.h ('k') | net/disk_cache/backend_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/addr.cc
===================================================================
--- net/disk_cache/addr.cc (revision 232523)
+++ net/disk_cache/addr.cc (working copy)
@@ -26,6 +26,20 @@
return true;
}
+Addr Addr::AsExternal() const {
+ DCHECK(file_type() == BLOCK_FILES);
+ Addr new_addr(value_);
+ new_addr.SetFileType(EXTERNAL);
+ return new_addr;
+}
+
+Addr Addr::AsBlockFile() const {
+ DCHECK(is_separate_file());
+ Addr new_addr(value_);
+ new_addr.SetFileType(BLOCK_FILES);
+ return new_addr;
+}
+
bool Addr::SanityCheckV2() const {
if (!is_initialized())
return !value_;
@@ -89,4 +103,9 @@
return true;
}
+void Addr::SetFileType(FileType type) {
+ value_ &= ~kFileTypeMask;
+ value_ += type << kFileTypeOffset;
+}
+
} // namespace disk_cache
« no previous file with comments | « net/disk_cache/addr.h ('k') | net/disk_cache/backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698