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

Unified Diff: chrome/browser/browsing_data_file_system_helper.cc

Issue 8370026: base::Bind: Convert BrowsingDataFileSystemHelper::StartFetching. (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
Index: chrome/browser/browsing_data_file_system_helper.cc
diff --git a/chrome/browser/browsing_data_file_system_helper.cc b/chrome/browser/browsing_data_file_system_helper.cc
index ad367b65ec123bbcd5fe8d3497b7a36e1f7d535c..ae7c039af6b94c2e5031d260843b8a9cc8779e1b 100644
--- a/chrome/browser/browsing_data_file_system_helper.cc
+++ b/chrome/browser/browsing_data_file_system_helper.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/browsing_data_file_system_helper.h"
#include "base/bind.h"
+#include "base/compiler_specific.h"
#include "base/file_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
@@ -26,10 +27,10 @@ class BrowsingDataFileSystemHelperImpl : public BrowsingDataFileSystemHelper {
public:
// BrowsingDataFileSystemHelper implementation
explicit BrowsingDataFileSystemHelperImpl(Profile* profile);
- virtual void StartFetching(
- Callback1<const std::list<FileSystemInfo>& >::Type* callback);
- virtual void CancelNotification();
- virtual void DeleteFileSystemOrigin(const GURL& origin);
+ virtual void StartFetching(const base::Callback<
+ void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE;
+ virtual void CancelNotification() OVERRIDE;
+ virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE;
private:
virtual ~BrowsingDataFileSystemHelperImpl();
@@ -57,8 +58,7 @@ class BrowsingDataFileSystemHelperImpl : public BrowsingDataFileSystemHelper {
// Holds the callback passed in at the beginning of the StartFetching workflow
// so that it can be triggered via NotifyOnUIThread. This only mutates on the
// UI thread.
- scoped_ptr<Callback1<const std::list<FileSystemInfo>& >::Type >
- completion_callback_;
+ base::Callback<void(const std::list<FileSystemInfo>&)> completion_callback_;
// Indicates whether or not we're currently fetching information: set to true
// when StartFetching is called on the UI thread, and reset to false when
@@ -80,12 +80,12 @@ BrowsingDataFileSystemHelperImpl::~BrowsingDataFileSystemHelperImpl() {
}
void BrowsingDataFileSystemHelperImpl::StartFetching(
- Callback1<const std::list<FileSystemInfo>& >::Type* callback) {
+ const base::Callback<void(const std::list<FileSystemInfo>&)>& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!is_fetching_);
- DCHECK(callback);
+ DCHECK_EQ(false, callback.is_null());
is_fetching_ = true;
- completion_callback_.reset(callback);
+ completion_callback_ = callback;
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
base::Bind(
@@ -95,7 +95,7 @@ void BrowsingDataFileSystemHelperImpl::StartFetching(
void BrowsingDataFileSystemHelperImpl::CancelNotification() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- completion_callback_.reset();
+ completion_callback_.Reset();
}
void BrowsingDataFileSystemHelperImpl::DeleteFileSystemOrigin(
@@ -152,9 +152,9 @@ void BrowsingDataFileSystemHelperImpl::NotifyOnUIThread() {
DCHECK(is_fetching_);
// completion_callback_ mutates only in the UI thread, so we're safe to test
// it here.
- if (completion_callback_ != NULL) {
- completion_callback_->Run(file_system_info_);
- completion_callback_.reset();
+ if (!completion_callback_.is_null()) {
+ completion_callback_.Run(file_system_info_);
+ completion_callback_.Reset();
}
is_fetching_ = false;
}
@@ -254,12 +254,12 @@ bool CannedBrowsingDataFileSystemHelper::empty() const {
}
void CannedBrowsingDataFileSystemHelper::StartFetching(
- Callback1<const std::list<FileSystemInfo>& >::Type* callback) {
+ const base::Callback<void(const std::list<FileSystemInfo>&)>& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!is_fetching_);
- DCHECK(callback);
+ DCHECK_EQ(false, callback.is_null());
is_fetching_ = true;
- completion_callback_.reset(callback);
+ completion_callback_ = callback;
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -269,14 +269,14 @@ void CannedBrowsingDataFileSystemHelper::StartFetching(
void CannedBrowsingDataFileSystemHelper::NotifyOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(is_fetching_);
- if (completion_callback_ != NULL) {
- completion_callback_->Run(file_system_info_);
- completion_callback_.reset();
+ if (!completion_callback_.is_null()) {
+ completion_callback_.Run(file_system_info_);
+ completion_callback_.Reset();
}
is_fetching_ = false;
}
void CannedBrowsingDataFileSystemHelper::CancelNotification() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- completion_callback_.reset();
+ completion_callback_.Reset();
}
« no previous file with comments | « chrome/browser/browsing_data_file_system_helper.h ('k') | chrome/browser/browsing_data_file_system_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698