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

Unified Diff: chrome/browser/sync_file_system/drive_backend/sync_worker.cc

Issue 288193002: [SyncFS] Construct and destruct sync_worker in worker_task_runner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work for a nit, from offline chat Created 6 years, 7 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
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/sync_worker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync_file_system/drive_backend/sync_worker.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/sync_worker.cc b/chrome/browser/sync_file_system/drive_backend/sync_worker.cc
index c2b7f87f6c4845a891b87221d8f8b1b5d3f5d626..189c4d841f22a0c8e8d5a7db740a4d1e6759469c 100644
--- a/chrome/browser/sync_file_system/drive_backend/sync_worker.cc
+++ b/chrome/browser/sync_file_system/drive_backend/sync_worker.cc
@@ -85,22 +85,24 @@ void QueryAppStatusOnUIThread(
} // namespace
-scoped_ptr<SyncWorker> SyncWorker::CreateOnWorker(
+SyncWorker::SyncWorker(
const base::FilePath& base_dir,
- Observer* observer,
const base::WeakPtr<ExtensionServiceInterface>& extension_service,
scoped_ptr<SyncEngineContext> sync_engine_context,
- leveldb::Env* env_override) {
- scoped_ptr<SyncWorker> sync_worker(
- new SyncWorker(base_dir,
- extension_service,
- sync_engine_context.Pass(),
- env_override));
- sync_worker->AddObserver(observer);
- sync_worker->Initialize();
-
- return sync_worker.Pass();
-}
+ leveldb::Env* env_override)
+ : base_dir_(base_dir),
+ env_override_(env_override),
+ service_state_(REMOTE_SERVICE_TEMPORARY_UNAVAILABLE),
+ should_check_conflict_(true),
+ should_check_remote_change_(true),
+ listing_remote_changes_(false),
+ sync_enabled_(false),
+ default_conflict_resolution_policy_(
+ CONFLICT_RESOLUTION_POLICY_LAST_WRITE_WIN),
+ network_available_(false),
+ extension_service_(extension_service),
+ context_(sync_engine_context.Pass()),
+ weak_ptr_factory_(this) {}
SyncWorker::~SyncWorker() {}
@@ -133,7 +135,6 @@ void SyncWorker::RegisterOrigin(
return;
}
- // TODO(peria): Forward |callback| to UI thread.
task_manager_->ScheduleSyncTask(
FROM_HERE,
task.PassAs<SyncTask>(),
@@ -144,7 +145,6 @@ void SyncWorker::RegisterOrigin(
void SyncWorker::EnableOrigin(
const GURL& origin,
const SyncStatusCallback& callback) {
- // TODO(peria): Forward |callback| to UI thread.
task_manager_->ScheduleTask(
FROM_HERE,
base::Bind(&SyncWorker::DoEnableApp,
@@ -157,7 +157,6 @@ void SyncWorker::EnableOrigin(
void SyncWorker::DisableOrigin(
const GURL& origin,
const SyncStatusCallback& callback) {
- // TODO(peria): Forward |callback| to UI thread.
task_manager_->ScheduleTask(
FROM_HERE,
base::Bind(&SyncWorker::DoDisableApp,
@@ -171,7 +170,6 @@ void SyncWorker::UninstallOrigin(
const GURL& origin,
RemoteFileSyncService::UninstallFlag flag,
const SyncStatusCallback& callback) {
- // TODO(peria): Forward |callback| to UI thread.
task_manager_->ScheduleSyncTask(
FROM_HERE,
scoped_ptr<SyncTask>(
@@ -189,7 +187,8 @@ void SyncWorker::ProcessRemoteChange(
SyncTaskManager::PRIORITY_MED,
base::Bind(&SyncWorker::DidProcessRemoteChange,
weak_ptr_factory_.GetWeakPtr(),
- syncer, callback));
+ syncer,
+ callback));
}
void SyncWorker::SetRemoteChangeProcessor(
@@ -291,7 +290,8 @@ void SyncWorker::ApplyLocalChange(
SyncTaskManager::PRIORITY_MED,
base::Bind(&SyncWorker::DidApplyLocalChange,
weak_ptr_factory_.GetWeakPtr(),
- syncer, callback));
+ syncer,
+ callback));
}
void SyncWorker::MaybeScheduleNextTask() {
@@ -381,25 +381,6 @@ void SyncWorker::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
-SyncWorker::SyncWorker(
- const base::FilePath& base_dir,
- const base::WeakPtr<ExtensionServiceInterface>& extension_service,
- scoped_ptr<SyncEngineContext> sync_engine_context,
- leveldb::Env* env_override)
- : base_dir_(base_dir),
- env_override_(env_override),
- service_state_(REMOTE_SERVICE_TEMPORARY_UNAVAILABLE),
- should_check_conflict_(true),
- should_check_remote_change_(true),
- listing_remote_changes_(false),
- sync_enabled_(false),
- default_conflict_resolution_policy_(
- CONFLICT_RESOLUTION_POLICY_LAST_WRITE_WIN),
- network_available_(false),
- extension_service_(extension_service),
- context_(sync_engine_context.Pass()),
- weak_ptr_factory_(this) {}
-
void SyncWorker::DoDisableApp(const std::string& app_id,
const SyncStatusCallback& callback) {
if (GetMetadataDatabase()) {
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/sync_worker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698