Replace MessageLoopProxy with ThreadTaskRunnerHandle in src/sync/.

MessageLoopProxy is deprecated.

BUG=391045

Review URL: https://codereview.chromium.org/375403002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282129 0039d316-1c4b-4281-b951-d872f2087c98
parent e59bbf24
......@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/thread_task_runner_handle.h"
#include "sync/api/attachments/attachment.h"
#include "sync/internal_api/public/attachments/fake_attachment_downloader.h"
#include "sync/internal_api/public/attachments/fake_attachment_store.h"
......@@ -127,7 +128,7 @@ AttachmentServiceImpl::~AttachmentServiceImpl() {
// Static.
scoped_ptr<syncer::AttachmentService> AttachmentServiceImpl::CreateForTest() {
scoped_ptr<syncer::AttachmentStore> attachment_store(
new syncer::FakeAttachmentStore(base::MessageLoopProxy::current()));
new syncer::FakeAttachmentStore(base::ThreadTaskRunnerHandle::Get()));
scoped_ptr<AttachmentUploader> attachment_uploader(
new FakeAttachmentUploader);
scoped_ptr<AttachmentDownloader> attachment_downloader(
......
......@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/thread_task_runner_handle.h"
#include "sync/api/sync_data.h"
namespace syncer {
......@@ -71,8 +72,10 @@ void AttachmentServiceProxy::GetOrDownloadAttachments(
const AttachmentIdList& attachment_ids,
const GetOrDownloadCallback& callback) {
DCHECK(wrapped_task_runner_);
GetOrDownloadCallback proxy_callback = base::Bind(
&ProxyGetOrDownloadCallback, base::MessageLoopProxy::current(), callback);
GetOrDownloadCallback proxy_callback =
base::Bind(&ProxyGetOrDownloadCallback,
base::ThreadTaskRunnerHandle::Get(),
callback);
wrapped_task_runner_->PostTask(
FROM_HERE,
base::Bind(&AttachmentService::GetOrDownloadAttachments,
......@@ -86,7 +89,7 @@ void AttachmentServiceProxy::DropAttachments(
const DropCallback& callback) {
DCHECK(wrapped_task_runner_);
DropCallback proxy_callback = base::Bind(
&ProxyDropCallback, base::MessageLoopProxy::current(), callback);
&ProxyDropCallback, base::ThreadTaskRunnerHandle::Get(), callback);
wrapped_task_runner_->PostTask(FROM_HERE,
base::Bind(&AttachmentService::DropAttachments,
core_,
......@@ -98,7 +101,7 @@ void AttachmentServiceProxy::StoreAttachments(const AttachmentList& attachments,
const StoreCallback& callback) {
DCHECK(wrapped_task_runner_);
StoreCallback proxy_callback = base::Bind(
&ProxyStoreCallback, base::MessageLoopProxy::current(), callback);
&ProxyStoreCallback, base::ThreadTaskRunnerHandle::Get(), callback);
wrapped_task_runner_->PostTask(
FROM_HERE,
base::Bind(&AttachmentService::StoreAttachments,
......
......@@ -5,7 +5,7 @@
#include "sync/api/attachments/attachment_service_proxy_for_test.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/thread_task_runner_handle.h"
#include "sync/api/attachments/attachment_service_impl.h"
namespace syncer {
......@@ -39,7 +39,7 @@ AttachmentServiceProxy AttachmentServiceProxyForTest::Create() {
new OwningCore(wrapped.Pass(), weak_ptr_factory.Pass()));
scoped_refptr<base::SequencedTaskRunner> runner(
base::MessageLoopProxy::current());
base::ThreadTaskRunnerHandle::Get());
if (!runner) {
// Dummy runner for tests that don't care about AttachmentServiceProxy.
DVLOG(1) << "Creating dummy MessageLoop for AttachmentServiceProxy.";
......
......@@ -8,7 +8,7 @@
#include "base/memory/ref_counted_memory.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "sync/api/attachments/attachment_id.h"
#include "sync/api/attachments/attachment_service.h"
......@@ -35,7 +35,7 @@ class SyncDataTest : public testing::Test {
: attachment_service(AttachmentServiceImpl::CreateForTest()),
attachment_service_weak_ptr_factory(attachment_service.get()),
attachment_service_proxy(
base::MessageLoopProxy::current(),
base::ThreadTaskRunnerHandle::Get(),
attachment_service_weak_ptr_factory.GetWeakPtr()) {}
base::MessageLoop loop;
sync_pb::EntitySpecifics specifics;
......
......@@ -6,7 +6,6 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/message_loop/message_loop_proxy.h"
#include "sync/engine/model_type_entity.h"
#include "sync/engine/model_type_sync_worker.h"
#include "sync/internal_api/public/sync_context_proxy.h"
......
......@@ -8,6 +8,7 @@
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/thread_task_runner_handle.h"
#include "google_apis/gaia/fake_oauth2_token_service.h"
#include "google_apis/gaia/gaia_constants.h"
#include "net/url_request/test_url_fetcher_factory.h"
......@@ -111,7 +112,7 @@ class TokenServiceProvider
};
TokenServiceProvider::TokenServiceProvider(OAuth2TokenService* token_service)
: task_runner_(base::MessageLoopProxy::current()),
: task_runner_(base::ThreadTaskRunnerHandle::Get()),
token_service_(token_service) {
DCHECK(token_service_);
}
......
......@@ -7,9 +7,9 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/memory/ref_counted_memory.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "sync/api/attachments/attachment.h"
namespace syncer {
......@@ -96,7 +96,7 @@ void FakeAttachmentStore::Backend::Drop(const AttachmentIdList& ids,
FakeAttachmentStore::FakeAttachmentStore(
const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner)
: backend_(new Backend(base::MessageLoopProxy::current())),
: backend_(new Backend(base::ThreadTaskRunnerHandle::Get())),
backend_task_runner_(backend_task_runner) {}
FakeAttachmentStore::~FakeAttachmentStore() {}
......
......@@ -8,6 +8,7 @@
#include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/thread_task_runner_handle.h"
#include "sync/api/attachments/attachment.h"
#include "sync/protocol/sync.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -32,7 +33,7 @@ class FakeAttachmentStoreTest : public testing::Test {
scoped_refptr<base::RefCountedString> some_data1;
scoped_refptr<base::RefCountedString> some_data2;
FakeAttachmentStoreTest() : store(base::MessageLoopProxy::current()) {}
FakeAttachmentStoreTest() : store(base::ThreadTaskRunnerHandle::Get()) {}
virtual void SetUp() {
Clear();
......
......@@ -5,7 +5,6 @@
#include "sync/internal_api/public/http_bridge.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/strings/string_number_conversions.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
......
......@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/message_loop/message_loop_proxy.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "net/test/spawned_test_server/spawned_test_server.h"
......
......@@ -6,7 +6,8 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "sync/engine/non_blocking_sync_common.h"
#include "sync/internal_api/public/sync_context.h"
......@@ -31,7 +32,7 @@ void SyncContextProxyImpl::ConnectTypeToSync(
sync_context_,
type,
data_type_state,
base::MessageLoopProxy::current(),
base::ThreadTaskRunnerHandle::Get(),
type_sync_proxy));
}
......
......@@ -3,9 +3,9 @@
// found in the LICENSE file.
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/run_loop.h"
#include "base/sequenced_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "sync/engine/model_type_sync_proxy_impl.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/sync_context.h"
......@@ -18,8 +18,8 @@ namespace syncer {
class SyncContextProxyImplTest : public ::testing::Test {
public:
SyncContextProxyImplTest()
: sync_task_runner_(base::MessageLoopProxy::current()),
type_task_runner_(base::MessageLoopProxy::current()),
: sync_task_runner_(base::ThreadTaskRunnerHandle::Get()),
type_task_runner_(base::ThreadTaskRunnerHandle::Get()),
registry_(new ModelTypeRegistry()),
context_proxy_(sync_task_runner_, registry_->AsWeakPtr()) {}
......
......@@ -15,6 +15,7 @@
#include "base/metrics/histogram.h"
#include "base/observer_list.h"
#include "base/strings/string_number_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "base/values.h"
#include "sync/engine/sync_scheduler.h"
#include "sync/engine/syncer_types.h"
......@@ -403,7 +404,7 @@ void SyncManagerImpl::Init(
weak_core.get();
sync_context_proxy_.reset(
new SyncContextProxyImpl(base::MessageLoopProxy::current(), weak_core));
new SyncContextProxyImpl(base::ThreadTaskRunnerHandle::Get(), weak_core));
// Build a SyncSessionContext and store the worker in it.
DVLOG(1) << "Sync is bringing up SyncSessionContext.";
......
......@@ -17,7 +17,6 @@
#include "base/location.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
......
......@@ -5,8 +5,8 @@
#include "sync/sessions/model_type_registry.h"
#include "base/bind.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/observer_list.h"
#include "base/thread_task_runner_handle.h"
#include "sync/engine/directory_commit_contributor.h"
#include "sync/engine/directory_update_handler.h"
#include "sync/engine/model_type_sync_proxy.h"
......@@ -200,7 +200,7 @@ void ModelTypeRegistry::ConnectSyncTypeToWorker(
scoped_ptr<ModelTypeSyncWorker> wrapped_worker(
new ModelTypeSyncWorkerWrapper(worker->AsWeakPtr(),
scoped_refptr<base::SequencedTaskRunner>(
base::MessageLoopProxy::current())));
base::ThreadTaskRunnerHandle::Get())));
type_task_runner->PostTask(FROM_HERE,
base::Bind(&ModelTypeSyncProxyImpl::OnConnect,
proxy_impl,
......
......@@ -6,6 +6,7 @@
#include "base/deferred_sequenced_task_runner.h"
#include "base/message_loop/message_loop.h"
#include "base/thread_task_runner_handle.h"
#include "sync/engine/model_type_sync_proxy_impl.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/sessions/model_type_registry.h"
......@@ -143,7 +144,8 @@ TEST_F(ModelTypeRegistryTest, NonBlockingTypes) {
ModelTypeSyncProxyImpl themes_sync_proxy(syncer::THEMES);
ModelTypeSyncProxyImpl sessions_sync_proxy(syncer::SESSIONS);
scoped_refptr<base::DeferredSequencedTaskRunner> task_runner =
new base::DeferredSequencedTaskRunner(base::MessageLoopProxy::current());
new base::DeferredSequencedTaskRunner(
base::ThreadTaskRunnerHandle::Get());
EXPECT_TRUE(registry()->GetEnabledTypes().Empty());
......@@ -173,7 +175,8 @@ TEST_F(ModelTypeRegistryTest, NonBlockingTypesWithDirectoryTypes) {
ModelTypeSyncProxyImpl themes_sync_proxy(syncer::THEMES);
ModelTypeSyncProxyImpl sessions_sync_proxy(syncer::SESSIONS);
scoped_refptr<base::DeferredSequencedTaskRunner> task_runner =
new base::DeferredSequencedTaskRunner(base::MessageLoopProxy::current());
new base::DeferredSequencedTaskRunner(
base::ThreadTaskRunnerHandle::Get());
ModelSafeRoutingInfo routing_info1;
routing_info1.insert(std::make_pair(NIGORI, GROUP_PASSIVE));
......@@ -222,7 +225,8 @@ TEST_F(ModelTypeRegistryTest, DeletionOrdering) {
scoped_ptr<ModelTypeSyncProxyImpl> sessions_sync_proxy(
new ModelTypeSyncProxyImpl(syncer::SESSIONS));
scoped_refptr<base::DeferredSequencedTaskRunner> task_runner =
new base::DeferredSequencedTaskRunner(base::MessageLoopProxy::current());
new base::DeferredSequencedTaskRunner(
base::ThreadTaskRunnerHandle::Get());
EXPECT_TRUE(registry()->GetEnabledTypes().Empty());
......
......@@ -124,6 +124,7 @@ TestDirectory::TestDirectory(Encryptor* encryptor,
TestDirectory::~TestDirectory() { }
TEST(OnDiskSyncableDirectory, FailInitialWrite) {
base::MessageLoop message_loop;
FakeEncryptor encryptor;
TestUnrecoverableErrorHandler handler;
base::ScopedTempDir temp_dir;
......
......@@ -82,8 +82,8 @@ class MyTestURLRequestContext : public net::TestURLRequestContext {
class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter {
public:
explicit MyTestURLRequestContextGetter(
const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy)
: TestURLRequestContextGetter(io_message_loop_proxy) {}
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner)
: TestURLRequestContextGetter(io_task_runner) {}
virtual net::TestURLRequestContext* GetURLRequestContext() OVERRIDE {
// Construct |context_| lazily so it gets constructed on the right
......
......@@ -92,8 +92,8 @@ class MyTestURLRequestContext : public net::TestURLRequestContext {
class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter {
public:
explicit MyTestURLRequestContextGetter(
const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy)
: TestURLRequestContextGetter(io_message_loop_proxy) {}
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner)
: TestURLRequestContextGetter(io_task_runner) {}
virtual net::TestURLRequestContext* GetURLRequestContext() OVERRIDE {
// Construct |context_| lazily so it gets constructed on the right
......
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