Commit 09e170f5 authored by rickcam@chromium.org's avatar rickcam@chromium.org

Converted top-level NewRunnableMethod and straggler NewRunnableFunction usage...

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
parent 0bfff1df
...@@ -93,9 +93,7 @@ bool AutofillDataTypeController::StartAssociationAsync() { ...@@ -93,9 +93,7 @@ bool AutofillDataTypeController::StartAssociationAsync() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_EQ(state(), ASSOCIATING); DCHECK_EQ(state(), ASSOCIATING);
return BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, return BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
NewRunnableMethod( base::Bind(&AutofillDataTypeController::StartAssociation, this));
this,
&AutofillDataTypeController::StartAssociation));
} }
void AutofillDataTypeController::CreateSyncComponents() { void AutofillDataTypeController::CreateSyncComponents() {
...@@ -122,9 +120,7 @@ bool AutofillDataTypeController::StopAssociationAsync() { ...@@ -122,9 +120,7 @@ bool AutofillDataTypeController::StopAssociationAsync() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_EQ(state(), STOPPING); DCHECK_EQ(state(), STOPPING);
return BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, return BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
NewRunnableMethod( base::Bind(&AutofillDataTypeController::StopAssociation, this));
this,
&AutofillDataTypeController::StopAssociation));
} }
syncable::ModelType AutofillDataTypeController::type() const { syncable::ModelType AutofillDataTypeController::type() const {
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/sync/glue/browser_thread_model_worker.h" #include "chrome/browser/sync/glue/browser_thread_model_worker.h"
#include "base/bind.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
...@@ -28,12 +29,8 @@ UnrecoverableErrorInfo BrowserThreadModelWorker::DoWorkAndWaitUntilDone( ...@@ -28,12 +29,8 @@ UnrecoverableErrorInfo BrowserThreadModelWorker::DoWorkAndWaitUntilDone(
if (!BrowserThread::PostTask( if (!BrowserThread::PostTask(
thread_, thread_,
FROM_HERE, FROM_HERE,
NewRunnableMethod( base::Bind(&BrowserThreadModelWorker::CallDoWorkAndSignalTask, this,
this, work, &done, &error_info))) {
&BrowserThreadModelWorker::CallDoWorkAndSignalTask,
work,
&done,
&error_info))) {
NOTREACHED() << "Failed to post task to thread " << thread_; NOTREACHED() << "Failed to post task to thread " << thread_;
return error_info; return error_info;
} }
......
...@@ -193,7 +193,7 @@ bool HttpBridge::MakeSynchronousPost(int* error_code, int* response_code) { ...@@ -193,7 +193,7 @@ bool HttpBridge::MakeSynchronousPost(int* error_code, int* response_code) {
if (!BrowserThread::PostTask( if (!BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE, BrowserThread::IO, FROM_HERE,
NewRunnableMethod(this, &HttpBridge::CallMakeAsynchronousPost))) { base::Bind(&HttpBridge::CallMakeAsynchronousPost, this))) {
// This usually happens when we're in a unit test. // This usually happens when we're in a unit test.
LOG(WARNING) << "Could not post CallMakeAsynchronousPost task"; LOG(WARNING) << "Could not post CallMakeAsynchronousPost task";
return false; return false;
......
...@@ -46,7 +46,7 @@ bool PasswordDataTypeController::StartAssociationAsync() { ...@@ -46,7 +46,7 @@ bool PasswordDataTypeController::StartAssociationAsync() {
DCHECK_EQ(state(), ASSOCIATING); DCHECK_EQ(state(), ASSOCIATING);
DCHECK(password_store_.get()); DCHECK(password_store_.get());
password_store_->ScheduleTask( password_store_->ScheduleTask(
NewRunnableMethod(this, &PasswordDataTypeController::StartAssociation)); base::Bind(&PasswordDataTypeController::StartAssociation, this));
return true; return true;
} }
...@@ -67,7 +67,7 @@ bool PasswordDataTypeController::StopAssociationAsync() { ...@@ -67,7 +67,7 @@ bool PasswordDataTypeController::StopAssociationAsync() {
DCHECK_EQ(state(), STOPPING); DCHECK_EQ(state(), STOPPING);
DCHECK(password_store_.get()); DCHECK(password_store_.get());
password_store_->ScheduleTask( password_store_->ScheduleTask(
NewRunnableMethod(this, &PasswordDataTypeController::StopAssociation)); base::Bind(&PasswordDataTypeController::StopAssociation, this));
return true; return true;
} }
......
...@@ -26,8 +26,8 @@ UnrecoverableErrorInfo PasswordModelWorker::DoWorkAndWaitUntilDone( ...@@ -26,8 +26,8 @@ UnrecoverableErrorInfo PasswordModelWorker::DoWorkAndWaitUntilDone(
WaitableEvent done(false, false); WaitableEvent done(false, false);
UnrecoverableErrorInfo error_info; UnrecoverableErrorInfo error_info;
password_store_->ScheduleTask( password_store_->ScheduleTask(
NewRunnableMethod(this, &PasswordModelWorker::CallDoWorkAndSignalTask, base::Bind(&PasswordModelWorker::CallDoWorkAndSignalTask,
work, &done, &error_info)); this, work, &done, &error_info));
done.Wait(); done.Wait();
return error_info; return error_info;
} }
......
...@@ -135,21 +135,19 @@ void SyncBackendHost::Initialize( ...@@ -135,21 +135,19 @@ void SyncBackendHost::Initialize(
void SyncBackendHost::InitCore(const Core::DoInitializeOptions& options) { void SyncBackendHost::InitCore(const Core::DoInitializeOptions& options) {
sync_thread_.message_loop()->PostTask(FROM_HERE, sync_thread_.message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoInitialize, base::Bind(&SyncBackendHost::Core::DoInitialize, core_.get(),options));
options));
} }
void SyncBackendHost::UpdateCredentials(const SyncCredentials& credentials) { void SyncBackendHost::UpdateCredentials(const SyncCredentials& credentials) {
sync_thread_.message_loop()->PostTask(FROM_HERE, sync_thread_.message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(core_.get(), base::Bind(&SyncBackendHost::Core::DoUpdateCredentials, core_.get(),
&SyncBackendHost::Core::DoUpdateCredentials, credentials));
credentials));
} }
void SyncBackendHost::StartSyncingWithServer() { void SyncBackendHost::StartSyncingWithServer() {
SVLOG(1) << "SyncBackendHost::StartSyncingWithServer called."; SVLOG(1) << "SyncBackendHost::StartSyncingWithServer called.";
sync_thread_.message_loop()->PostTask(FROM_HERE, 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, void SyncBackendHost::SetPassphrase(const std::string& passphrase,
...@@ -164,8 +162,8 @@ 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 // If encryption is enabled and we've got a SetPassphrase
sync_thread_.message_loop()->PostTask(FROM_HERE, sync_thread_.message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoSetPassphrase, base::Bind(&SyncBackendHost::Core::DoSetPassphrase, core_.get(),
passphrase, is_explicit)); passphrase, is_explicit));
} }
void SyncBackendHost::StopSyncManagerForShutdown( void SyncBackendHost::StopSyncManagerForShutdown(
...@@ -222,9 +220,8 @@ void SyncBackendHost::Shutdown(bool sync_disabled) { ...@@ -222,9 +220,8 @@ void SyncBackendHost::Shutdown(bool sync_disabled) {
// TODO(tim): DCHECK(registrar_->StoppedOnUIThread()) would be nice. // TODO(tim): DCHECK(registrar_->StoppedOnUIThread()) would be nice.
if (sync_thread_.IsRunning()) { if (sync_thread_.IsRunning()) {
sync_thread_.message_loop()->PostTask(FROM_HERE, sync_thread_.message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(core_.get(), base::Bind(&SyncBackendHost::Core::DoShutdown, core_.get(),
&SyncBackendHost::Core::DoShutdown, sync_disabled));
sync_disabled));
} }
// Stop will return once the thread exits, which will be after DoShutdown // Stop will return once the thread exits, which will be after DoShutdown
...@@ -282,27 +279,27 @@ void SyncBackendHost::ConfigureDataTypes( ...@@ -282,27 +279,27 @@ void SyncBackendHost::ConfigureDataTypes(
if (!types_to_remove_with_nigori.empty()) { if (!types_to_remove_with_nigori.empty()) {
sync_thread_.message_loop()->PostTask( sync_thread_.message_loop()->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod( base::Bind(&SyncBackendHost::Core::DoRequestCleanupDisabledTypes,
core_.get(), core_.get()));
&SyncBackendHost::Core::DoRequestCleanupDisabledTypes));
} }
StartConfiguration(base::Bind( StartConfiguration(
&SyncBackendHost::Core::FinishConfigureDataTypes, core_.get())); base::Bind(&SyncBackendHost::Core::FinishConfigureDataTypes,
core_.get()));
} }
void SyncBackendHost::StartConfiguration(const base::Closure& callback) { void SyncBackendHost::StartConfiguration(const base::Closure& callback) {
// Put syncer in the config mode. DTM will put us in normal mode once it is // 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 // done. This is to ensure we dont do a normal sync when we are doing model
// association. // association.
sync_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod( sync_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
core_.get(), &SyncBackendHost::Core::DoStartConfiguration, callback)); &SyncBackendHost::Core::DoStartConfiguration, core_.get(), callback));
} }
void SyncBackendHost::EnableEncryptEverything() { void SyncBackendHost::EnableEncryptEverything() {
sync_thread_.message_loop()->PostTask(FROM_HERE, sync_thread_.message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(core_.get(), base::Bind(&SyncBackendHost::Core::DoEnableEncryptEverything,
&SyncBackendHost::Core::DoEnableEncryptEverything)); core_.get()));
} }
void SyncBackendHost::ActivateDataType( void SyncBackendHost::ActivateDataType(
...@@ -317,12 +314,11 @@ void SyncBackendHost::DeactivateDataType(syncable::ModelType type) { ...@@ -317,12 +314,11 @@ void SyncBackendHost::DeactivateDataType(syncable::ModelType type) {
bool SyncBackendHost::RequestClearServerData() { bool SyncBackendHost::RequestClearServerData() {
sync_thread_.message_loop()->PostTask(FROM_HERE, sync_thread_.message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(core_.get(), base::Bind(&SyncBackendHost::Core::DoRequestClearServerData,
&SyncBackendHost::Core::DoRequestClearServerData)); core_.get()));
return true; return true;
} }
sync_api::UserShare* SyncBackendHost::GetUserShare() const { sync_api::UserShare* SyncBackendHost::GetUserShare() const {
DCHECK(initialized()); DCHECK(initialized());
return core_->sync_manager()->GetUserShare(); return core_->sync_manager()->GetUserShare();
...@@ -407,8 +403,9 @@ void SyncBackendHost::Core::OnSyncCycleCompleted( ...@@ -407,8 +403,9 @@ void SyncBackendHost::Core::OnSyncCycleCompleted(
if (!sync_loop_) if (!sync_loop_)
return; return;
DCHECK_EQ(MessageLoop::current(), sync_loop_); DCHECK_EQ(MessageLoop::current(), sync_loop_);
host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, host_->frontend_loop_->PostTask(FROM_HERE, base::Bind(
&Core::HandleSyncCycleCompletedOnFrontendLoop, &Core::HandleSyncCycleCompletedOnFrontendLoop,
this,
new SyncSessionSnapshot(*snapshot))); new SyncSessionSnapshot(*snapshot)));
} }
...@@ -419,13 +416,11 @@ void SyncBackendHost::Core::OnInitializationComplete( ...@@ -419,13 +416,11 @@ void SyncBackendHost::Core::OnInitializationComplete(
DCHECK_EQ(MessageLoop::current(), sync_loop_); DCHECK_EQ(MessageLoop::current(), sync_loop_);
host_->frontend_loop_->PostTask(FROM_HERE, host_->frontend_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this, base::Bind(&Core::HandleInitializationCompletedOnFrontendLoop, this,
&Core::HandleInitializationCompletedOnFrontendLoop, js_backend, success));
js_backend, success));
// Initialization is complete, so we can schedule recurring SaveChanges. // Initialization is complete, so we can schedule recurring SaveChanges.
sync_loop_->PostTask(FROM_HERE, sync_loop_->PostTask(FROM_HERE, base::Bind(&Core::StartSavingChanges, this));
NewRunnableMethod(this, &Core::StartSavingChanges));
} }
void SyncBackendHost::Core::OnAuthError(const AuthError& auth_error) { void SyncBackendHost::Core::OnAuthError(const AuthError& auth_error) {
...@@ -434,8 +429,7 @@ 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_); DCHECK_EQ(MessageLoop::current(), sync_loop_);
// Post to our core loop so we can modify state. Could be on another thread. // Post to our core loop so we can modify state. Could be on another thread.
host_->frontend_loop_->PostTask(FROM_HERE, host_->frontend_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this, &Core::HandleAuthErrorEventOnFrontendLoop, base::Bind(&Core::HandleAuthErrorEventOnFrontendLoop, this, auth_error));
auth_error));
} }
void SyncBackendHost::Core::OnPassphraseRequired( void SyncBackendHost::Core::OnPassphraseRequired(
...@@ -444,7 +438,7 @@ void SyncBackendHost::Core::OnPassphraseRequired( ...@@ -444,7 +438,7 @@ void SyncBackendHost::Core::OnPassphraseRequired(
return; return;
DCHECK_EQ(MessageLoop::current(), sync_loop_); DCHECK_EQ(MessageLoop::current(), sync_loop_);
host_->frontend_loop_->PostTask(FROM_HERE, host_->frontend_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this, &Core::NotifyPassphraseRequired, reason)); base::Bind(&Core::NotifyPassphraseRequired, this, reason));
} }
void SyncBackendHost::Core::OnPassphraseAccepted( void SyncBackendHost::Core::OnPassphraseAccepted(
...@@ -453,40 +447,39 @@ void SyncBackendHost::Core::OnPassphraseAccepted( ...@@ -453,40 +447,39 @@ void SyncBackendHost::Core::OnPassphraseAccepted(
return; return;
DCHECK_EQ(MessageLoop::current(), sync_loop_); DCHECK_EQ(MessageLoop::current(), sync_loop_);
host_->frontend_loop_->PostTask(FROM_HERE, host_->frontend_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this, &Core::NotifyPassphraseAccepted, base::Bind(&Core::NotifyPassphraseAccepted, this, bootstrap_token));
bootstrap_token));
} }
void SyncBackendHost::Core::OnStopSyncingPermanently() { void SyncBackendHost::Core::OnStopSyncingPermanently() {
if (!sync_loop_) if (!sync_loop_)
return; return;
DCHECK_EQ(MessageLoop::current(), sync_loop_); DCHECK_EQ(MessageLoop::current(), sync_loop_);
host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, host_->frontend_loop_->PostTask(FROM_HERE, base::Bind(
&Core::HandleStopSyncingPermanentlyOnFrontendLoop)); &Core::HandleStopSyncingPermanentlyOnFrontendLoop, this));
} }
void SyncBackendHost::Core::OnUpdatedToken(const std::string& token) { void SyncBackendHost::Core::OnUpdatedToken(const std::string& token) {
if (!sync_loop_) if (!sync_loop_)
return; return;
DCHECK_EQ(MessageLoop::current(), sync_loop_); DCHECK_EQ(MessageLoop::current(), sync_loop_);
host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, host_->frontend_loop_->PostTask(FROM_HERE, base::Bind(
&Core::NotifyUpdatedToken, token)); &Core::NotifyUpdatedToken, this, token));
} }
void SyncBackendHost::Core::OnClearServerDataFailed() { void SyncBackendHost::Core::OnClearServerDataFailed() {
if (!sync_loop_) if (!sync_loop_)
return; return;
DCHECK_EQ(MessageLoop::current(), sync_loop_); DCHECK_EQ(MessageLoop::current(), sync_loop_);
host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, host_->frontend_loop_->PostTask(FROM_HERE, base::Bind(
&Core::HandleClearServerDataFailedOnFrontendLoop)); &Core::HandleClearServerDataFailedOnFrontendLoop, this));
} }
void SyncBackendHost::Core::OnClearServerDataSucceeded() { void SyncBackendHost::Core::OnClearServerDataSucceeded() {
if (!sync_loop_) if (!sync_loop_)
return; return;
DCHECK_EQ(MessageLoop::current(), sync_loop_); DCHECK_EQ(MessageLoop::current(), sync_loop_);
host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, host_->frontend_loop_->PostTask(FROM_HERE, base::Bind(
&Core::HandleClearServerDataSucceededOnFrontendLoop)); &Core::HandleClearServerDataSucceededOnFrontendLoop, this));
} }
void SyncBackendHost::Core::OnEncryptedTypesChanged( void SyncBackendHost::Core::OnEncryptedTypesChanged(
...@@ -519,8 +512,8 @@ void SyncBackendHost::Core::OnActionableError( ...@@ -519,8 +512,8 @@ void SyncBackendHost::Core::OnActionableError(
DCHECK_EQ(MessageLoop::current(), sync_loop_); DCHECK_EQ(MessageLoop::current(), sync_loop_);
host_->frontend_loop_->PostTask( host_->frontend_loop_->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod(this, &Core::HandleActionableErrorEventOnFrontendLoop, base::Bind(&Core::HandleActionableErrorEventOnFrontendLoop, this,
sync_error)); sync_error));
} }
SyncBackendHost::Core::DoInitializeOptions::DoInitializeOptions( SyncBackendHost::Core::DoInitializeOptions::DoInitializeOptions(
...@@ -714,8 +707,8 @@ void SyncBackendHost::Core::DeleteSyncDataFolder() { ...@@ -714,8 +707,8 @@ void SyncBackendHost::Core::DeleteSyncDataFolder() {
void SyncBackendHost::Core::FinishConfigureDataTypes() { void SyncBackendHost::Core::FinishConfigureDataTypes() {
DCHECK_EQ(MessageLoop::current(), sync_loop_); DCHECK_EQ(MessageLoop::current(), sync_loop_);
host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, host_->frontend_loop_->PostTask(FROM_HERE, base::Bind(
&SyncBackendHost::Core::FinishConfigureDataTypesOnFrontendLoop)); &SyncBackendHost::Core::FinishConfigureDataTypesOnFrontendLoop, this));
} }
void SyncBackendHost::Core::HandleInitializationCompletedOnFrontendLoop( void SyncBackendHost::Core::HandleInitializationCompletedOnFrontendLoop(
...@@ -946,9 +939,8 @@ void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop( ...@@ -946,9 +939,8 @@ void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop(
// reachability check. // reachability check.
sync_thread_.message_loop()->PostTask( sync_thread_.message_loop()->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod( base::Bind(&SyncBackendHost::Core::DoCheckServerReachable,
core_.get(), core_.get()));
&SyncBackendHost::Core::DoCheckServerReachable));
break; break;
default: default:
NOTREACHED(); NOTREACHED();
...@@ -1001,18 +993,17 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() { ...@@ -1001,18 +993,17 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() {
SVLOG(1) << "Types " << ModelTypeSetToString(types_to_config) SVLOG(1) << "Types " << ModelTypeSetToString(types_to_config)
<< " added; calling DoRequestConfig"; << " added; calling DoRequestConfig";
sync_thread_.message_loop()->PostTask(FROM_HERE, sync_thread_.message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(core_.get(), base::Bind(&SyncBackendHost::Core::DoRequestConfig,
&SyncBackendHost::Core::DoRequestConfig, core_.get(),
syncable::ModelTypeBitSetFromSet(types_to_config), syncable::ModelTypeBitSetFromSet(types_to_config),
pending_download_state_->reason)); pending_download_state_->reason));
} }
pending_config_mode_state_.reset(); pending_config_mode_state_.reset();
// Notify the SyncManager about the new types. // Notify the SyncManager about the new types.
sync_thread_.message_loop()->PostTask(FROM_HERE, sync_thread_.message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(core_.get(), base::Bind(&SyncBackendHost::Core::DoUpdateEnabledTypes, core_.get()));
&SyncBackendHost::Core::DoUpdateEnabledTypes));
} }
sync_api::HttpPostProviderFactory* SyncBackendHost::MakeHttpBridgeFactory( sync_api::HttpPostProviderFactory* SyncBackendHost::MakeHttpBridgeFactory(
......
...@@ -159,9 +159,9 @@ NonBlockingInvalidationNotifier::NonBlockingInvalidationNotifier( ...@@ -159,9 +159,9 @@ NonBlockingInvalidationNotifier::NonBlockingInvalidationNotifier(
GetIOMessageLoopProxy()) { GetIOMessageLoopProxy()) {
if (!io_message_loop_proxy_->PostTask( if (!io_message_loop_proxy_->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod( base::Bind(
core_.get(),
&NonBlockingInvalidationNotifier::Core::Initialize, &NonBlockingInvalidationNotifier::Core::Initialize,
core_.get(),
notifier_options, notifier_options,
initial_max_invalidation_versions, initial_max_invalidation_versions,
invalidation_version_tracker, invalidation_version_tracker,
...@@ -174,9 +174,8 @@ NonBlockingInvalidationNotifier::~NonBlockingInvalidationNotifier() { ...@@ -174,9 +174,8 @@ NonBlockingInvalidationNotifier::~NonBlockingInvalidationNotifier() {
DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread());
if (!io_message_loop_proxy_->PostTask( if (!io_message_loop_proxy_->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod( base::Bind(&NonBlockingInvalidationNotifier::Core::Teardown,
core_.get(), core_.get()))) {
&NonBlockingInvalidationNotifier::Core::Teardown))) {
NOTREACHED(); NOTREACHED();
} }
} }
...@@ -198,10 +197,8 @@ void NonBlockingInvalidationNotifier::SetUniqueId( ...@@ -198,10 +197,8 @@ void NonBlockingInvalidationNotifier::SetUniqueId(
DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread());
if (!io_message_loop_proxy_->PostTask( if (!io_message_loop_proxy_->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod( base::Bind(&NonBlockingInvalidationNotifier::Core::SetUniqueId,
core_.get(), core_.get(), unique_id))) {
&NonBlockingInvalidationNotifier::Core::SetUniqueId,
unique_id))) {
NOTREACHED(); NOTREACHED();
} }
} }
...@@ -210,10 +207,8 @@ void NonBlockingInvalidationNotifier::SetState(const std::string& state) { ...@@ -210,10 +207,8 @@ void NonBlockingInvalidationNotifier::SetState(const std::string& state) {
DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread());
if (!io_message_loop_proxy_->PostTask( if (!io_message_loop_proxy_->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod( base::Bind(&NonBlockingInvalidationNotifier::Core::SetState,
core_.get(), core_.get(), state))) {
&NonBlockingInvalidationNotifier::Core::SetState,
state))) {
NOTREACHED(); NOTREACHED();
} }
} }
...@@ -223,10 +218,8 @@ void NonBlockingInvalidationNotifier::UpdateCredentials( ...@@ -223,10 +218,8 @@ void NonBlockingInvalidationNotifier::UpdateCredentials(
DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread());
if (!io_message_loop_proxy_->PostTask( if (!io_message_loop_proxy_->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod( base::Bind(&NonBlockingInvalidationNotifier::Core::UpdateCredentials,
core_.get(), core_.get(), email, token))) {
&NonBlockingInvalidationNotifier::Core::UpdateCredentials,
email, token))) {
NOTREACHED(); NOTREACHED();
} }
} }
...@@ -236,10 +229,8 @@ void NonBlockingInvalidationNotifier::UpdateEnabledTypes( ...@@ -236,10 +229,8 @@ void NonBlockingInvalidationNotifier::UpdateEnabledTypes(
DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread());
if (!io_message_loop_proxy_->PostTask( if (!io_message_loop_proxy_->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod( base::Bind(&NonBlockingInvalidationNotifier::Core::UpdateEnabledTypes,
core_.get(), core_.get(), enabled_types))) {
&NonBlockingInvalidationNotifier::Core::UpdateEnabledTypes,
enabled_types))) {
NOTREACHED(); NOTREACHED();
} }
} }
......
...@@ -585,7 +585,7 @@ class WriteTransactionTest: public WriteTransaction { ...@@ -585,7 +585,7 @@ class WriteTransactionTest: public WriteTransaction {
// Our fake server updater. Needs the RefCountedThreadSafe inheritance so we can // Our fake server updater. Needs the RefCountedThreadSafe inheritance so we can
// post tasks with it. // post tasks with it.
class FakeServerUpdater: public base::RefCountedThreadSafe<FakeServerUpdater> { class FakeServerUpdater : public base::RefCountedThreadSafe<FakeServerUpdater> {
public: public:
FakeServerUpdater(TestProfileSyncService* service, FakeServerUpdater(TestProfileSyncService* service,
scoped_ptr<WaitableEvent>* wait_for_start, scoped_ptr<WaitableEvent>* wait_for_start,
...@@ -652,7 +652,7 @@ class FakeServerUpdater: public base::RefCountedThreadSafe<FakeServerUpdater> { ...@@ -652,7 +652,7 @@ class FakeServerUpdater: public base::RefCountedThreadSafe<FakeServerUpdater> {
&FakeServerUpdater::Update)); &FakeServerUpdater::Update));
ASSERT_FALSE(BrowserThread::CurrentlyOn(BrowserThread::DB)); ASSERT_FALSE(BrowserThread::CurrentlyOn(BrowserThread::DB));
if (!BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 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."; NOTREACHED() << "Failed to post task to the db thread.";
return; return;
} }
...@@ -665,7 +665,7 @@ class FakeServerUpdater: public base::RefCountedThreadSafe<FakeServerUpdater> { ...@@ -665,7 +665,7 @@ class FakeServerUpdater: public base::RefCountedThreadSafe<FakeServerUpdater> {
ASSERT_FALSE(BrowserThread::CurrentlyOn(BrowserThread::DB)); ASSERT_FALSE(BrowserThread::CurrentlyOn(BrowserThread::DB));
is_finished_.Reset(); is_finished_.Reset();
if (!BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 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."; NOTREACHED() << "Failed to post task to the db thread.";
return; return;
} }
......
...@@ -764,8 +764,8 @@ bool ProfileSyncServiceHarness::AwaitStatusChangeWithTimeout( ...@@ -764,8 +764,8 @@ bool ProfileSyncServiceHarness::AwaitStatusChangeWithTimeout(
loop->SetNestableTasksAllowed(true); loop->SetNestableTasksAllowed(true);
loop->PostDelayedTask( loop->PostDelayedTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod(timeout_signal.get(), base::Bind(&StateChangeTimeoutEvent::Callback,
&StateChangeTimeoutEvent::Callback), timeout_signal.get()),
timeout_milliseconds); timeout_milliseconds);
loop->Run(); loop->Run();
loop->SetNestableTasksAllowed(did_allow_nestable_tasks); loop->SetNestableTasksAllowed(did_allow_nestable_tasks);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/sync/profile_sync_test_util.h" #include "chrome/browser/sync/profile_sync_test_util.h"
#include "base/bind.h"
#include "base/task.h" #include "base/task.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
...@@ -20,7 +21,7 @@ void ThreadNotificationService::Init() { ...@@ -20,7 +21,7 @@ void ThreadNotificationService::Init() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
notification_thread_->message_loop()->PostTask( notification_thread_->message_loop()->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod(this, &ThreadNotificationService::InitTask)); base::Bind(&ThreadNotificationService::InitTask, this));
done_event_.Wait(); done_event_.Wait();
} }
...@@ -28,8 +29,7 @@ void ThreadNotificationService::TearDown() { ...@@ -28,8 +29,7 @@ void ThreadNotificationService::TearDown() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
notification_thread_->message_loop()->PostTask( notification_thread_->message_loop()->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod(this, base::Bind(&ThreadNotificationService::TearDownTask, this));
&ThreadNotificationService::TearDownTask));
done_event_.Wait(); done_event_.Wait();
} }
...@@ -60,11 +60,7 @@ void ThreadNotifier::Notify(int type, ...@@ -60,11 +60,7 @@ void ThreadNotifier::Notify(int type,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
notify_thread_->message_loop()->PostTask( notify_thread_->message_loop()->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod(this, base::Bind(&ThreadNotifier::NotifyTask, this, type, source, details));
&ThreadNotifier::NotifyTask,
type,
source,
details));
done_event_.Wait(); done_event_.Wait();
} }
......
...@@ -40,7 +40,7 @@ class GetAllAutofillEntries ...@@ -40,7 +40,7 @@ class GetAllAutofillEntries
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::DB, BrowserThread::DB,
FROM_HERE, FROM_HERE,
NewRunnableMethod(this, &GetAllAutofillEntries::Run)); base::Bind(&GetAllAutofillEntries::Run, this));
done_event_.Wait(); done_event_.Wait();
} }
......
...@@ -66,7 +66,7 @@ void AddLogin(PasswordStore* store, const PasswordForm& form) { ...@@ -66,7 +66,7 @@ void AddLogin(PasswordStore* store, const PasswordForm& form) {
ASSERT_TRUE(store); ASSERT_TRUE(store);
base::WaitableEvent wait_event(true, false); base::WaitableEvent wait_event(true, false);
store->AddLogin(form); store->AddLogin(form);
store->ScheduleTask(NewRunnableFunction(&PasswordStoreCallback, &wait_event)); store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event));
wait_event.Wait(); wait_event.Wait();
} }
...@@ -74,7 +74,7 @@ void UpdateLogin(PasswordStore* store, const PasswordForm& form) { ...@@ -74,7 +74,7 @@ void UpdateLogin(PasswordStore* store, const PasswordForm& form) {
ASSERT_TRUE(store); ASSERT_TRUE(store);
base::WaitableEvent wait_event(true, false); base::WaitableEvent wait_event(true, false);
store->UpdateLogin(form); store->UpdateLogin(form);
store->ScheduleTask(NewRunnableFunction(&PasswordStoreCallback, &wait_event)); store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event));
wait_event.Wait(); wait_event.Wait();
} }
...@@ -91,7 +91,7 @@ void RemoveLogin(PasswordStore* store, const PasswordForm& form) { ...@@ -91,7 +91,7 @@ void RemoveLogin(PasswordStore* store, const PasswordForm& form) {
ASSERT_TRUE(store); ASSERT_TRUE(store);
base::WaitableEvent wait_event(true, false); base::WaitableEvent wait_event(true, false);
store->RemoveLogin(form); store->RemoveLogin(form);
store->ScheduleTask(NewRunnableFunction(&PasswordStoreCallback, &wait_event)); store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event));
wait_event.Wait(); wait_event.Wait();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment