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
CrOS-Libchrome-Original-Commit: 7bf4a8ef5ab46f4fe636fecce9cb0b86e2f5efe7
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 @@
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 @@
}
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::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..196043a 100644
--- a/base/file_util_proxy.h
+++ b/base/file_util_proxy.h
@@ -42,9 +42,9 @@
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 @@
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,