diff options
author | rickcam@chromium.org <rickcam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-28 23:22:02 +0000 |
---|---|---|
committer | rickcam@chromium.org <rickcam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-28 23:22:02 +0000 |
commit | 09e170f529d967d978bf55fb1c698834a76c0f67 (patch) | |
tree | 7c6096a11eb5851ebe2c922dfc262042adfe1707 | |
parent | 0bfff1df077e9ab9ad9be9bb877a360ea4f2f925 (diff) | |
download | chromium_src-09e170f529d967d978bf55fb1c698834a76c0f67.zip chromium_src-09e170f529d967d978bf55fb1c698834a76c0f67.tar.gz chromium_src-09e170f529d967d978bf55fb1c698834a76c0f67.tar.bz2 |
Converted top-level NewRunnableMethod and straggler NewRunnableFunction usage to Bind for Sync module
BUG=102167
TEST=unit_tests/regression
Review URL: http://codereview.chromium.org/8341117
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107822 0039d316-1c4b-4281-b951-d872f2087c98
12 files changed, 81 insertions, 110 deletions
diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.cc b/chrome/browser/sync/glue/autofill_data_type_controller.cc index bd96339..e583986 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller.cc @@ -93,9 +93,7 @@ bool AutofillDataTypeController::StartAssociationAsync() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_EQ(state(), ASSOCIATING); return BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, - NewRunnableMethod( - this, - &AutofillDataTypeController::StartAssociation)); + base::Bind(&AutofillDataTypeController::StartAssociation, this)); } void AutofillDataTypeController::CreateSyncComponents() { @@ -122,9 +120,7 @@ bool AutofillDataTypeController::StopAssociationAsync() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_EQ(state(), STOPPING); return BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, - NewRunnableMethod( - this, - &AutofillDataTypeController::StopAssociation)); + base::Bind(&AutofillDataTypeController::StopAssociation, this)); } syncable::ModelType AutofillDataTypeController::type() const { diff --git a/chrome/browser/sync/glue/browser_thread_model_worker.cc b/chrome/browser/sync/glue/browser_thread_model_worker.cc index 43626c4..907ac3a 100644 --- a/chrome/browser/sync/glue/browser_thread_model_worker.cc +++ b/chrome/browser/sync/glue/browser_thread_model_worker.cc @@ -4,6 +4,7 @@ #include "chrome/browser/sync/glue/browser_thread_model_worker.h" +#include "base/bind.h" #include "base/synchronization/waitable_event.h" #include "content/public/browser/browser_thread.h" @@ -28,12 +29,8 @@ UnrecoverableErrorInfo BrowserThreadModelWorker::DoWorkAndWaitUntilDone( if (!BrowserThread::PostTask( thread_, FROM_HERE, - NewRunnableMethod( - this, - &BrowserThreadModelWorker::CallDoWorkAndSignalTask, - work, - &done, - &error_info))) { + base::Bind(&BrowserThreadModelWorker::CallDoWorkAndSignalTask, this, + work, &done, &error_info))) { NOTREACHED() << "Failed to post task to thread " << thread_; return error_info; } diff --git a/chrome/browser/sync/glue/http_bridge.cc b/chrome/browser/sync/glue/http_bridge.cc index 228418f..a0f0c70 100644 --- a/chrome/browser/sync/glue/http_bridge.cc +++ b/chrome/browser/sync/glue/http_bridge.cc @@ -193,7 +193,7 @@ bool HttpBridge::MakeSynchronousPost(int* error_code, int* response_code) { if (!BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod(this, &HttpBridge::CallMakeAsynchronousPost))) { + base::Bind(&HttpBridge::CallMakeAsynchronousPost, this))) { // This usually happens when we're in a unit test. LOG(WARNING) << "Could not post CallMakeAsynchronousPost task"; return false; diff --git a/chrome/browser/sync/glue/password_data_type_controller.cc b/chrome/browser/sync/glue/password_data_type_controller.cc index 508e9de..22a218a 100644 --- a/chrome/browser/sync/glue/password_data_type_controller.cc +++ b/chrome/browser/sync/glue/password_data_type_controller.cc @@ -46,7 +46,7 @@ bool PasswordDataTypeController::StartAssociationAsync() { DCHECK_EQ(state(), ASSOCIATING); DCHECK(password_store_.get()); password_store_->ScheduleTask( - NewRunnableMethod(this, &PasswordDataTypeController::StartAssociation)); + base::Bind(&PasswordDataTypeController::StartAssociation, this)); return true; } @@ -67,7 +67,7 @@ bool PasswordDataTypeController::StopAssociationAsync() { DCHECK_EQ(state(), STOPPING); DCHECK(password_store_.get()); password_store_->ScheduleTask( - NewRunnableMethod(this, &PasswordDataTypeController::StopAssociation)); + base::Bind(&PasswordDataTypeController::StopAssociation, this)); return true; } diff --git a/chrome/browser/sync/glue/password_model_worker.cc b/chrome/browser/sync/glue/password_model_worker.cc index 2024f3b..d0f3c26 100644 --- a/chrome/browser/sync/glue/password_model_worker.cc +++ b/chrome/browser/sync/glue/password_model_worker.cc @@ -26,8 +26,8 @@ UnrecoverableErrorInfo PasswordModelWorker::DoWorkAndWaitUntilDone( WaitableEvent done(false, false); UnrecoverableErrorInfo error_info; password_store_->ScheduleTask( - NewRunnableMethod(this, &PasswordModelWorker::CallDoWorkAndSignalTask, - work, &done, &error_info)); + base::Bind(&PasswordModelWorker::CallDoWorkAndSignalTask, + this, work, &done, &error_info)); done.Wait(); return error_info; } diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index b8397e7..67f364f 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -135,21 +135,19 @@ void SyncBackendHost::Initialize( void SyncBackendHost::InitCore(const Core::DoInitializeOptions& options) { sync_thread_.message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoInitialize, - options)); + base::Bind(&SyncBackendHost::Core::DoInitialize, core_.get(),options)); } void SyncBackendHost::UpdateCredentials(const SyncCredentials& credentials) { sync_thread_.message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(core_.get(), - &SyncBackendHost::Core::DoUpdateCredentials, - credentials)); + base::Bind(&SyncBackendHost::Core::DoUpdateCredentials, core_.get(), + credentials)); } void SyncBackendHost::StartSyncingWithServer() { SVLOG(1) << "SyncBackendHost::StartSyncingWithServer called."; sync_thread_.message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoStartSyncing)); + base::Bind(&SyncBackendHost::Core::DoStartSyncing, core_.get())); } void SyncBackendHost::SetPassphrase(const std::string& passphrase, @@ -164,8 +162,8 @@ void SyncBackendHost::SetPassphrase(const std::string& passphrase, // If encryption is enabled and we've got a SetPassphrase sync_thread_.message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoSetPassphrase, - passphrase, is_explicit)); + base::Bind(&SyncBackendHost::Core::DoSetPassphrase, core_.get(), + passphrase, is_explicit)); } void SyncBackendHost::StopSyncManagerForShutdown( @@ -222,9 +220,8 @@ void SyncBackendHost::Shutdown(bool sync_disabled) { // TODO(tim): DCHECK(registrar_->StoppedOnUIThread()) would be nice. if (sync_thread_.IsRunning()) { sync_thread_.message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(core_.get(), - &SyncBackendHost::Core::DoShutdown, - sync_disabled)); + base::Bind(&SyncBackendHost::Core::DoShutdown, core_.get(), + sync_disabled)); } // Stop will return once the thread exits, which will be after DoShutdown @@ -282,27 +279,27 @@ void SyncBackendHost::ConfigureDataTypes( if (!types_to_remove_with_nigori.empty()) { sync_thread_.message_loop()->PostTask( FROM_HERE, - NewRunnableMethod( - core_.get(), - &SyncBackendHost::Core::DoRequestCleanupDisabledTypes)); + base::Bind(&SyncBackendHost::Core::DoRequestCleanupDisabledTypes, + core_.get())); } - StartConfiguration(base::Bind( - &SyncBackendHost::Core::FinishConfigureDataTypes, core_.get())); + StartConfiguration( + base::Bind(&SyncBackendHost::Core::FinishConfigureDataTypes, + core_.get())); } void SyncBackendHost::StartConfiguration(const base::Closure& callback) { // Put syncer in the config mode. DTM will put us in normal mode once it is // done. This is to ensure we dont do a normal sync when we are doing model // association. - sync_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod( - core_.get(), &SyncBackendHost::Core::DoStartConfiguration, callback)); + sync_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( + &SyncBackendHost::Core::DoStartConfiguration, core_.get(), callback)); } void SyncBackendHost::EnableEncryptEverything() { sync_thread_.message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(core_.get(), - &SyncBackendHost::Core::DoEnableEncryptEverything)); + base::Bind(&SyncBackendHost::Core::DoEnableEncryptEverything, + core_.get())); } void SyncBackendHost::ActivateDataType( @@ -317,12 +314,11 @@ void SyncBackendHost::DeactivateDataType(syncable::ModelType type) { bool SyncBackendHost::RequestClearServerData() { sync_thread_.message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(core_.get(), - &SyncBackendHost::Core::DoRequestClearServerData)); + base::Bind(&SyncBackendHost::Core::DoRequestClearServerData, + core_.get())); return true; } - sync_api::UserShare* SyncBackendHost::GetUserShare() const { DCHECK(initialized()); return core_->sync_manager()->GetUserShare(); @@ -407,8 +403,9 @@ void SyncBackendHost::Core::OnSyncCycleCompleted( if (!sync_loop_) return; DCHECK_EQ(MessageLoop::current(), sync_loop_); - host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, + host_->frontend_loop_->PostTask(FROM_HERE, base::Bind( &Core::HandleSyncCycleCompletedOnFrontendLoop, + this, new SyncSessionSnapshot(*snapshot))); } @@ -419,13 +416,11 @@ void SyncBackendHost::Core::OnInitializationComplete( DCHECK_EQ(MessageLoop::current(), sync_loop_); host_->frontend_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, - &Core::HandleInitializationCompletedOnFrontendLoop, - js_backend, success)); + base::Bind(&Core::HandleInitializationCompletedOnFrontendLoop, this, + js_backend, success)); // Initialization is complete, so we can schedule recurring SaveChanges. - sync_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, &Core::StartSavingChanges)); + sync_loop_->PostTask(FROM_HERE, base::Bind(&Core::StartSavingChanges, this)); } void SyncBackendHost::Core::OnAuthError(const AuthError& auth_error) { @@ -434,8 +429,7 @@ void SyncBackendHost::Core::OnAuthError(const AuthError& auth_error) { DCHECK_EQ(MessageLoop::current(), sync_loop_); // Post to our core loop so we can modify state. Could be on another thread. host_->frontend_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, &Core::HandleAuthErrorEventOnFrontendLoop, - auth_error)); + base::Bind(&Core::HandleAuthErrorEventOnFrontendLoop, this, auth_error)); } void SyncBackendHost::Core::OnPassphraseRequired( @@ -444,7 +438,7 @@ void SyncBackendHost::Core::OnPassphraseRequired( return; DCHECK_EQ(MessageLoop::current(), sync_loop_); host_->frontend_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, &Core::NotifyPassphraseRequired, reason)); + base::Bind(&Core::NotifyPassphraseRequired, this, reason)); } void SyncBackendHost::Core::OnPassphraseAccepted( @@ -453,40 +447,39 @@ void SyncBackendHost::Core::OnPassphraseAccepted( return; DCHECK_EQ(MessageLoop::current(), sync_loop_); host_->frontend_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, &Core::NotifyPassphraseAccepted, - bootstrap_token)); + base::Bind(&Core::NotifyPassphraseAccepted, this, bootstrap_token)); } void SyncBackendHost::Core::OnStopSyncingPermanently() { if (!sync_loop_) return; DCHECK_EQ(MessageLoop::current(), sync_loop_); - host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, - &Core::HandleStopSyncingPermanentlyOnFrontendLoop)); + host_->frontend_loop_->PostTask(FROM_HERE, base::Bind( + &Core::HandleStopSyncingPermanentlyOnFrontendLoop, this)); } void SyncBackendHost::Core::OnUpdatedToken(const std::string& token) { if (!sync_loop_) return; DCHECK_EQ(MessageLoop::current(), sync_loop_); - host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, - &Core::NotifyUpdatedToken, token)); + host_->frontend_loop_->PostTask(FROM_HERE, base::Bind( + &Core::NotifyUpdatedToken, this, token)); } void SyncBackendHost::Core::OnClearServerDataFailed() { if (!sync_loop_) return; DCHECK_EQ(MessageLoop::current(), sync_loop_); - host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, - &Core::HandleClearServerDataFailedOnFrontendLoop)); + host_->frontend_loop_->PostTask(FROM_HERE, base::Bind( + &Core::HandleClearServerDataFailedOnFrontendLoop, this)); } void SyncBackendHost::Core::OnClearServerDataSucceeded() { if (!sync_loop_) return; DCHECK_EQ(MessageLoop::current(), sync_loop_); - host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, - &Core::HandleClearServerDataSucceededOnFrontendLoop)); + host_->frontend_loop_->PostTask(FROM_HERE, base::Bind( + &Core::HandleClearServerDataSucceededOnFrontendLoop, this)); } void SyncBackendHost::Core::OnEncryptedTypesChanged( @@ -519,8 +512,8 @@ void SyncBackendHost::Core::OnActionableError( DCHECK_EQ(MessageLoop::current(), sync_loop_); host_->frontend_loop_->PostTask( FROM_HERE, - NewRunnableMethod(this, &Core::HandleActionableErrorEventOnFrontendLoop, - sync_error)); + base::Bind(&Core::HandleActionableErrorEventOnFrontendLoop, this, + sync_error)); } SyncBackendHost::Core::DoInitializeOptions::DoInitializeOptions( @@ -714,8 +707,8 @@ void SyncBackendHost::Core::DeleteSyncDataFolder() { void SyncBackendHost::Core::FinishConfigureDataTypes() { DCHECK_EQ(MessageLoop::current(), sync_loop_); - host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, - &SyncBackendHost::Core::FinishConfigureDataTypesOnFrontendLoop)); + host_->frontend_loop_->PostTask(FROM_HERE, base::Bind( + &SyncBackendHost::Core::FinishConfigureDataTypesOnFrontendLoop, this)); } void SyncBackendHost::Core::HandleInitializationCompletedOnFrontendLoop( @@ -946,9 +939,8 @@ void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop( // reachability check. sync_thread_.message_loop()->PostTask( FROM_HERE, - NewRunnableMethod( - core_.get(), - &SyncBackendHost::Core::DoCheckServerReachable)); + base::Bind(&SyncBackendHost::Core::DoCheckServerReachable, + core_.get())); break; default: NOTREACHED(); @@ -1001,18 +993,17 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() { SVLOG(1) << "Types " << ModelTypeSetToString(types_to_config) << " added; calling DoRequestConfig"; sync_thread_.message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(core_.get(), - &SyncBackendHost::Core::DoRequestConfig, - syncable::ModelTypeBitSetFromSet(types_to_config), - pending_download_state_->reason)); + base::Bind(&SyncBackendHost::Core::DoRequestConfig, + core_.get(), + syncable::ModelTypeBitSetFromSet(types_to_config), + pending_download_state_->reason)); } pending_config_mode_state_.reset(); // Notify the SyncManager about the new types. sync_thread_.message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(core_.get(), - &SyncBackendHost::Core::DoUpdateEnabledTypes)); + base::Bind(&SyncBackendHost::Core::DoUpdateEnabledTypes, core_.get())); } sync_api::HttpPostProviderFactory* SyncBackendHost::MakeHttpBridgeFactory( diff --git a/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.cc b/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.cc index 8534b12..40a1f91 100644 --- a/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.cc +++ b/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.cc @@ -159,9 +159,9 @@ NonBlockingInvalidationNotifier::NonBlockingInvalidationNotifier( GetIOMessageLoopProxy()) { if (!io_message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod( - core_.get(), + base::Bind( &NonBlockingInvalidationNotifier::Core::Initialize, + core_.get(), notifier_options, initial_max_invalidation_versions, invalidation_version_tracker, @@ -174,9 +174,8 @@ NonBlockingInvalidationNotifier::~NonBlockingInvalidationNotifier() { DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); if (!io_message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod( - core_.get(), - &NonBlockingInvalidationNotifier::Core::Teardown))) { + base::Bind(&NonBlockingInvalidationNotifier::Core::Teardown, + core_.get()))) { NOTREACHED(); } } @@ -198,10 +197,8 @@ void NonBlockingInvalidationNotifier::SetUniqueId( DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); if (!io_message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod( - core_.get(), - &NonBlockingInvalidationNotifier::Core::SetUniqueId, - unique_id))) { + base::Bind(&NonBlockingInvalidationNotifier::Core::SetUniqueId, + core_.get(), unique_id))) { NOTREACHED(); } } @@ -210,10 +207,8 @@ void NonBlockingInvalidationNotifier::SetState(const std::string& state) { DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); if (!io_message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod( - core_.get(), - &NonBlockingInvalidationNotifier::Core::SetState, - state))) { + base::Bind(&NonBlockingInvalidationNotifier::Core::SetState, + core_.get(), state))) { NOTREACHED(); } } @@ -223,10 +218,8 @@ void NonBlockingInvalidationNotifier::UpdateCredentials( DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); if (!io_message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod( - core_.get(), - &NonBlockingInvalidationNotifier::Core::UpdateCredentials, - email, token))) { + base::Bind(&NonBlockingInvalidationNotifier::Core::UpdateCredentials, + core_.get(), email, token))) { NOTREACHED(); } } @@ -236,10 +229,8 @@ void NonBlockingInvalidationNotifier::UpdateEnabledTypes( DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); if (!io_message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod( - core_.get(), - &NonBlockingInvalidationNotifier::Core::UpdateEnabledTypes, - enabled_types))) { + base::Bind(&NonBlockingInvalidationNotifier::Core::UpdateEnabledTypes, + core_.get(), enabled_types))) { NOTREACHED(); } } diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc index e1b9d0f..d2551bc 100644 --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc @@ -585,7 +585,7 @@ class WriteTransactionTest: public WriteTransaction { // Our fake server updater. Needs the RefCountedThreadSafe inheritance so we can // post tasks with it. -class FakeServerUpdater: public base::RefCountedThreadSafe<FakeServerUpdater> { +class FakeServerUpdater : public base::RefCountedThreadSafe<FakeServerUpdater> { public: FakeServerUpdater(TestProfileSyncService* service, scoped_ptr<WaitableEvent>* wait_for_start, @@ -652,7 +652,7 @@ class FakeServerUpdater: public base::RefCountedThreadSafe<FakeServerUpdater> { &FakeServerUpdater::Update)); ASSERT_FALSE(BrowserThread::CurrentlyOn(BrowserThread::DB)); if (!BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, - NewRunnableMethod(this, &FakeServerUpdater::Update))) { + base::Bind(&FakeServerUpdater::Update, this))) { NOTREACHED() << "Failed to post task to the db thread."; return; } @@ -665,7 +665,7 @@ class FakeServerUpdater: public base::RefCountedThreadSafe<FakeServerUpdater> { ASSERT_FALSE(BrowserThread::CurrentlyOn(BrowserThread::DB)); is_finished_.Reset(); if (!BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, - NewRunnableMethod(this, &FakeServerUpdater::Update))) { + base::Bind(&FakeServerUpdater::Update, this))) { NOTREACHED() << "Failed to post task to the db thread."; return; } diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc index d0ef6a2..7c18538 100644 --- a/chrome/browser/sync/profile_sync_service_harness.cc +++ b/chrome/browser/sync/profile_sync_service_harness.cc @@ -764,8 +764,8 @@ bool ProfileSyncServiceHarness::AwaitStatusChangeWithTimeout( loop->SetNestableTasksAllowed(true); loop->PostDelayedTask( FROM_HERE, - NewRunnableMethod(timeout_signal.get(), - &StateChangeTimeoutEvent::Callback), + base::Bind(&StateChangeTimeoutEvent::Callback, + timeout_signal.get()), timeout_milliseconds); loop->Run(); loop->SetNestableTasksAllowed(did_allow_nestable_tasks); diff --git a/chrome/browser/sync/profile_sync_test_util.cc b/chrome/browser/sync/profile_sync_test_util.cc index dcf41aa..bdbb810 100644 --- a/chrome/browser/sync/profile_sync_test_util.cc +++ b/chrome/browser/sync/profile_sync_test_util.cc @@ -4,6 +4,7 @@ #include "chrome/browser/sync/profile_sync_test_util.h" +#include "base/bind.h" #include "base/task.h" #include "base/threading/thread.h" @@ -20,7 +21,7 @@ void ThreadNotificationService::Init() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); notification_thread_->message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &ThreadNotificationService::InitTask)); + base::Bind(&ThreadNotificationService::InitTask, this)); done_event_.Wait(); } @@ -28,8 +29,7 @@ void ThreadNotificationService::TearDown() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); notification_thread_->message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, - &ThreadNotificationService::TearDownTask)); + base::Bind(&ThreadNotificationService::TearDownTask, this)); done_event_.Wait(); } @@ -60,11 +60,7 @@ void ThreadNotifier::Notify(int type, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); notify_thread_->message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, - &ThreadNotifier::NotifyTask, - type, - source, - details)); + base::Bind(&ThreadNotifier::NotifyTask, this, type, source, details)); done_event_.Wait(); } diff --git a/chrome/browser/sync/test/integration/autofill_helper.cc b/chrome/browser/sync/test/integration/autofill_helper.cc index 9ff003d..72a2d55 100644 --- a/chrome/browser/sync/test/integration/autofill_helper.cc +++ b/chrome/browser/sync/test/integration/autofill_helper.cc @@ -40,7 +40,7 @@ class GetAllAutofillEntries BrowserThread::PostTask( BrowserThread::DB, FROM_HERE, - NewRunnableMethod(this, &GetAllAutofillEntries::Run)); + base::Bind(&GetAllAutofillEntries::Run, this)); done_event_.Wait(); } diff --git a/chrome/browser/sync/test/integration/passwords_helper.cc b/chrome/browser/sync/test/integration/passwords_helper.cc index f1e5715..5628e44 100644 --- a/chrome/browser/sync/test/integration/passwords_helper.cc +++ b/chrome/browser/sync/test/integration/passwords_helper.cc @@ -66,7 +66,7 @@ void AddLogin(PasswordStore* store, const PasswordForm& form) { ASSERT_TRUE(store); base::WaitableEvent wait_event(true, false); store->AddLogin(form); - store->ScheduleTask(NewRunnableFunction(&PasswordStoreCallback, &wait_event)); + store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event)); wait_event.Wait(); } @@ -74,7 +74,7 @@ void UpdateLogin(PasswordStore* store, const PasswordForm& form) { ASSERT_TRUE(store); base::WaitableEvent wait_event(true, false); store->UpdateLogin(form); - store->ScheduleTask(NewRunnableFunction(&PasswordStoreCallback, &wait_event)); + store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event)); wait_event.Wait(); } @@ -91,7 +91,7 @@ void RemoveLogin(PasswordStore* store, const PasswordForm& form) { ASSERT_TRUE(store); base::WaitableEvent wait_event(true, false); store->RemoveLogin(form); - store->ScheduleTask(NewRunnableFunction(&PasswordStoreCallback, &wait_event)); + store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event)); wait_event.Wait(); } |