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

Unified Diff: base/file_util_proxy.cc

Issue 8322009: base::Bind: Convert FileUtilProxy::ReadDirectoryCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « base/file_util_proxy.h ('k') | webkit/fileapi/file_system_file_util_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_proxy.cc
diff --git a/base/file_util_proxy.cc b/base/file_util_proxy.cc
index 3a51b603dfa0ee0f11273317bf7cab71cb917fcb..771a5bea3e8fbfdec79cd5aad67cfe08b8a953a5 100644
--- a/base/file_util_proxy.cc
+++ b/base/file_util_proxy.cc
@@ -421,10 +421,12 @@ class RelayCreateDirectory : public RelayWithStatusCallback {
class RelayReadDirectory : public MessageLoopRelay {
public:
- RelayReadDirectory(const FilePath& file_path,
- base::FileUtilProxy::ReadDirectoryCallback* callback)
- : callback_(callback), file_path_(file_path) {
- DCHECK(callback);
+ RelayReadDirectory(
+ const FilePath& file_path,
+ const base::FileUtilProxy::ReadDirectoryCallback& callback)
+ : callback_(callback),
+ file_path_(file_path) {
+ DCHECK_EQ(false, callback.is_null());
}
protected:
@@ -456,12 +458,11 @@ class RelayReadDirectory : public MessageLoopRelay {
}
virtual void RunCallback() {
- callback_->Run(error_code(), entries_);
- delete callback_;
+ callback_.Run(error_code(), entries_);
}
private:
- base::FileUtilProxy::ReadDirectoryCallback* callback_;
+ base::FileUtilProxy::ReadDirectoryCallback callback_;
FilePath file_path_;
std::vector<base::FileUtilProxy::Entry> entries_;
};
@@ -790,7 +791,7 @@ bool FileUtilProxy::GetFileInfoFromPlatformFile(
bool FileUtilProxy::ReadDirectory(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
- ReadDirectoryCallback* callback) {
+ const ReadDirectoryCallback& callback) {
return Start(FROM_HERE, message_loop_proxy, new RelayReadDirectory(
file_path, callback));
}
« no previous file with comments | « base/file_util_proxy.h ('k') | webkit/fileapi/file_system_file_util_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698