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

Unified Diff: net/disk_cache/simple/simple_util.cc

Issue 23983005: SimpleCache: merge the first and second stream in one file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed gavin's comments Created 7 years, 3 months 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/simple/simple_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/simple/simple_util.cc
diff --git a/net/disk_cache/simple/simple_util.cc b/net/disk_cache/simple/simple_util.cc
index 4a89f9b5eb61c61bf01e08104648a15c7482f24c..4291b1f7773d6920e35479bca5c9b217cfb81cd5 100644
--- a/net/disk_cache/simple/simple_util.cc
+++ b/net/disk_cache/simple/simple_util.cc
@@ -77,13 +77,15 @@ uint64 GetEntryHashKey(const std::string& key) {
return u.key_hash;
}
-std::string GetFilenameFromEntryHashAndIndex(uint64 entry_hash,
- int index) {
- return base::StringPrintf("%016" PRIx64 "_%1d", entry_hash, index);
+std::string GetFilenameFromEntryHashAndFileIndex(uint64 entry_hash,
+ int file_index) {
+ return base::StringPrintf("%016" PRIx64 "_%1d", entry_hash, file_index);
}
-std::string GetFilenameFromKeyAndIndex(const std::string& key, int index) {
- return GetEntryHashKeyAsHexString(key) + base::StringPrintf("_%1d", index);
+std::string GetFilenameFromKeyAndFileIndex(const std::string& key,
+ int file_index) {
+ return GetEntryHashKeyAsHexString(key) +
+ base::StringPrintf("_%1d", file_index);
}
int32 GetDataSizeFromKeyAndFileSize(const std::string& key, int64 file_size) {
@@ -98,10 +100,8 @@ int64 GetFileSizeFromKeyAndDataSize(const std::string& key, int32 data_size) {
sizeof(SimpleFileEOF);
}
-int64 GetFileOffsetFromKeyAndDataOffset(const std::string& key,
- int data_offset) {
- const int64 headers_size = sizeof(disk_cache::SimpleFileHeader) + key.size();
- return headers_size + data_offset;
+int GetFileIndexFromStreamIndex(int stream_index) {
+ return (stream_index == 2) ? 1 : 0;
}
// TODO(clamy, gavinp): this should go in base
« no previous file with comments | « net/disk_cache/simple/simple_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698