summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/file_posix.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/disk_cache/file_posix.cc')
-rw-r--r--net/disk_cache/file_posix.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc
index 9d810c7..a8d74ae 100644
--- a/net/disk_cache/file_posix.cc
+++ b/net/disk_cache/file_posix.cc
@@ -182,9 +182,9 @@ void BackgroundIO::OnIOSignalled() {
void InFlightIO::PostRead(disk_cache::File *file, void* buf, size_t buf_len,
size_t offset, disk_cache::FileIOCallback *callback) {
- scoped_refptr<BackgroundIO> operation =
- new BackgroundIO(file, buf, buf_len, offset, callback, this);
- io_list_.insert(operation.get());
+ scoped_refptr<BackgroundIO> operation(
+ new BackgroundIO(file, buf, buf_len, offset, callback, this));
+ io_list_.insert(operation);
file->AddRef(); // Balanced on InvokeCallback()
if (!callback_thread_)
@@ -198,9 +198,9 @@ void InFlightIO::PostRead(disk_cache::File *file, void* buf, size_t buf_len,
void InFlightIO::PostWrite(disk_cache::File* file, const void* buf,
size_t buf_len, size_t offset,
disk_cache::FileIOCallback* callback) {
- scoped_refptr<BackgroundIO> operation =
- new BackgroundIO(file, buf, buf_len, offset, callback, this);
- io_list_.insert(operation.get());
+ scoped_refptr<BackgroundIO> operation(
+ new BackgroundIO(file, buf, buf_len, offset, callback, this));
+ io_list_.insert(operation);
file->AddRef(); // Balanced on InvokeCallback()
if (!callback_thread_)
@@ -241,7 +241,7 @@ void InFlightIO::InvokeCallback(BackgroundIO* operation, bool cancel_task) {
// Release the references acquired in PostRead / PostWrite.
operation->file()->Release();
- io_list_.erase(operation);
+ io_list_.erase(make_scoped_refptr(operation));
callback->OnFileIOComplete(bytes);
}