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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/sync_engine.cc

Issue 236313009: [SyncFS] Post tasks between SyncEngine and SyncWorker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use post tasks temporarily Created 6 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync_file_system/drive_backend/sync_engine.h" 5 #include "chrome/browser/sync_file_system/drive_backend/sync_engine.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (notification_manager_) 123 if (notification_manager_)
124 notification_manager_->RemoveObserver(this); 124 notification_manager_->RemoveObserver(this);
125 } 125 }
126 126
127 void SyncEngine::Initialize(const base::FilePath& base_dir, 127 void SyncEngine::Initialize(const base::FilePath& base_dir,
128 base::SequencedTaskRunner* task_runner, 128 base::SequencedTaskRunner* task_runner,
129 leveldb::Env* env_override) { 129 leveldb::Env* env_override) {
130 scoped_ptr<SyncEngineContext> sync_engine_context( 130 scoped_ptr<SyncEngineContext> sync_engine_context(
131 new SyncEngineContext(drive_service_.get(), 131 new SyncEngineContext(drive_service_.get(),
132 drive_uploader_.get(), 132 drive_uploader_.get(),
133 task_runner)); 133 task_runner,
134 base::MessageLoopProxy::current()));
134 // TODO(peria): Move this create function to thread pool. 135 // TODO(peria): Move this create function to thread pool.
135 sync_worker_ = SyncWorker::CreateOnWorker(weak_ptr_factory_.GetWeakPtr(), 136 sync_worker_ = SyncWorker::CreateOnWorker(weak_ptr_factory_.GetWeakPtr(),
136 base_dir, 137 base_dir,
137 sync_engine_context.Pass(), 138 sync_engine_context.Pass(),
138 env_override); 139 env_override);
139 140
140 if (notification_manager_) 141 if (notification_manager_)
141 notification_manager_->AddObserver(this); 142 notification_manager_->AddObserver(this);
142 GetDriveService()->AddObserver(this); 143 GetDriveService()->AddObserver(this);
143 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); 144 net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
(...skipping 26 matching lines...) Expand all
170 const GURL& origin, 171 const GURL& origin,
171 UninstallFlag flag, 172 UninstallFlag flag,
172 const SyncStatusCallback& callback) { 173 const SyncStatusCallback& callback) {
173 sync_worker_->UninstallOrigin(origin, flag, callback); 174 sync_worker_->UninstallOrigin(origin, flag, callback);
174 } 175 }
175 176
176 void SyncEngine::ProcessRemoteChange(const SyncFileCallback& callback) { 177 void SyncEngine::ProcessRemoteChange(const SyncFileCallback& callback) {
177 sync_worker_->ProcessRemoteChange(callback); 178 sync_worker_->ProcessRemoteChange(callback);
178 } 179 }
179 180
180 void SyncEngine::SetRemoteChangeProcessor( 181 void SyncEngine::SetRemoteChangeProcessor(RemoteChangeProcessor* processor) {
181 RemoteChangeProcessor* processor) {
182 sync_worker_->SetRemoteChangeProcessor(processor); 182 sync_worker_->SetRemoteChangeProcessor(processor);
183 } 183 }
184 184
185 LocalChangeProcessor* SyncEngine::GetLocalChangeProcessor() { 185 LocalChangeProcessor* SyncEngine::GetLocalChangeProcessor() {
186 return this; 186 return this;
187 } 187 }
188 188
189 bool SyncEngine::IsConflicting(const fileapi::FileSystemURL& url) { 189 bool SyncEngine::IsConflicting(const fileapi::FileSystemURL& url) {
190 // TODO(tzik): Implement this before we support manual conflict resolution. 190 // TODO(tzik): Implement this before we support manual conflict resolution.
191 return false; 191 return false;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 void SyncEngine::NotifyLastOperationStatus() { 402 void SyncEngine::NotifyLastOperationStatus() {
403 FOR_EACH_OBSERVER( 403 FOR_EACH_OBSERVER(
404 Observer, 404 Observer,
405 service_observers_, 405 service_observers_,
406 OnRemoteChangeQueueUpdated( 406 OnRemoteChangeQueueUpdated(
407 GetMetadataDatabase()->CountDirtyTracker())); 407 GetMetadataDatabase()->CountDirtyTracker()));
408 } 408 }
409 409
410 } // namespace drive_backend 410 } // namespace drive_backend
411 } // namespace sync_file_system 411 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698