| Index: net/tools/dump_cache/cache_dumper.cc
|
| diff --git a/net/tools/dump_cache/cache_dumper.cc b/net/tools/dump_cache/cache_dumper.cc
|
| index 2898164428299180bb16ba1a32b3ce3305f3ecd7..0ed8af9a1adebcf76e0b8fb70b7e9ee6eff448d5 100644
|
| --- a/net/tools/dump_cache/cache_dumper.cc
|
| +++ b/net/tools/dump_cache/cache_dumper.cc
|
| @@ -14,8 +14,7 @@
|
| #include "net/http/http_response_info.h"
|
| #include "net/tools/dump_cache/url_to_filename_encoder.h"
|
|
|
| -CacheDumper::CacheDumper(disk_cache::Backend* cache)
|
| - : cache_(cache) {
|
| +CacheDumper::CacheDumper(disk_cache::Backend* cache) : cache_(cache) {
|
| }
|
|
|
| int CacheDumper::CreateEntry(const std::string& key,
|
| @@ -24,17 +23,21 @@ int CacheDumper::CreateEntry(const std::string& key,
|
| return cache_->CreateEntry(key, entry, callback);
|
| }
|
|
|
| -int CacheDumper::WriteEntry(disk_cache::Entry* entry, int index, int offset,
|
| - net::IOBuffer* buf, int buf_len,
|
| +int CacheDumper::WriteEntry(disk_cache::Entry* entry,
|
| + int index,
|
| + int offset,
|
| + net::IOBuffer* buf,
|
| + int buf_len,
|
| const net::CompletionCallback& callback) {
|
| return entry->WriteData(index, offset, buf, buf_len, callback, false);
|
| }
|
|
|
| -void CacheDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used,
|
| +void CacheDumper::CloseEntry(disk_cache::Entry* entry,
|
| + base::Time last_used,
|
| base::Time last_modified) {
|
| if (entry) {
|
| - static_cast<disk_cache::EntryImpl*>(entry)->SetTimes(last_used,
|
| - last_modified);
|
| + static_cast<disk_cache::EntryImpl*>(entry)
|
| + ->SetTimes(last_used, last_modified);
|
| entry->Close();
|
| }
|
| }
|
| @@ -69,8 +72,7 @@ bool SafeCreateDirectory(const base::FilePath& path) {
|
| #endif
|
| }
|
|
|
| -DiskDumper::DiskDumper(const base::FilePath& path)
|
| - : path_(path), entry_(NULL) {
|
| +DiskDumper::DiskDumper(const base::FilePath& path) : path_(path), entry_(NULL) {
|
| base::CreateDirectory(path);
|
| }
|
|
|
| @@ -102,8 +104,13 @@ int DiskDumper::CreateEntry(const std::string& key,
|
|
|
| base::FilePath::StringType file = entry_path_.value();
|
| #ifdef WIN32_LARGE_FILENAME_SUPPORT
|
| - entry_ = CreateFileW(file.c_str(), GENERIC_WRITE|GENERIC_READ, 0, 0,
|
| - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
|
| + entry_ = CreateFileW(file.c_str(),
|
| + GENERIC_WRITE | GENERIC_READ,
|
| + 0,
|
| + 0,
|
| + CREATE_ALWAYS,
|
| + FILE_ATTRIBUTE_NORMAL,
|
| + 0);
|
| if (entry_ == INVALID_HANDLE_VALUE)
|
| wprintf(L"CreateFileW (%s) failed: %d\n", file.c_str(), GetLastError());
|
| return (entry_ != INVALID_HANDLE_VALUE) ? net::OK : net::ERR_FAILED;
|
| @@ -153,20 +160,23 @@ void GetNormalizedHeaders(const net::HttpResponseInfo& info,
|
| output->append("\r\n");
|
| }
|
|
|
| -int 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,
|
| const net::CompletionCallback& callback) {
|
| if (!entry_)
|
| return 0;
|
|
|
| std::string headers;
|
| - const char *data;
|
| + const char* data;
|
| size_t len;
|
| if (index == 0) { // Stream 0 is the headers.
|
| net::HttpResponseInfo response_info;
|
| bool truncated;
|
| - if (!net::HttpCache::ParseResponseInfo(buf->data(), buf_len,
|
| - &response_info, &truncated))
|
| + if (!net::HttpCache::ParseResponseInfo(
|
| + buf->data(), buf_len, &response_info, &truncated))
|
| return 0;
|
|
|
| // Skip this entry if it was truncated (results in an empty file).
|
| @@ -213,8 +223,9 @@ int DiskDumper::WriteEntry(disk_cache::Entry* entry, int index, int offset,
|
| #endif
|
| }
|
|
|
| -void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used,
|
| - base::Time last_modified) {
|
| +void DiskDumper::CloseEntry(disk_cache::Entry* entry,
|
| + base::Time last_used,
|
| + base::Time last_modified) {
|
| #ifdef WIN32_LARGE_FILENAME_SUPPORT
|
| CloseHandle(entry_);
|
| #else
|
|
|