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

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: 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
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..64aba0d68b3dbfaf6a059835dc9cfa7731dee3d2 100644
--- a/chrome/browser/sync_file_system/drive_backend/sync_worker.cc
+++ b/chrome/browser/sync_file_system/drive_backend/sync_worker.cc
@@ -85,6 +85,7 @@ void QueryAppStatusOnUIThread(
} // namespace
+// static
scoped_ptr<SyncWorker> SyncWorker::CreateOnWorker(
const base::FilePath& base_dir,
Observer* observer,
@@ -102,13 +103,21 @@ scoped_ptr<SyncWorker> SyncWorker::CreateOnWorker(
return sync_worker.Pass();
}
+// static
+void SyncWorker::DestructOnWorker(scoped_ptr<SyncWorker> sync_worker,
+ scoped_ptr<Observer> worker_observer) {
+ delete worker_observer.release();
+ delete sync_worker.release();
nhiroki 2014/05/26 05:22:44 How about using scoped_ptr::reset()?
peria 2014/05/26 05:32:35 Done.
+}
+
SyncWorker::~SyncWorker() {}
void SyncWorker::Initialize() {
DCHECK(!task_manager_);
task_manager_.reset(new SyncTaskManager(
- weak_ptr_factory_.GetWeakPtr(), 0 /* maximum_background_task */));
+ weak_ptr_factory_.GetWeakPtr(),
+ 0 /* maximum_background_task */));
task_manager_->Initialize(SYNC_STATUS_OK);
PostInitializeTask();
@@ -133,7 +142,6 @@ void SyncWorker::RegisterOrigin(
return;
}
- // TODO(peria): Forward |callback| to UI thread.
task_manager_->ScheduleSyncTask(
FROM_HERE,
task.PassAs<SyncTask>(),
@@ -144,7 +152,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 +164,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 +177,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>(

Powered by Google App Engine
This is Rietveld 408576698