diff options
Diffstat (limited to 'webkit/fileapi')
-rw-r--r-- | webkit/fileapi/file_writer_delegate.cc | 12 | ||||
-rw-r--r-- | webkit/fileapi/file_writer_delegate.h | 5 |
2 files changed, 8 insertions, 9 deletions
diff --git a/webkit/fileapi/file_writer_delegate.cc b/webkit/fileapi/file_writer_delegate.cc index 49a4ecd..c0574fca 100644 --- a/webkit/fileapi/file_writer_delegate.cc +++ b/webkit/fileapi/file_writer_delegate.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -23,7 +23,8 @@ FileWriterDelegate::FileWriterDelegate( bytes_written_(0), bytes_read_(0), io_buffer_(new net::IOBufferWithSize(kReadBufSize)), - callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), + io_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), + &FileWriterDelegate::OnDataWritten), method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { } @@ -119,10 +120,9 @@ void FileWriterDelegate::OnDataReceived(int bytes_read) { } void FileWriterDelegate::Write() { - int write_response = file_stream_->Write( - io_buffer_->data() + bytes_written_, - bytes_read_ - bytes_written_, - callback_factory_.NewCallback(&FileWriterDelegate::OnDataWritten)); + int write_response = file_stream_->Write(io_buffer_->data() + bytes_written_, + bytes_read_ - bytes_written_, + &io_callback_); if (write_response > 0) MessageLoop::current()->PostTask( FROM_HERE, diff --git a/webkit/fileapi/file_writer_delegate.h b/webkit/fileapi/file_writer_delegate.h index 8e90a23..f5de184 100644 --- a/webkit/fileapi/file_writer_delegate.h +++ b/webkit/fileapi/file_writer_delegate.h @@ -8,10 +8,10 @@ #include "base/file_path.h" #include "base/platform_file.h" #include "base/ref_counted.h" -#include "base/scoped_callback_factory.h" #include "base/scoped_ptr.h" #include "base/task.h" #include "base/time.h" +#include "net/base/completion_callback.h" #include "net/base/file_stream.h" #include "net/base/io_buffer.h" #include "net/url_request/url_request.h" @@ -61,11 +61,10 @@ class FileWriterDelegate : public net::URLRequest::Delegate { scoped_refptr<net::IOBufferWithSize> io_buffer_; scoped_ptr<net::FileStream> file_stream_; net::URLRequest* request_; - base::ScopedCallbackFactory<FileWriterDelegate> callback_factory_; + net::CompletionCallbackImpl<FileWriterDelegate> io_callback_; ScopedRunnableMethodFactory<FileWriterDelegate> method_factory_; }; } // namespace fileapi #endif // WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ - |