Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: chrome/browser/sync/glue/sync_backend_host_impl.cc

Issue 1143343005: chrome/browser: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/sync_backend_host_impl.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host_impl.cc b/chrome/browser/sync/glue/sync_backend_host_impl.cc
index 04b77bf4a08da52f0ef1350d1903714eae936407..c0b76604eedb0bb6c14378f95500d58cf0ed2237 100644
--- a/chrome/browser/sync/glue/sync_backend_host_impl.cc
+++ b/chrome/browser/sync/glue/sync_backend_host_impl.cc
@@ -5,7 +5,9 @@
#include "chrome/browser/sync/glue/sync_backend_host_impl.h"
#include "base/command_line.h"
+#include "base/location.h"
#include "base/logging.h"
+#include "base/single_thread_task_runner.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
@@ -162,10 +164,9 @@ void SyncBackendHostImpl::Initialize(
void SyncBackendHostImpl::UpdateCredentials(
const syncer::SyncCredentials& credentials) {
DCHECK(registrar_->sync_thread()->IsRunning());
- registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE,
- base::Bind(&SyncBackendHostCore::DoUpdateCredentials,
- core_.get(),
- credentials));
+ registrar_->sync_thread()->task_runner()->PostTask(
+ FROM_HERE, base::Bind(&SyncBackendHostCore::DoUpdateCredentials,
+ core_.get(), credentials));
}
void SyncBackendHostImpl::StartSyncingWithServer() {
@@ -174,9 +175,9 @@ void SyncBackendHostImpl::StartSyncingWithServer() {
syncer::ModelSafeRoutingInfo routing_info;
registrar_->GetModelSafeRoutingInfo(&routing_info);
- registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE,
- base::Bind(&SyncBackendHostCore::DoStartSyncing,
- core_.get(), routing_info, sync_prefs_->GetLastPollTime()));
+ registrar_->sync_thread()->task_runner()->PostTask(
+ FROM_HERE, base::Bind(&SyncBackendHostCore::DoStartSyncing, core_.get(),
+ routing_info, sync_prefs_->GetLastPollTime()));
}
void SyncBackendHostImpl::SetEncryptionPassphrase(const std::string& passphrase,
@@ -200,10 +201,9 @@ void SyncBackendHostImpl::SetEncryptionPassphrase(const std::string& passphrase,
cached_passphrase_type_ == syncer::IMPLICIT_PASSPHRASE);
// Post an encryption task on the syncer thread.
- registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE,
- base::Bind(&SyncBackendHostCore::DoSetEncryptionPassphrase,
- core_.get(),
- passphrase, is_explicit));
+ registrar_->sync_thread()->task_runner()->PostTask(
+ FROM_HERE, base::Bind(&SyncBackendHostCore::DoSetEncryptionPassphrase,
+ core_.get(), passphrase, is_explicit));
}
bool SyncBackendHostImpl::SetDecryptionPassphrase(
@@ -230,10 +230,9 @@ bool SyncBackendHostImpl::SetDecryptionPassphrase(
return false;
// Post a decryption task on the syncer thread.
- registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE,
- base::Bind(&SyncBackendHostCore::DoSetDecryptionPassphrase,
- core_.get(),
- passphrase));
+ registrar_->sync_thread()->task_runner()->PostTask(
+ FROM_HERE, base::Bind(&SyncBackendHostCore::DoSetDecryptionPassphrase,
+ core_.get(), passphrase));
// Since we were able to decrypt the cached pending keys with the passphrase
// provided, we immediately alert the UI layer that the passphrase was
@@ -286,18 +285,16 @@ scoped_ptr<base::Thread> SyncBackendHostImpl::Shutdown(
invalidation_handler_registered_ = false;
// Shut down and destroy sync manager.
- registrar_->sync_thread()->message_loop()->PostTask(
+ registrar_->sync_thread()->task_runner()->PostTask(
FROM_HERE,
- base::Bind(&SyncBackendHostCore::DoShutdown,
- core_.get(), reason));
+ base::Bind(&SyncBackendHostCore::DoShutdown, core_.get(), reason));
core_ = NULL;
// Worker cleanup.
SyncBackendRegistrar* detached_registrar = registrar_.release();
- detached_registrar->sync_thread()->message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&SyncBackendRegistrar::Shutdown,
- base::Unretained(detached_registrar)));
+ detached_registrar->sync_thread()->task_runner()->PostTask(
+ FROM_HERE, base::Bind(&SyncBackendRegistrar::Shutdown,
+ base::Unretained(detached_registrar)));
if (sync_thread_claimed)
return detached_registrar->ReleaseSyncThread();
@@ -442,9 +439,9 @@ syncer::ModelTypeSet SyncBackendHostImpl::ConfigureDataTypes(
}
void SyncBackendHostImpl::EnableEncryptEverything() {
- registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE,
- base::Bind(&SyncBackendHostCore::DoEnableEncryptEverything,
- core_.get()));
+ registrar_->sync_thread()->task_runner()->PostTask(
+ FROM_HERE,
+ base::Bind(&SyncBackendHostCore::DoEnableEncryptEverything, core_.get()));
}
void SyncBackendHostImpl::ActivateDataType(
@@ -518,7 +515,7 @@ void SyncBackendHostImpl::FlushDirectory() const {
}
void SyncBackendHostImpl::RequestBufferedProtocolEventsAndEnableForwarding() {
- registrar_->sync_thread()->message_loop()->PostTask(
+ registrar_->sync_thread()->task_runner()->PostTask(
FROM_HERE,
base::Bind(
&SyncBackendHostCore::SendBufferedProtocolEventsAndEnableForwarding,
@@ -526,29 +523,25 @@ void SyncBackendHostImpl::RequestBufferedProtocolEventsAndEnableForwarding() {
}
void SyncBackendHostImpl::DisableProtocolEventForwarding() {
- registrar_->sync_thread()->message_loop()->PostTask(
+ registrar_->sync_thread()->task_runner()->PostTask(
FROM_HERE,
- base::Bind(
- &SyncBackendHostCore::DisableProtocolEventForwarding,
- core_));
+ base::Bind(&SyncBackendHostCore::DisableProtocolEventForwarding, core_));
}
void SyncBackendHostImpl::EnableDirectoryTypeDebugInfoForwarding() {
DCHECK(initialized());
- registrar_->sync_thread()->message_loop()->PostTask(
+ registrar_->sync_thread()->task_runner()->PostTask(
FROM_HERE,
- base::Bind(
- &SyncBackendHostCore::EnableDirectoryTypeDebugInfoForwarding,
- core_));
+ base::Bind(&SyncBackendHostCore::EnableDirectoryTypeDebugInfoForwarding,
+ core_));
}
void SyncBackendHostImpl::DisableDirectoryTypeDebugInfoForwarding() {
DCHECK(initialized());
- registrar_->sync_thread()->message_loop()->PostTask(
+ registrar_->sync_thread()->task_runner()->PostTask(
FROM_HERE,
- base::Bind(
- &SyncBackendHostCore::DisableDirectoryTypeDebugInfoForwarding,
- core_));
+ base::Bind(&SyncBackendHostCore::DisableDirectoryTypeDebugInfoForwarding,
+ core_));
}
void SyncBackendHostImpl::GetAllNodesForTypes(
@@ -556,19 +549,15 @@ void SyncBackendHostImpl::GetAllNodesForTypes(
base::Callback<void(const std::vector<syncer::ModelType>&,
ScopedVector<base::ListValue>)> callback) {
DCHECK(initialized());
- registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE,
- base::Bind(
- &SyncBackendHostCore::GetAllNodesForTypes,
- core_,
- types,
- frontend_loop_->message_loop_proxy(),
- callback));
+ registrar_->sync_thread()->task_runner()->PostTask(
+ FROM_HERE, base::Bind(&SyncBackendHostCore::GetAllNodesForTypes, core_,
+ types, frontend_loop_->task_runner(), callback));
}
void SyncBackendHostImpl::InitCore(scoped_ptr<DoInitializeOptions> options) {
- registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE,
- base::Bind(&SyncBackendHostCore::DoInitialize,
- core_.get(), base::Passed(&options)));
+ registrar_->sync_thread()->task_runner()->PostTask(
+ FROM_HERE, base::Bind(&SyncBackendHostCore::DoInitialize, core_.get(),
+ base::Passed(&options)));
}
void SyncBackendHostImpl::RequestConfigureSyncer(
@@ -587,14 +576,10 @@ void SyncBackendHostImpl::RequestConfigureSyncer(
config_types.to_purge = to_purge;
config_types.to_journal = to_journal;
config_types.to_unapply = to_unapply;
- registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE,
- base::Bind(&SyncBackendHostCore::DoConfigureSyncer,
- core_.get(),
- reason,
- config_types,
- routing_info,
- ready_task,
- retry_callback));
+ registrar_->sync_thread()->task_runner()->PostTask(
+ FROM_HERE,
+ base::Bind(&SyncBackendHostCore::DoConfigureSyncer, core_.get(), reason,
+ config_types, routing_info, ready_task, retry_callback));
}
void SyncBackendHostImpl::FinishConfigureDataTypesOnFrontendLoop(
@@ -624,7 +609,8 @@ void SyncBackendHostImpl::Observe(
content::Details<const syncer::ModelTypeSet> state_details(details);
const syncer::ModelTypeSet& types = *(state_details.ptr());
- registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE,
+ registrar_->sync_thread()->task_runner()->PostTask(
+ FROM_HERE,
base::Bind(&SyncBackendHostCore::DoRefreshTypes, core_.get(), types));
}
@@ -743,20 +729,16 @@ void SyncBackendHostImpl::HandleMigrationRequestedOnFrontendLoop(
void SyncBackendHostImpl::OnInvalidatorStateChange(
syncer::InvalidatorState state) {
- registrar_->sync_thread()->message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&SyncBackendHostCore::DoOnInvalidatorStateChange,
- core_.get(),
- state));
+ registrar_->sync_thread()->task_runner()->PostTask(
+ FROM_HERE, base::Bind(&SyncBackendHostCore::DoOnInvalidatorStateChange,
+ core_.get(), state));
}
void SyncBackendHostImpl::OnIncomingInvalidation(
const syncer::ObjectIdInvalidationMap& invalidation_map) {
- registrar_->sync_thread()->message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&SyncBackendHostCore::DoOnIncomingInvalidation,
- core_.get(),
- invalidation_map));
+ registrar_->sync_thread()->task_runner()->PostTask(
+ FROM_HERE, base::Bind(&SyncBackendHostCore::DoOnIncomingInvalidation,
+ core_.get(), invalidation_map));
}
std::string SyncBackendHostImpl::GetOwnerName() const {
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_core.cc ('k') | chrome/browser/sync/glue/sync_backend_registrar_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698