| Index: net/disk_cache/blockfile/in_flight_backend_io.cc
|
| diff --git a/net/disk_cache/blockfile/in_flight_backend_io.cc b/net/disk_cache/blockfile/in_flight_backend_io.cc
|
| index c9df6808b3583a68220d17cb94db0c16d0e00ca8..ed303546e66882bbc8d0c0350b74a9913cfe0d5a 100644
|
| --- a/net/disk_cache/blockfile/in_flight_backend_io.cc
|
| +++ b/net/disk_cache/blockfile/in_flight_backend_io.cc
|
| @@ -18,7 +18,8 @@
|
|
|
| namespace disk_cache {
|
|
|
| -BackendIO::BackendIO(InFlightIO* controller, BackendImpl* backend,
|
| +BackendIO::BackendIO(InFlightIO* controller,
|
| + BackendImpl* backend,
|
| const net::CompletionCallback& callback)
|
| : BackgroundIO(controller),
|
| backend_(backend),
|
| @@ -156,8 +157,11 @@ void BackendIO::RunTask(const base::Closure& task) {
|
| task_ = task;
|
| }
|
|
|
| -void BackendIO::ReadData(EntryImpl* entry, int index, int offset,
|
| - net::IOBuffer* buf, int buf_len) {
|
| +void BackendIO::ReadData(EntryImpl* entry,
|
| + int index,
|
| + int offset,
|
| + net::IOBuffer* buf,
|
| + int buf_len) {
|
| operation_ = OP_READ;
|
| entry_ = entry;
|
| index_ = index;
|
| @@ -166,8 +170,12 @@ void BackendIO::ReadData(EntryImpl* entry, int index, int offset,
|
| buf_len_ = buf_len;
|
| }
|
|
|
| -void BackendIO::WriteData(EntryImpl* entry, int index, int offset,
|
| - net::IOBuffer* buf, int buf_len, bool truncate) {
|
| +void BackendIO::WriteData(EntryImpl* entry,
|
| + int index,
|
| + int offset,
|
| + net::IOBuffer* buf,
|
| + int buf_len,
|
| + bool truncate) {
|
| operation_ = OP_WRITE;
|
| entry_ = entry;
|
| index_ = index;
|
| @@ -177,8 +185,10 @@ void BackendIO::WriteData(EntryImpl* entry, int index, int offset,
|
| truncate_ = truncate;
|
| }
|
|
|
| -void BackendIO::ReadSparseData(EntryImpl* entry, int64 offset,
|
| - net::IOBuffer* buf, int buf_len) {
|
| +void BackendIO::ReadSparseData(EntryImpl* entry,
|
| + int64 offset,
|
| + net::IOBuffer* buf,
|
| + int buf_len) {
|
| operation_ = OP_READ_SPARSE;
|
| entry_ = entry;
|
| offset64_ = offset;
|
| @@ -186,8 +196,10 @@ void BackendIO::ReadSparseData(EntryImpl* entry, int64 offset,
|
| buf_len_ = buf_len;
|
| }
|
|
|
| -void BackendIO::WriteSparseData(EntryImpl* entry, int64 offset,
|
| - net::IOBuffer* buf, int buf_len) {
|
| +void BackendIO::WriteSparseData(EntryImpl* entry,
|
| + int64 offset,
|
| + net::IOBuffer* buf,
|
| + int buf_len) {
|
| operation_ = OP_WRITE_SPARSE;
|
| entry_ = entry;
|
| offset64_ = offset;
|
| @@ -195,7 +207,9 @@ void BackendIO::WriteSparseData(EntryImpl* entry, int64 offset,
|
| buf_len_ = buf_len;
|
| }
|
|
|
| -void BackendIO::GetAvailableRange(EntryImpl* entry, int64 offset, int len,
|
| +void BackendIO::GetAvailableRange(EntryImpl* entry,
|
| + int64 offset,
|
| + int len,
|
| int64* start) {
|
| operation_ = OP_GET_RANGE;
|
| entry_ = entry;
|
| @@ -214,7 +228,8 @@ void BackendIO::ReadyForSparseIO(EntryImpl* entry) {
|
| entry_ = entry;
|
| }
|
|
|
| -BackendIO::~BackendIO() {}
|
| +BackendIO::~BackendIO() {
|
| +}
|
|
|
| bool BackendIO::ReturnsEntry() {
|
| return (operation_ == OP_OPEN || operation_ == OP_CREATE ||
|
| @@ -291,24 +306,34 @@ void BackendIO::ExecuteEntryOperation() {
|
| switch (operation_) {
|
| case OP_READ:
|
| result_ =
|
| - entry_->ReadDataImpl(index_, offset_, buf_.get(), buf_len_,
|
| + entry_->ReadDataImpl(index_,
|
| + offset_,
|
| + buf_.get(),
|
| + buf_len_,
|
| base::Bind(&BackendIO::OnIOComplete, this));
|
| break;
|
| case OP_WRITE:
|
| result_ =
|
| - entry_->WriteDataImpl(index_, offset_, buf_.get(), buf_len_,
|
| + entry_->WriteDataImpl(index_,
|
| + offset_,
|
| + buf_.get(),
|
| + buf_len_,
|
| base::Bind(&BackendIO::OnIOComplete, this),
|
| truncate_);
|
| break;
|
| case OP_READ_SPARSE:
|
| result_ = entry_->ReadSparseDataImpl(
|
| - offset64_, buf_.get(), buf_len_,
|
| - base::Bind(&BackendIO::OnIOComplete, this));
|
| + offset64_,
|
| + buf_.get(),
|
| + buf_len_,
|
| + base::Bind(&BackendIO::OnIOComplete, this));
|
| break;
|
| case OP_WRITE_SPARSE:
|
| result_ = entry_->WriteSparseDataImpl(
|
| - offset64_, buf_.get(), buf_len_,
|
| - base::Bind(&BackendIO::OnIOComplete, this));
|
| + offset64_,
|
| + buf_.get(),
|
| + buf_len_,
|
| + base::Bind(&BackendIO::OnIOComplete, this));
|
| break;
|
| case OP_GET_RANGE:
|
| result_ = entry_->GetAvailableRangeImpl(offset64_, buf_len_, start_);
|
| @@ -319,7 +344,7 @@ void BackendIO::ExecuteEntryOperation() {
|
| break;
|
| case OP_IS_READY:
|
| result_ = entry_->ReadyForSparseIOImpl(
|
| - base::Bind(&BackendIO::OnIOComplete, this));
|
| + base::Bind(&BackendIO::OnIOComplete, this));
|
| break;
|
| default:
|
| NOTREACHED() << "Invalid Operation";
|
| @@ -331,7 +356,7 @@ void BackendIO::ExecuteEntryOperation() {
|
| }
|
|
|
| InFlightBackendIO::InFlightBackendIO(BackendImpl* backend,
|
| - base::MessageLoopProxy* background_thread)
|
| + base::MessageLoopProxy* background_thread)
|
| : backend_(backend),
|
| background_thread_(background_thread),
|
| ptr_factory_(this) {
|
| @@ -346,14 +371,16 @@ void InFlightBackendIO::Init(const net::CompletionCallback& callback) {
|
| PostOperation(operation.get());
|
| }
|
|
|
| -void InFlightBackendIO::OpenEntry(const std::string& key, Entry** entry,
|
| +void InFlightBackendIO::OpenEntry(const std::string& key,
|
| + Entry** entry,
|
| const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| operation->OpenEntry(key, entry);
|
| PostOperation(operation.get());
|
| }
|
|
|
| -void InFlightBackendIO::CreateEntry(const std::string& key, Entry** entry,
|
| +void InFlightBackendIO::CreateEntry(const std::string& key,
|
| + Entry** entry,
|
| const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| operation->CreateEntry(key, entry);
|
| @@ -374,29 +401,33 @@ void InFlightBackendIO::DoomAllEntries(
|
| PostOperation(operation.get());
|
| }
|
|
|
| -void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time,
|
| - const base::Time end_time,
|
| - const net::CompletionCallback& callback) {
|
| +void InFlightBackendIO::DoomEntriesBetween(
|
| + const base::Time initial_time,
|
| + const base::Time end_time,
|
| + const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| operation->DoomEntriesBetween(initial_time, end_time);
|
| PostOperation(operation.get());
|
| }
|
|
|
| void InFlightBackendIO::DoomEntriesSince(
|
| - const base::Time initial_time, const net::CompletionCallback& callback) {
|
| + const base::Time initial_time,
|
| + const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| operation->DoomEntriesSince(initial_time);
|
| PostOperation(operation.get());
|
| }
|
|
|
| -void InFlightBackendIO::OpenNextEntry(void** iter, Entry** next_entry,
|
| +void InFlightBackendIO::OpenNextEntry(void** iter,
|
| + Entry** next_entry,
|
| const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| operation->OpenNextEntry(iter, next_entry);
|
| PostOperation(operation.get());
|
| }
|
|
|
| -void InFlightBackendIO::OpenPrevEntry(void** iter, Entry** prev_entry,
|
| +void InFlightBackendIO::OpenPrevEntry(void** iter,
|
| + Entry** prev_entry,
|
| const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| operation->OpenPrevEntry(iter, prev_entry);
|
| @@ -437,23 +468,29 @@ void InFlightBackendIO::FlushQueue(const net::CompletionCallback& callback) {
|
| PostOperation(operation.get());
|
| }
|
|
|
| -void InFlightBackendIO::RunTask(
|
| - const base::Closure& task, const net::CompletionCallback& callback) {
|
| +void InFlightBackendIO::RunTask(const base::Closure& task,
|
| + const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| operation->RunTask(task);
|
| PostOperation(operation.get());
|
| }
|
|
|
| -void InFlightBackendIO::ReadData(EntryImpl* entry, int index, int offset,
|
| - net::IOBuffer* buf, int buf_len,
|
| +void InFlightBackendIO::ReadData(EntryImpl* entry,
|
| + int index,
|
| + int offset,
|
| + net::IOBuffer* buf,
|
| + int buf_len,
|
| const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| operation->ReadData(entry, index, offset, buf, buf_len);
|
| PostOperation(operation.get());
|
| }
|
|
|
| -void InFlightBackendIO::WriteData(EntryImpl* entry, int index, int offset,
|
| - net::IOBuffer* buf, int buf_len,
|
| +void InFlightBackendIO::WriteData(EntryImpl* entry,
|
| + int index,
|
| + int offset,
|
| + net::IOBuffer* buf,
|
| + int buf_len,
|
| bool truncate,
|
| const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| @@ -462,7 +499,10 @@ void InFlightBackendIO::WriteData(EntryImpl* entry, int index, int offset,
|
| }
|
|
|
| void InFlightBackendIO::ReadSparseData(
|
| - EntryImpl* entry, int64 offset, net::IOBuffer* buf, int buf_len,
|
| + EntryImpl* entry,
|
| + int64 offset,
|
| + net::IOBuffer* buf,
|
| + int buf_len,
|
| const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| operation->ReadSparseData(entry, offset, buf, buf_len);
|
| @@ -470,7 +510,10 @@ void InFlightBackendIO::ReadSparseData(
|
| }
|
|
|
| void InFlightBackendIO::WriteSparseData(
|
| - EntryImpl* entry, int64 offset, net::IOBuffer* buf, int buf_len,
|
| + EntryImpl* entry,
|
| + int64 offset,
|
| + net::IOBuffer* buf,
|
| + int buf_len,
|
| const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| operation->WriteSparseData(entry, offset, buf, buf_len);
|
| @@ -478,7 +521,10 @@ void InFlightBackendIO::WriteSparseData(
|
| }
|
|
|
| void InFlightBackendIO::GetAvailableRange(
|
| - EntryImpl* entry, int64 offset, int len, int64* start,
|
| + EntryImpl* entry,
|
| + int64 offset,
|
| + int len,
|
| + int64* start,
|
| const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| operation->GetAvailableRange(entry, offset, len, start);
|
| @@ -493,7 +539,8 @@ void InFlightBackendIO::CancelSparseIO(EntryImpl* entry) {
|
| }
|
|
|
| void InFlightBackendIO::ReadyForSparseIO(
|
| - EntryImpl* entry, const net::CompletionCallback& callback) {
|
| + EntryImpl* entry,
|
| + const net::CompletionCallback& callback) {
|
| scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback));
|
| operation->ReadyForSparseIO(entry);
|
| PostOperation(operation.get());
|
| @@ -513,8 +560,8 @@ void InFlightBackendIO::OnOperationComplete(BackgroundIO* operation,
|
| }
|
|
|
| void InFlightBackendIO::PostOperation(BackendIO* operation) {
|
| - background_thread_->PostTask(FROM_HERE,
|
| - base::Bind(&BackendIO::ExecuteOperation, operation));
|
| + background_thread_->PostTask(
|
| + FROM_HERE, base::Bind(&BackendIO::ExecuteOperation, operation));
|
| OnOperationPosted(operation);
|
| }
|
|
|
|
|