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

Unified Diff: chrome/browser/sync/profile_sync_service.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/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 90004dae5609d12b265d736feb82f3d2e512390d..68be69afb571f54c1943fe7921a764555b153282 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -17,9 +17,9 @@
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
-#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/profiler/scoped_tracker.h"
+#include "base/single_thread_task_runner.h"
#include "base/strings/string16.h"
#include "base/strings/stringprintf.h"
#include "base/thread_task_runner_handle.h"
@@ -827,8 +827,8 @@ void ProfileSyncService::ShutdownImpl(syncer::ShutdownReason reason) {
if (reason == syncer::ShutdownReason::DISABLE_SYNC && sync_thread_) {
// If the backend is already shut down when a DISABLE_SYNC happens,
// the data directory needs to be cleaned up here.
- sync_thread_->message_loop()->PostTask(FROM_HERE,
- base::Bind(&DeleteSyncDataFolder, directory_path_));
+ sync_thread_->task_runner()->PostTask(
+ FROM_HERE, base::Bind(&DeleteSyncDataFolder, directory_path_));
}
return;
}
@@ -889,7 +889,7 @@ void ProfileSyncService::ShutdownImpl(syncer::ShutdownReason reason) {
if ((backend_mode_ == ROLLBACK || backend_mode_ == BACKUP) &&
reason != syncer::SWITCH_MODE_SYNC &&
reason != syncer::BROWSER_SHUTDOWN) {
- base::MessageLoop::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&ProfileSyncService::TryStartSyncAfterBackup,
startup_controller_weak_factory_.GetWeakPtr()));
}
@@ -989,11 +989,11 @@ void ProfileSyncService::OnUnrecoverableErrorImpl(
<< " -- ProfileSyncService unusable: " << message;
// Shut all data types down.
- base::MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(&ProfileSyncService::ShutdownImpl,
- weak_factory_.GetWeakPtr(),
- delete_sync_database ?
- syncer::DISABLE_SYNC : syncer::STOP_SYNC));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ base::Bind(
+ &ProfileSyncService::ShutdownImpl, weak_factory_.GetWeakPtr(),
+ delete_sync_database ? syncer::DISABLE_SYNC : syncer::STOP_SYNC));
}
void ProfileSyncService::ReenableDatatype(syncer::ModelType type) {
@@ -1139,9 +1139,9 @@ void ProfileSyncService::OnSyncCycleCompleted() {
if (IsDataTypeControllerRunning(syncer::SESSIONS)) {
// Trigger garbage collection of old sessions now that we've downloaded
// any new session data.
- base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
- &SessionsSyncManager::DoGarbageCollection,
- base::AsWeakPtr(sessions_sync_manager_.get())));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&SessionsSyncManager::DoGarbageCollection,
+ base::AsWeakPtr(sessions_sync_manager_.get())));
}
DVLOG(2) << "Notifying observers sync cycle completed";
NotifySyncCycleCompleted();
@@ -1426,7 +1426,7 @@ void ProfileSyncService::OnConfigureDone(
backup_finished_ = true;
// Asynchronously check whether sync needs to start.
- base::MessageLoop::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&ProfileSyncService::TryStartSyncAfterBackup,
startup_controller_weak_factory_.GetWeakPtr()));
} else if (!expect_sync_configuration_aborted_) {
@@ -2645,7 +2645,7 @@ void ProfileSyncService::CheckSyncBackupIfNeeded() {
// If sync thread is set, need to serialize check on sync thread after
// closing backup DB.
if (sync_thread_) {
- sync_thread_->message_loop_proxy()->PostTask(
+ sync_thread_->task_runner()->PostTask(
FROM_HERE,
base::Bind(syncer::CheckSyncDbLastModifiedTime,
profile_->GetPath().Append(kSyncBackupDataFolderName),
« no previous file with comments | « chrome/browser/sync/glue/ui_model_worker_unittest.cc ('k') | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698