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() {
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 {
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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();
}
}
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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();
}
......
......@@ -40,7 +40,7 @@ class GetAllAutofillEntries
BrowserThread::PostTask(
BrowserThread::DB,
FROM_HERE,
NewRunnableMethod(this, &GetAllAutofillEntries::Run));
base::Bind(&GetAllAutofillEntries::Run, this));
done_event_.Wait();
}
......
......@@ -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();
}
......
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