diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 08:51:38 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 08:51:38 +0000 |
commit | 5eb431e2dfe9d55eaff2acc7a3ea64f403dec669 (patch) | |
tree | 2dedc5eed71c34a111444dc341642a35ae3eb248 /webkit/fileapi | |
parent | d48a64ebbf54a6d87d82c3787e12f35439e1f62b (diff) | |
download | chromium_src-5eb431e2dfe9d55eaff2acc7a3ea64f403dec669.zip chromium_src-5eb431e2dfe9d55eaff2acc7a3ea64f403dec669.tar.gz chromium_src-5eb431e2dfe9d55eaff2acc7a3ea64f403dec669.tar.bz2 |
Switch FileStream to use new CompletionCallback.
BUG=98719
TEST=none
Review URL: http://codereview.chromium.org/8139019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi')
-rw-r--r-- | webkit/fileapi/file_system_url_request_job.cc | 7 | ||||
-rw-r--r-- | webkit/fileapi/file_system_url_request_job.h | 2 | ||||
-rw-r--r-- | webkit/fileapi/file_writer_delegate.cc | 11 | ||||
-rw-r--r-- | webkit/fileapi/file_writer_delegate.h | 2 |
4 files changed, 10 insertions, 12 deletions
diff --git a/webkit/fileapi/file_system_url_request_job.cc b/webkit/fileapi/file_system_url_request_job.cc index 34fec21..8cdf9d4 100644 --- a/webkit/fileapi/file_system_url_request_job.cc +++ b/webkit/fileapi/file_system_url_request_job.cc @@ -4,6 +4,7 @@ #include "webkit/fileapi/file_system_url_request_job.h" +#include "base/bind.h" #include "base/compiler_specific.h" #include "base/file_path.h" #include "base/file_util_proxy.h" @@ -107,8 +108,6 @@ FileSystemURLRequestJob::FileSystemURLRequestJob( file_thread_proxy_(file_thread_proxy), ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)), - ALLOW_THIS_IN_INITIALIZER_LIST( - io_callback_(this, &FileSystemURLRequestJob::DidRead)), stream_(NULL), is_directory_(false), remaining_bytes_(0) { @@ -154,7 +153,9 @@ bool FileSystemURLRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size, return true; } - int rv = stream_->Read(dest->data(), dest_size, &io_callback_); + int rv = stream_->Read(dest->data(), dest_size, + base::Bind(&FileSystemURLRequestJob::DidRead, + base::Unretained(this))); if (rv >= 0) { // Data is immediately available. *bytes_read = rv; diff --git a/webkit/fileapi/file_system_url_request_job.h b/webkit/fileapi/file_system_url_request_job.h index 1caa988..1c66708 100644 --- a/webkit/fileapi/file_system_url_request_job.h +++ b/webkit/fileapi/file_system_url_request_job.h @@ -13,7 +13,6 @@ #include "base/message_loop_proxy.h" #include "base/platform_file.h" #include "base/task.h" -#include "net/base/completion_callback.h" #include "net/http/http_byte_range.h" #include "net/url_request/url_request_job.h" @@ -64,7 +63,6 @@ class FileSystemURLRequestJob : public net::URLRequestJob { scoped_refptr<base::MessageLoopProxy> file_thread_proxy_; ScopedRunnableMethodFactory<FileSystemURLRequestJob> method_factory_; base::ScopedCallbackFactory<FileSystemURLRequestJob> callback_factory_; - net::OldCompletionCallbackImpl<FileSystemURLRequestJob> io_callback_; scoped_ptr<net::FileStream> stream_; bool is_directory_; scoped_ptr<net::HttpResponseInfo> response_info_; diff --git a/webkit/fileapi/file_writer_delegate.cc b/webkit/fileapi/file_writer_delegate.cc index 34339a5..4c4ab24 100644 --- a/webkit/fileapi/file_writer_delegate.cc +++ b/webkit/fileapi/file_writer_delegate.cc @@ -4,6 +4,7 @@ #include "webkit/fileapi/file_writer_delegate.h" +#include "base/bind.h" #include "base/file_util_proxy.h" #include "base/message_loop.h" #include "base/threading/thread_restrictions.h" @@ -94,8 +95,6 @@ FileWriterDelegate::FileWriterDelegate( total_bytes_written_(0), allowed_bytes_to_write_(0), io_buffer_(new net::IOBufferWithSize(kReadBufSize)), - io_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), - &FileWriterDelegate::OnDataWritten), method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { } @@ -232,9 +231,11 @@ void FileWriterDelegate::Write() { if (bytes_to_write > allowed_bytes_to_write_ - total_bytes_written_) bytes_to_write = allowed_bytes_to_write_ - total_bytes_written_; - int write_response = file_stream_->Write(io_buffer_->data() + bytes_written_, - static_cast<int>(bytes_to_write), - &io_callback_); + int write_response = + file_stream_->Write(io_buffer_->data() + bytes_written_, + static_cast<int>(bytes_to_write), + base::Bind(&FileWriterDelegate::OnDataWritten, + base::Unretained(this))); 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 18677fb..1fe4a8d 100644 --- a/webkit/fileapi/file_writer_delegate.h +++ b/webkit/fileapi/file_writer_delegate.h @@ -13,7 +13,6 @@ #include "base/platform_file.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" @@ -81,7 +80,6 @@ class FileWriterDelegate : public net::URLRequest::Delegate { scoped_refptr<net::IOBufferWithSize> io_buffer_; scoped_ptr<net::FileStream> file_stream_; net::URLRequest* request_; - net::OldCompletionCallbackImpl<FileWriterDelegate> io_callback_; ScopedRunnableMethodFactory<FileWriterDelegate> method_factory_; base::ScopedCallbackFactory<FileWriterDelegate> callback_factory_; }; |