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

Unified Diff: net/disk_cache/sparse_control.cc

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk Created 7 years, 7 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/mem_entry_impl.cc ('k') | net/disk_cache/storage_block_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/sparse_control.cc
diff --git a/net/disk_cache/sparse_control.cc b/net/disk_cache/sparse_control.cc
index 8c3d5ddf73570b259a8ffa5903294953034c52b9..9f1367842c939f37a4405667b9e13b7a50fefa35 100644
--- a/net/disk_cache/sparse_control.cc
+++ b/net/disk_cache/sparse_control.cc
@@ -255,7 +255,7 @@ int SparseControl::StartIO(SparseOperation op, int64 offset, net::IOBuffer* buf,
if (offset + buf_len >= 0x1000000000LL || offset + buf_len < 0)
return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
- DCHECK(!user_buf_);
+ DCHECK(!user_buf_.get());
DCHECK(user_callback_.is_null());
if (!buf && (op == kReadOperation || op == kWriteOperation))
@@ -383,9 +383,12 @@ int SparseControl::CreateSparseEntry() {
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;
@@ -416,7 +419,7 @@ int SparseControl::OpenSparseEntry(int data_len) {
// Read header.
int rv = entry_->ReadData(
- kSparseIndex, 0, buf, sizeof(sparse_header_), CompletionCallback());
+ kSparseIndex, 0, buf.get(), sizeof(sparse_header_), CompletionCallback());
if (rv != static_cast<int>(sizeof(sparse_header_)))
return net::ERR_CACHE_READ_FAILURE;
@@ -429,7 +432,10 @@ int SparseControl::OpenSparseEntry(int data_len) {
// Read the actual bitmap.
buf = new net::IOBuffer(map_len);
- rv = entry_->ReadData(kSparseIndex, sizeof(sparse_header_), buf, map_len,
+ rv = entry_->ReadData(kSparseIndex,
+ sizeof(sparse_header_),
+ buf.get(),
+ map_len,
CompletionCallback());
if (rv != map_len)
return net::ERR_CACHE_READ_FAILURE;
@@ -472,8 +478,8 @@ bool SparseControl::OpenChild() {
new net::WrappedIOBuffer(reinterpret_cast<char*>(&child_data_)));
// Read signature.
- int rv = child_->ReadData(kSparseIndex, 0, buf, sizeof(child_data_),
- CompletionCallback());
+ 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.
@@ -496,9 +502,12 @@ void SparseControl::CloseChild() {
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_),
+ int rv = child_->WriteData(kSparseIndex,
+ 0,
+ buf.get(),
+ sizeof(child_data_),
CompletionCallback(),
- false);
+ false);
if (rv != sizeof(child_data_))
DLOG(ERROR) << "Failed to save child data";
child_->Release();
@@ -567,8 +576,12 @@ void SparseControl::WriteSparseData() {
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";
}
@@ -671,8 +684,12 @@ void SparseControl::InitChildData() {
scoped_refptr<net::WrappedIOBuffer> buf(
new net::WrappedIOBuffer(reinterpret_cast<char*>(&child_data_)));
- 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";
SetChildBit(true);
@@ -727,8 +744,8 @@ bool SparseControl::DoChildIO() {
CreateNetLogSparseReadWriteCallback(child_->net_log().source(),
child_len_));
}
- rv = child_->ReadDataImpl(kSparseData, child_offset_, user_buf_,
- child_len_, callback);
+ rv = child_->ReadDataImpl(
+ kSparseData, child_offset_, user_buf_.get(), child_len_, callback);
break;
case kWriteOperation:
if (entry_->net_log().IsLoggingAllEvents()) {
@@ -737,8 +754,12 @@ bool SparseControl::DoChildIO() {
CreateNetLogSparseReadWriteCallback(child_->net_log().source(),
child_len_));
}
- rv = child_->WriteDataImpl(kSparseData, child_offset_, user_buf_,
- child_len_, callback, false);
+ rv = child_->WriteDataImpl(kSparseData,
+ child_offset_,
+ user_buf_.get(),
+ child_len_,
+ callback,
+ false);
break;
case kGetRangeOperation:
rv = DoGetAvailableRange();
@@ -827,7 +848,7 @@ void SparseControl::DoChildIOCompleted(int result) {
buf_len_ -= result;
// We'll be reusing the user provided buffer for the next chunk.
- if (buf_len_ && user_buf_)
+ if (buf_len_ && user_buf_.get())
user_buf_->DidConsume(result);
}
« no previous file with comments | « net/disk_cache/mem_entry_impl.cc ('k') | net/disk_cache/storage_block_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698