| Index: components/sync_driver/glue/sync_backend_host_impl.cc
|
| diff --git a/components/sync_driver/glue/sync_backend_host_impl.cc b/components/sync_driver/glue/sync_backend_host_impl.cc
|
| index 7f75372a47fb54acce7dae5c3c4bcebd01cc53e9..97abed7e94e884827f273a7122b7b27783ec805b 100644
|
| --- a/components/sync_driver/glue/sync_backend_host_impl.cc
|
| +++ b/components/sync_driver/glue/sync_backend_host_impl.cc
|
| @@ -12,7 +12,7 @@
|
| #include "base/feature_list.h"
|
| #include "base/location.h"
|
| #include "base/logging.h"
|
| -#include "base/single_thread_task_runner.h"
|
| +#include "base/threading/thread_task_runner_handle.h"
|
| #include "components/invalidation/public/invalidation_service.h"
|
| #include "components/invalidation/public/object_id_invalidation_map.h"
|
| #include "components/signin/core/browser/signin_client.h"
|
| @@ -52,7 +52,7 @@ SyncBackendHostImpl::SyncBackendHostImpl(
|
| invalidation::InvalidationService* invalidator,
|
| const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs,
|
| const base::FilePath& sync_folder)
|
| - : frontend_loop_(base::MessageLoop::current()),
|
| + : frontend_task_runner_(base::ThreadTaskRunnerHandle::Get()),
|
| sync_client_(sync_client),
|
| ui_thread_(ui_thread),
|
| name_(name),
|
| @@ -174,7 +174,7 @@ void SyncBackendHostImpl::SetEncryptionPassphrase(const std::string& passphrase,
|
| DCHECK(!passphrase.empty());
|
|
|
| // This should only be called by the frontend.
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
|
|
| // SetEncryptionPassphrase should never be called if we are currently
|
| // encrypted with an explicit passphrase.
|
| @@ -199,7 +199,7 @@ bool SyncBackendHostImpl::SetDecryptionPassphrase(
|
| DCHECK(!passphrase.empty());
|
|
|
| // This should only be called by the frontend.
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
|
|
| // This should only be called when we have cached pending keys.
|
| DCHECK(cached_pending_keys_.has_blob());
|
| @@ -229,7 +229,7 @@ bool SyncBackendHostImpl::SetDecryptionPassphrase(
|
| }
|
|
|
| void SyncBackendHostImpl::StopSyncingForShutdown() {
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
|
|
| // Immediately stop sending messages to the frontend.
|
| frontend_ = NULL;
|
| @@ -536,7 +536,7 @@ void SyncBackendHostImpl::GetAllNodesForTypes(
|
| DCHECK(initialized());
|
| registrar_->sync_thread()->task_runner()->PostTask(
|
| FROM_HERE, base::Bind(&SyncBackendHostCore::GetAllNodesForTypes, core_,
|
| - types, frontend_loop_->task_runner(), callback));
|
| + types, frontend_task_runner_, callback));
|
| }
|
|
|
| void SyncBackendHostImpl::InitCore(
|
| @@ -599,7 +599,7 @@ void SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop(
|
| debug_info_listener,
|
| std::unique_ptr<syncer_v2::ModelTypeConnector> model_type_connector,
|
| const std::string& cache_guid) {
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
|
|
| model_type_connector_ = std::move(model_type_connector);
|
|
|
| @@ -628,7 +628,7 @@ void SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop(
|
| }
|
|
|
| void SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop() {
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
| if (!frontend_)
|
| return;
|
|
|
| @@ -643,7 +643,7 @@ void SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop(
|
| const syncer::sessions::SyncSessionSnapshot& snapshot) {
|
| if (!frontend_)
|
| return;
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
|
|
| last_snapshot_ = snapshot;
|
|
|
| @@ -681,7 +681,7 @@ void SyncBackendHostImpl::HandleActionableErrorEventOnFrontendLoop(
|
| const syncer::SyncProtocolError& sync_error) {
|
| if (!frontend_)
|
| return;
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
| frontend_->OnActionableError(sync_error);
|
| }
|
|
|
| @@ -689,7 +689,7 @@ void SyncBackendHostImpl::HandleMigrationRequestedOnFrontendLoop(
|
| syncer::ModelTypeSet types) {
|
| if (!frontend_)
|
| return;
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
| frontend_->OnMigrationNeededForTypes(types);
|
| }
|
|
|
| @@ -729,7 +729,7 @@ void SyncBackendHostImpl::NotifyPassphraseRequired(
|
| if (!frontend_)
|
| return;
|
|
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
|
|
| // Update our cache of the cryptographer's pending keys.
|
| cached_pending_keys_ = pending_keys;
|
| @@ -741,7 +741,7 @@ void SyncBackendHostImpl::NotifyPassphraseAccepted() {
|
| if (!frontend_)
|
| return;
|
|
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
|
|
| // Clear our cache of the cryptographer's pending keys.
|
| cached_pending_keys_.clear_blob();
|
| @@ -754,7 +754,7 @@ void SyncBackendHostImpl::NotifyEncryptedTypesChanged(
|
| if (!frontend_)
|
| return;
|
|
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
| frontend_->OnEncryptedTypesChanged(
|
| encrypted_types, encrypt_everything);
|
| }
|
| @@ -763,14 +763,14 @@ void SyncBackendHostImpl::NotifyEncryptionComplete() {
|
| if (!frontend_)
|
| return;
|
|
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
| frontend_->OnEncryptionComplete();
|
| }
|
|
|
| void SyncBackendHostImpl::HandlePassphraseTypeChangedOnFrontendLoop(
|
| syncer::PassphraseType type,
|
| base::Time explicit_passphrase_time) {
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
| DVLOG(1) << "Passphrase type changed to "
|
| << syncer::PassphraseTypeToString(type);
|
| cached_passphrase_type_ = type;
|
| @@ -779,7 +779,7 @@ void SyncBackendHostImpl::HandlePassphraseTypeChangedOnFrontendLoop(
|
|
|
| void SyncBackendHostImpl::HandleLocalSetPassphraseEncryptionOnFrontendLoop(
|
| const syncer::SyncEncryptionHandler::NigoriState& nigori_state) {
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
| frontend_->OnLocalSetPassphraseEncryption(nigori_state);
|
| }
|
|
|
| @@ -788,7 +788,7 @@ void SyncBackendHostImpl::HandleConnectionStatusChangeOnFrontendLoop(
|
| if (!frontend_)
|
| return;
|
|
|
| - DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
|
| + DCHECK(frontend_task_runner_->BelongsToCurrentThread());
|
|
|
| DVLOG(1) << "Connection status changed: "
|
| << syncer::ConnectionStatusToString(status);
|
|
|