diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-17 19:29:29 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-17 19:29:29 +0000 |
commit | 7bf4a8ef5ab46f4fe636fecce9cb0b86e2f5efe7 (patch) | |
tree | a02ee7866aa2d648d8769ee6266bad8c1e280052 /base | |
parent | 39cc9bca6b008904ed5e70cc8b965c18a0382208 (diff) | |
download | chromium_src-7bf4a8ef5ab46f4fe636fecce9cb0b86e2f5efe7.zip chromium_src-7bf4a8ef5ab46f4fe636fecce9cb0b86e2f5efe7.tar.gz chromium_src-7bf4a8ef5ab46f4fe636fecce9cb0b86e2f5efe7.tar.bz2 |
base::Bind: Convert FileUtilProxy::CreateTemporaryCallback.
BUG=none
TEST=none
R=csilv@chromium.org
Review URL: http://codereview.chromium.org/8315011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105881 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/file_util_proxy.cc | 13 | ||||
-rw-r--r-- | base/file_util_proxy.h | 8 |
2 files changed, 10 insertions, 11 deletions
diff --git a/base/file_util_proxy.cc b/base/file_util_proxy.cc index bd9807b..2d4db8f 100644 --- a/base/file_util_proxy.cc +++ b/base/file_util_proxy.cc @@ -167,12 +167,12 @@ class RelayCreateTemporary : public MessageLoopRelay { RelayCreateTemporary( scoped_refptr<base::MessageLoopProxy> message_loop_proxy, int additional_file_flags, - base::FileUtilProxy::CreateTemporaryCallback* callback) + const base::FileUtilProxy::CreateTemporaryCallback& callback) : message_loop_proxy_(message_loop_proxy), additional_file_flags_(additional_file_flags), callback_(callback), file_handle_(base::kInvalidPlatformFileValue) { - DCHECK(callback); + DCHECK_EQ(false, callback.is_null()); } protected: @@ -199,15 +199,14 @@ class RelayCreateTemporary : public MessageLoopRelay { } virtual void RunCallback() { - callback_->Run(error_code(), base::PassPlatformFile(&file_handle_), - file_path_); - delete callback_; + callback_.Run(error_code(), base::PassPlatformFile(&file_handle_), + file_path_); } private: scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; int additional_file_flags_; - base::FileUtilProxy::CreateTemporaryCallback* callback_; + base::FileUtilProxy::CreateTemporaryCallback callback_; base::PlatformFile file_handle_; FilePath file_path_; }; @@ -747,7 +746,7 @@ bool FileUtilProxy::CreateOrOpen( bool FileUtilProxy::CreateTemporary( scoped_refptr<MessageLoopProxy> message_loop_proxy, int additional_file_flags, - CreateTemporaryCallback* callback) { + const CreateTemporaryCallback& callback) { return Start(FROM_HERE, message_loop_proxy, new RelayCreateTemporary(message_loop_proxy, additional_file_flags, diff --git a/base/file_util_proxy.h b/base/file_util_proxy.h index 808c60e..196043a1 100644 --- a/base/file_util_proxy.h +++ b/base/file_util_proxy.h @@ -42,9 +42,9 @@ class BASE_EXPORT FileUtilProxy { typedef base::Callback<void(PlatformFileError /* error code */, PassPlatformFile, bool /* created */)> CreateOrOpenCallback; - typedef Callback3<PlatformFileError /* error code */, - PassPlatformFile, - FilePath>::Type CreateTemporaryCallback; + typedef base::Callback<void(PlatformFileError /* error code */, + PassPlatformFile, + FilePath)> CreateTemporaryCallback; typedef Callback2<PlatformFileError /* error code */, bool /* created */>::Type EnsureFileExistsCallback; typedef Callback2<PlatformFileError /* error code */, @@ -80,7 +80,7 @@ class BASE_EXPORT FileUtilProxy { static bool CreateTemporary( scoped_refptr<MessageLoopProxy> message_loop_proxy, int additional_file_flags, - CreateTemporaryCallback* callback); + const CreateTemporaryCallback& callback); // Close the given file handle. static bool Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, |