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

Unified Diff: net/tools/dump_cache/cache_dumper.cc

Issue 2739007: Disk cache: Update the disk cache tools and tests to use... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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/tools/dump_cache/cache_dumper.h ('k') | net/tools/dump_cache/upgrade.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/dump_cache/cache_dumper.cc
===================================================================
--- net/tools/dump_cache/cache_dumper.cc (revision 49603)
+++ net/tools/dump_cache/cache_dumper.cc (working copy)
@@ -16,10 +16,10 @@
return cache_->CreateEntry(key, entry);
}
-bool CacheDumper::WriteEntry(disk_cache::Entry* entry, int index, int offset,
- net::IOBuffer* buf, int buf_len) {
- int written = entry->WriteData(index, offset, buf, buf_len, NULL, false);
- return written == buf_len;
+int CacheDumper::WriteEntry(disk_cache::Entry* entry, int index, int offset,
+ net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* callback) {
+ return entry->WriteData(index, offset, buf, buf_len, callback, false);
}
void CacheDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used,
@@ -48,7 +48,7 @@
pos = 4;
// Create the subdirectories individually
- while((pos = path.find(backslash, pos)) != std::wstring::npos) {
+ while ((pos = path.find(backslash, pos)) != std::wstring::npos) {
std::wstring subdir = path.substr(0, pos);
CreateDirectoryW(subdir.c_str(), NULL);
// we keep going even if directory creation failed.
@@ -141,10 +141,11 @@
output->append("\r\n");
}
-bool DiskDumper::WriteEntry(disk_cache::Entry* entry, int index, int offset,
- net::IOBuffer* buf, int buf_len) {
+int DiskDumper::WriteEntry(disk_cache::Entry* entry, int index, int offset,
+ net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* callback) {
if (!entry_)
- return false;
+ return 0;
std::string headers;
const char *data;
@@ -154,11 +155,11 @@
bool truncated;
if (!net::HttpCache::ParseResponseInfo(buf->data(), buf_len,
&response_info, &truncated))
- return false;
+ return 0;
// Skip this entry if it was truncated (results in an empty file).
if (truncated)
- return true;
+ return buf_len;
// Remove the size headers.
response_info.headers->RemoveHeader("transfer-encoding");
@@ -188,11 +189,12 @@
}
#ifdef WIN32_LARGE_FILENAME_SUPPORT
DWORD bytes;
- DWORD rv = WriteFile(entry_, data, len, &bytes, 0);
- return rv == TRUE && bytes == static_cast<DWORD>(len);
+ if (!WriteFile(entry_, data, len, &bytes, 0))
+ return 0;
+
+ return bytes;
#else
- int bytes = fwrite(data, 1, len, entry_);
- return bytes == len;
+ return fwrite(data, 1, len, entry_);
#endif
}
« no previous file with comments | « net/tools/dump_cache/cache_dumper.h ('k') | net/tools/dump_cache/upgrade.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698