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

Unified Diff: chrome/browser/sync_file_system/drive_backend/sync_engine.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 comments 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 | « no previous file | chrome/browser/sync_file_system/drive_backend/sync_worker.cc » ('j') | 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_engine.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/sync_engine.cc b/chrome/browser/sync_file_system/drive_backend/sync_engine.cc
index be3a51a18477c1f3ae973dd9d3b7ed15d643fffe..08692c4159c7bf8ec1ca2773e06203a2c110233a 100644
--- a/chrome/browser/sync_file_system/drive_backend/sync_engine.cc
+++ b/chrome/browser/sync_file_system/drive_backend/sync_engine.cc
@@ -205,7 +205,8 @@ SyncEngine::~SyncEngine() {
if (notification_manager_)
notification_manager_->RemoveObserver(this);
- // TODO(tzik): Destroy |sync_worker_| and |worker_observer_| on the worker.
+ worker_task_runner_->DeleteSoon(FROM_HERE, worker_observer_.release());
+ worker_task_runner_->DeleteSoon(FROM_HERE, sync_worker_.release());
}
void SyncEngine::Initialize(const base::FilePath& base_dir,
@@ -239,7 +240,6 @@ void SyncEngine::Initialize(const base::FilePath& base_dir,
if (extension_service_)
extension_service_weak_ptr = extension_service_->AsWeakPtr();
- // TODO(peria): Use PostTask on |worker_task_runner_| to call this function.
sync_worker_ = SyncWorker::CreateOnWorker(
nhiroki 2014/05/26 08:06:03 How about renaming this or calling the ctor direct
peria 2014/05/26 08:14:41 Done.
base_dir,
worker_observer_.get(),
@@ -251,6 +251,11 @@ void SyncEngine::Initialize(const base::FilePath& base_dir,
notification_manager_->AddObserver(this);
GetDriveService()->AddObserver(this);
net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
+
+ worker_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&SyncWorker::Initialize,
+ base::Unretained(sync_worker_.get())));
nhiroki 2014/05/26 08:06:03 You may want to move this to line 249 for readabil
peria 2014/05/26 08:14:41 Done.
}
void SyncEngine::AddServiceObserver(SyncServiceObserver* observer) {
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/sync_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698