summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 19:39:59 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 19:39:59 +0000
commitf1ef8d474706275552327bda10fa80590fd3d3e2 (patch)
tree32030a9cabfcb2ba043c1012bdf91987be6fc836 /base
parent27efc88c2c3150f7b668fa0dcb897fb940090481 (diff)
downloadchromium_src-f1ef8d474706275552327bda10fa80590fd3d3e2.zip
chromium_src-f1ef8d474706275552327bda10fa80590fd3d3e2.tar.gz
chromium_src-f1ef8d474706275552327bda10fa80590fd3d3e2.tar.bz2
base::Bind: Convert FileUtilProxy::EnsureFileExistsCallback.
BUG=none TEST=none R=csilv@chromium.org Review URL: http://codereview.chromium.org/8311012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105883 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/file_util_proxy.cc11
-rw-r--r--base/file_util_proxy.h6
2 files changed, 8 insertions, 9 deletions
diff --git a/base/file_util_proxy.cc b/base/file_util_proxy.cc
index 2d4db8f..8d90e38 100644
--- a/base/file_util_proxy.cc
+++ b/base/file_util_proxy.cc
@@ -255,12 +255,12 @@ class RelayEnsureFileExists : public MessageLoopRelay {
RelayEnsureFileExists(
scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
- base::FileUtilProxy::EnsureFileExistsCallback* callback)
+ const base::FileUtilProxy::EnsureFileExistsCallback& callback)
: message_loop_proxy_(message_loop_proxy),
file_path_(file_path),
callback_(callback),
created_(false) {
- DCHECK(callback);
+ DCHECK_EQ(false, callback.is_null());
}
protected:
@@ -288,14 +288,13 @@ class RelayEnsureFileExists : public MessageLoopRelay {
}
virtual void RunCallback() {
- callback_->Run(error_code(), created_);
- delete callback_;
+ callback_.Run(error_code(), created_);
}
private:
scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
FilePath file_path_;
- base::FileUtilProxy::EnsureFileExistsCallback* callback_;
+ base::FileUtilProxy::EnsureFileExistsCallback callback_;
bool created_;
};
@@ -765,7 +764,7 @@ bool FileUtilProxy::Close(scoped_refptr<MessageLoopProxy> message_loop_proxy,
bool FileUtilProxy::EnsureFileExists(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
- EnsureFileExistsCallback* callback) {
+ const EnsureFileExistsCallback& callback) {
return Start(FROM_HERE, message_loop_proxy, new RelayEnsureFileExists(
message_loop_proxy, file_path, callback));
}
diff --git a/base/file_util_proxy.h b/base/file_util_proxy.h
index 196043a1..fb3c5ce 100644
--- a/base/file_util_proxy.h
+++ b/base/file_util_proxy.h
@@ -45,8 +45,8 @@ class BASE_EXPORT FileUtilProxy {
typedef base::Callback<void(PlatformFileError /* error code */,
PassPlatformFile,
FilePath)> CreateTemporaryCallback;
- typedef Callback2<PlatformFileError /* error code */,
- bool /* created */>::Type EnsureFileExistsCallback;
+ typedef base::Callback<void(PlatformFileError /* error code */,
+ bool /* created */)> EnsureFileExistsCallback;
typedef Callback2<PlatformFileError /* error code */,
const PlatformFileInfo& /* file_info */
>::Type GetFileInfoCallback;
@@ -99,7 +99,7 @@ class BASE_EXPORT FileUtilProxy {
static bool EnsureFileExists(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
- EnsureFileExistsCallback* callback);
+ const EnsureFileExistsCallback& callback);
// Retrieves the information about a file. It is invalid to pass NULL for the
// callback.