Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Unified Diff: base/file_util_proxy.cc

Issue 8315012: base::Bind: Convert FileUtilProxy::GetFileInfoCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pipelining. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/file_util_proxy.cc
diff --git a/base/file_util_proxy.cc b/base/file_util_proxy.cc
index 8d90e381170e1ba532f7d9b7bec6f6422bd4b584..3a51b603dfa0ee0f11273317bf7cab71cb917fcb 100644
--- a/base/file_util_proxy.cc
+++ b/base/file_util_proxy.cc
@@ -469,10 +469,10 @@ class RelayReadDirectory : public MessageLoopRelay {
class RelayGetFileInfo : public MessageLoopRelay {
public:
RelayGetFileInfo(const FilePath& file_path,
- base::FileUtilProxy::GetFileInfoCallback* callback)
+ const base::FileUtilProxy::GetFileInfoCallback& callback)
: callback_(callback),
file_path_(file_path) {
- DCHECK(callback);
+ DCHECK_EQ(false, callback.is_null());
}
protected:
@@ -486,12 +486,11 @@ class RelayGetFileInfo : public MessageLoopRelay {
}
virtual void RunCallback() {
- callback_->Run(error_code(), file_info_);
- delete callback_;
+ callback_.Run(error_code(), file_info_);
}
private:
- base::FileUtilProxy::GetFileInfoCallback* callback_;
+ base::FileUtilProxy::GetFileInfoCallback callback_;
FilePath file_path_;
base::PlatformFileInfo file_info_;
};
@@ -500,10 +499,10 @@ class RelayGetFileInfoFromPlatformFile : public MessageLoopRelay {
public:
RelayGetFileInfoFromPlatformFile(
base::PlatformFile file,
- base::FileUtilProxy::GetFileInfoCallback* callback)
+ const base::FileUtilProxy::GetFileInfoCallback& callback)
: callback_(callback),
file_(file) {
- DCHECK(callback);
+ DCHECK_EQ(false, callback.is_null());
}
protected:
@@ -513,12 +512,11 @@ class RelayGetFileInfoFromPlatformFile : public MessageLoopRelay {
}
virtual void RunCallback() {
- callback_->Run(error_code(), file_info_);
- delete callback_;
+ callback_.Run(error_code(), file_info_);
}
private:
- base::FileUtilProxy::GetFileInfoCallback* callback_;
+ base::FileUtilProxy::GetFileInfoCallback callback_;
base::PlatformFile file_;
base::PlatformFileInfo file_info_;
};
@@ -774,7 +772,7 @@ bool FileUtilProxy::EnsureFileExists(
bool FileUtilProxy::GetFileInfo(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
- GetFileInfoCallback* callback) {
+ const GetFileInfoCallback& callback) {
return Start(FROM_HERE, message_loop_proxy, new RelayGetFileInfo(
file_path, callback));
}
@@ -783,7 +781,7 @@ bool FileUtilProxy::GetFileInfo(
bool FileUtilProxy::GetFileInfoFromPlatformFile(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
PlatformFile file,
- GetFileInfoCallback* callback) {
+ const GetFileInfoCallback& callback) {
return Start(FROM_HERE, message_loop_proxy,
new RelayGetFileInfoFromPlatformFile(file, callback));
}

Powered by Google App Engine
This is Rietveld 408576698