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

Unified Diff: net/disk_cache/sparse_control.cc

Issue 15203004: Disk cache: Reference CL for the implementation of file format version 3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: IndexTable review 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/rankings.cc ('k') | net/disk_cache/stats.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/sparse_control.cc
===================================================================
--- net/disk_cache/sparse_control.cc (revision 199883)
+++ net/disk_cache/sparse_control.cc (working copy)
@@ -136,8 +136,8 @@
children_map_.Set(child_id, false);
// Post a task to delete the next child.
- MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
- &ChildrenDeleter::DeleteChildren, this));
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(&ChildrenDeleter::DeleteChildren, this));
}
// Returns the NetLog event type corresponding to a SparseOperation.
@@ -351,17 +351,19 @@
entry->net_log().AddEvent(net::NetLog::TYPE_SPARSE_DELETE_CHILDREN);
DCHECK(entry->backend_);
- ChildrenDeleter* deleter = new ChildrenDeleter(entry->backend_,
+ ChildrenDeleter* deleter = new ChildrenDeleter(entry->backend_.get(),
entry->GetKey());
// The object will self destruct when finished.
deleter->AddRef();
if (buffer) {
- MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
- &ChildrenDeleter::Start, deleter, buffer, data_len));
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&ChildrenDeleter::Start, deleter, buffer, data_len));
} else {
- MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
- &ChildrenDeleter::ReadData, deleter, address, data_len));
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&ChildrenDeleter::ReadData, deleter, address, data_len));
}
}
@@ -381,9 +383,8 @@
scoped_refptr<net::IOBuffer> buf(
new net::WrappedIOBuffer(reinterpret_cast<char*>(&sparse_header_)));
- int rv = entry_->WriteData(
- kSparseIndex, 0, buf, sizeof(sparse_header_), CompletionCallback(),
- false);
+ int rv = entry_->WriteData(kSparseIndex, 0, buf.get(), sizeof(sparse_header_),
+ CompletionCallback(), false);
if (rv != sizeof(sparse_header_)) {
DLOG(ERROR) << "Unable to save sparse_header_";
return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
@@ -413,8 +414,8 @@
new net::WrappedIOBuffer(reinterpret_cast<char*>(&sparse_header_)));
// Read header.
- int rv = entry_->ReadData(
- kSparseIndex, 0, buf, sizeof(sparse_header_), CompletionCallback());
+ int rv = entry_->ReadData(kSparseIndex, 0, buf.get(), sizeof(sparse_header_),
+ CompletionCallback());
if (rv != static_cast<int>(sizeof(sparse_header_)))
return net::ERR_CACHE_READ_FAILURE;
@@ -427,8 +428,8 @@
// Read the actual bitmap.
buf = new net::IOBuffer(map_len);
- rv = entry_->ReadData(kSparseIndex, sizeof(sparse_header_), buf, map_len,
- CompletionCallback());
+ rv = entry_->ReadData(kSparseIndex, sizeof(sparse_header_), buf.get(),
+ map_len, CompletionCallback());
if (rv != map_len)
return net::ERR_CACHE_READ_FAILURE;
@@ -470,7 +471,7 @@
new net::WrappedIOBuffer(reinterpret_cast<char*>(&child_data_)));
// Read signature.
- int rv = child_->ReadData(kSparseIndex, 0, buf, sizeof(child_data_),
+ int rv = child_->ReadData(kSparseIndex, 0, buf.get(), sizeof(child_data_),
CompletionCallback());
if (rv != sizeof(child_data_))
return KillChildAndContinue(key, true); // This is a fatal failure.
@@ -494,9 +495,8 @@
new net::WrappedIOBuffer(reinterpret_cast<char*>(&child_data_)));
// Save the allocation bitmap before closing the child entry.
- int rv = child_->WriteData(kSparseIndex, 0, buf, sizeof(child_data_),
- CompletionCallback(),
- false);
+ int rv = child_->WriteData(kSparseIndex, 0, buf.get(), sizeof(child_data_),
+ CompletionCallback(), false);
if (rv != sizeof(child_data_))
DLOG(ERROR) << "Failed to save child data";
child_->Release();
@@ -565,8 +565,8 @@
reinterpret_cast<const char*>(children_map_.GetMap())));
int len = children_map_.ArraySize() * 4;
- int rv = entry_->WriteData(kSparseIndex, sizeof(sparse_header_), buf, len,
- CompletionCallback(), false);
+ int rv = entry_->WriteData(kSparseIndex, sizeof(sparse_header_), buf.get(),
+ len, CompletionCallback(), false);
if (rv != len) {
DLOG(ERROR) << "Unable to save sparse map";
}
@@ -669,7 +669,7 @@
scoped_refptr<net::WrappedIOBuffer> buf(
new net::WrappedIOBuffer(reinterpret_cast<char*>(&child_data_)));
- int rv = child_->WriteData(kSparseIndex, 0, buf, sizeof(child_data_),
+ int rv = child_->WriteData(kSparseIndex, 0, buf.get(), sizeof(child_data_),
CompletionCallback(), false);
if (rv != sizeof(child_data_))
DLOG(ERROR) << "Failed to save child data";
@@ -725,7 +725,7 @@
CreateNetLogSparseReadWriteCallback(child_->net_log().source(),
child_len_));
}
- rv = child_->ReadDataImpl(kSparseData, child_offset_, user_buf_,
+ rv = child_->ReadDataImpl(kSparseData, child_offset_, user_buf_.get(),
child_len_, callback);
break;
case kWriteOperation:
@@ -735,7 +735,7 @@
CreateNetLogSparseReadWriteCallback(child_->net_log().source(),
child_len_));
}
- rv = child_->WriteDataImpl(kSparseData, child_offset_, user_buf_,
+ rv = child_->WriteDataImpl(kSparseData, child_offset_, user_buf_.get(),
child_len_, callback, false);
break;
case kGetRangeOperation:
« no previous file with comments | « net/disk_cache/rankings.cc ('k') | net/disk_cache/stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698