diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-17 21:33:35 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-17 21:33:35 +0000 |
commit | aa0b33eda7f49c544a973b5acd8f9f0611d7e765 (patch) | |
tree | 98a598e8732046d497b3795287dc8d2dd389577f /webkit/fileapi/file_system_file_util_proxy.cc | |
parent | 28f3c9251dace27b202d71203756fecbbe3cbc15 (diff) | |
download | chromium_src-aa0b33eda7f49c544a973b5acd8f9f0611d7e765.zip chromium_src-aa0b33eda7f49c544a973b5acd8f9f0611d7e765.tar.gz chromium_src-aa0b33eda7f49c544a973b5acd8f9f0611d7e765.tar.bz2 |
base::Bind: Convert FileUtilProxy::StatusCallback.
BUG=none
TEST=none
R=csilv@chromium.org
Review URL: http://codereview.chromium.org/8318025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_file_util_proxy.cc')
-rw-r--r-- | webkit/fileapi/file_system_file_util_proxy.cc | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/webkit/fileapi/file_system_file_util_proxy.cc b/webkit/fileapi/file_system_file_util_proxy.cc index 40b5980..ad3e14c 100644 --- a/webkit/fileapi/file_system_file_util_proxy.cc +++ b/webkit/fileapi/file_system_file_util_proxy.cc @@ -93,8 +93,9 @@ class RelayCreateOrOpen : public MessageLoopRelay { protected: virtual ~RelayCreateOrOpen() { if (file_handle_ != base::kInvalidPlatformFileValue) - fileapi::FileSystemFileUtilProxy::Close(*context(), - message_loop_proxy_, file_handle_, NULL); + fileapi::FileSystemFileUtilProxy::Close( + *context(), message_loop_proxy_, file_handle_, + fileapi::FileSystemFileUtilProxy::StatusCallback()); } virtual void RunWork() { @@ -120,7 +121,7 @@ class RelayWithStatusCallback : public MessageLoopRelay { public: RelayWithStatusCallback( const fileapi::FileSystemOperationContext& context, - fileapi::FileSystemFileUtilProxy::StatusCallback* callback) + const fileapi::FileSystemFileUtilProxy::StatusCallback& callback) : MessageLoopRelay(context), callback_(callback) { // It is OK for callback to be NULL. @@ -129,21 +130,19 @@ class RelayWithStatusCallback : public MessageLoopRelay { protected: virtual void RunCallback() { // The caller may not have been interested in the result. - if (callback_) { - callback_->Run(error_code()); - delete callback_; - } + if (!callback_.is_null()) + callback_.Run(error_code()); } private: - fileapi::FileSystemFileUtilProxy::StatusCallback* callback_; + fileapi::FileSystemFileUtilProxy::StatusCallback callback_; }; class RelayClose : public RelayWithStatusCallback { public: RelayClose(const fileapi::FileSystemOperationContext& context, base::PlatformFile file_handle, - fileapi::FileSystemFileUtilProxy::StatusCallback* callback) + const fileapi::FileSystemFileUtilProxy::StatusCallback& callback) : RelayWithStatusCallback(context, callback), file_handle_(file_handle) { } @@ -283,7 +282,7 @@ class RelayCreateDirectory : public RelayWithStatusCallback { const FilePath& file_path, bool exclusive, bool recursive, - fileapi::FileSystemFileUtilProxy::StatusCallback* callback) + const fileapi::FileSystemFileUtilProxy::StatusCallback& callback) : RelayWithStatusCallback(context, callback), file_path_(file_path), exclusive_(exclusive), @@ -307,7 +306,7 @@ class RelayCopy : public RelayWithStatusCallback { RelayCopy(const fileapi::FileSystemOperationContext& context, const FilePath& src_file_path, const FilePath& dest_file_path, - fileapi::FileSystemFileUtilProxy::StatusCallback* callback) + const fileapi::FileSystemFileUtilProxy::StatusCallback& callback) : RelayWithStatusCallback(context, callback), src_file_path_(src_file_path), dest_file_path_(dest_file_path) { @@ -329,7 +328,7 @@ class RelayMove : public RelayWithStatusCallback { RelayMove(const fileapi::FileSystemOperationContext& context, const FilePath& src_file_path, const FilePath& dest_file_path, - fileapi::FileSystemFileUtilProxy::StatusCallback* callback) + const fileapi::FileSystemFileUtilProxy::StatusCallback& callback) : RelayWithStatusCallback(context, callback), src_file_path_(src_file_path), dest_file_path_(dest_file_path) { @@ -351,7 +350,7 @@ class RelayDelete : public RelayWithStatusCallback { RelayDelete(const fileapi::FileSystemOperationContext& context, const FilePath& file_path, bool recursive, - fileapi::FileSystemFileUtilProxy::StatusCallback* callback) + const fileapi::FileSystemFileUtilProxy::StatusCallback& callback) : RelayWithStatusCallback(context, callback), file_path_(file_path), recursive_(recursive) { @@ -369,11 +368,12 @@ class RelayDelete : public RelayWithStatusCallback { class RelayTouchFilePath : public RelayWithStatusCallback { public: - RelayTouchFilePath(const fileapi::FileSystemOperationContext& context, - const FilePath& file_path, - const base::Time& last_access_time, - const base::Time& last_modified_time, - fileapi::FileSystemFileUtilProxy::StatusCallback* callback) + RelayTouchFilePath( + const fileapi::FileSystemOperationContext& context, + const FilePath& file_path, + const base::Time& last_access_time, + const base::Time& last_modified_time, + const fileapi::FileSystemFileUtilProxy::StatusCallback& callback) : RelayWithStatusCallback(context, callback), file_path_(file_path), last_access_time_(last_access_time), @@ -394,10 +394,11 @@ class RelayTouchFilePath : public RelayWithStatusCallback { class RelayTruncate : public RelayWithStatusCallback { public: - RelayTruncate(const fileapi::FileSystemOperationContext& context, - const FilePath& file_path, - int64 length, - fileapi::FileSystemFileUtilProxy::StatusCallback* callback) + RelayTruncate( + const fileapi::FileSystemOperationContext& context, + const FilePath& file_path, + int64 length, + const fileapi::FileSystemFileUtilProxy::StatusCallback& callback) : RelayWithStatusCallback(context, callback), file_path_(file_path), length_(length) { @@ -438,7 +439,7 @@ bool FileSystemFileUtilProxy::Close( const FileSystemOperationContext& context, scoped_refptr<MessageLoopProxy> message_loop_proxy, base::PlatformFile file_handle, - StatusCallback* callback) { + const StatusCallback& callback) { return Start(FROM_HERE, message_loop_proxy, new RelayClose(context, file_handle, callback)); } @@ -490,7 +491,7 @@ bool FileSystemFileUtilProxy::CreateDirectory( const FilePath& file_path, bool exclusive, bool recursive, - StatusCallback* callback) { + const StatusCallback& callback) { return Start(FROM_HERE, message_loop_proxy, new RelayCreateDirectory( context, file_path, exclusive, recursive, callback)); } @@ -501,7 +502,7 @@ bool FileSystemFileUtilProxy::Copy( scoped_refptr<MessageLoopProxy> message_loop_proxy, const FilePath& src_file_path, const FilePath& dest_file_path, - StatusCallback* callback) { + const StatusCallback& callback) { return Start(FROM_HERE, message_loop_proxy, new RelayCopy(context, src_file_path, dest_file_path, callback)); @@ -513,7 +514,7 @@ bool FileSystemFileUtilProxy::Move( scoped_refptr<MessageLoopProxy> message_loop_proxy, const FilePath& src_file_path, const FilePath& dest_file_path, - StatusCallback* callback) { + const StatusCallback& callback) { return Start(FROM_HERE, message_loop_proxy, new RelayMove(context, src_file_path, dest_file_path, callback)); @@ -525,7 +526,7 @@ bool FileSystemFileUtilProxy::Delete( scoped_refptr<MessageLoopProxy> message_loop_proxy, const FilePath& file_path, bool recursive, - StatusCallback* callback) { + const StatusCallback& callback) { return Start(FROM_HERE, message_loop_proxy, new RelayDelete(context, file_path, recursive, callback)); } @@ -537,7 +538,7 @@ bool FileSystemFileUtilProxy::Touch( const FilePath& file_path, const base::Time& last_access_time, const base::Time& last_modified_time, - StatusCallback* callback) { + const StatusCallback& callback) { return Start(FROM_HERE, message_loop_proxy, new RelayTouchFilePath(context, file_path, last_access_time, last_modified_time, callback)); @@ -549,7 +550,7 @@ bool FileSystemFileUtilProxy::Truncate( scoped_refptr<MessageLoopProxy> message_loop_proxy, const FilePath& path, int64 length, - StatusCallback* callback) { + const StatusCallback& callback) { return Start(FROM_HERE, message_loop_proxy, new RelayTruncate(context, path, length, callback)); } |