| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_worker.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_worker.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 GetMetadataDatabase()->CountDirtyTracker()); | 283 GetMetadataDatabase()->CountDirtyTracker()); |
| 284 } | 284 } |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 | 287 |
| 288 void SyncWorker::RecordTaskLog(std::unique_ptr<TaskLogger::TaskLog> task_log) { | 288 void SyncWorker::RecordTaskLog(std::unique_ptr<TaskLogger::TaskLog> task_log) { |
| 289 DCHECK(sequence_checker_.CalledOnValidSequence()); | 289 DCHECK(sequence_checker_.CalledOnValidSequence()); |
| 290 | 290 |
| 291 context_->GetUITaskRunner()->PostTask( | 291 context_->GetUITaskRunner()->PostTask( |
| 292 FROM_HERE, | 292 FROM_HERE, |
| 293 base::Bind(&TaskLogger::RecordLog, | 293 base::BindOnce(&TaskLogger::RecordLog, context_->GetTaskLogger(), |
| 294 context_->GetTaskLogger(), | 294 base::Passed(&task_log))); |
| 295 base::Passed(&task_log))); | |
| 296 } | 295 } |
| 297 | 296 |
| 298 void SyncWorker::ActivateService(RemoteServiceState service_state, | 297 void SyncWorker::ActivateService(RemoteServiceState service_state, |
| 299 const std::string& description) { | 298 const std::string& description) { |
| 300 DCHECK(sequence_checker_.CalledOnValidSequence()); | 299 DCHECK(sequence_checker_.CalledOnValidSequence()); |
| 301 UpdateServiceState(service_state, description); | 300 UpdateServiceState(service_state, description); |
| 302 if (!GetMetadataDatabase()) { | 301 if (!GetMetadataDatabase()) { |
| 303 PostInitializeTask(); | 302 PostInitializeTask(); |
| 304 return; | 303 return; |
| 305 } | 304 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 metadata_db->GetRegisteredAppIDs(app_ids.get()); | 400 metadata_db->GetRegisteredAppIDs(app_ids.get()); |
| 402 | 401 |
| 403 AppStatusMap* app_status = new AppStatusMap; | 402 AppStatusMap* app_status = new AppStatusMap; |
| 404 base::Closure callback = | 403 base::Closure callback = |
| 405 base::Bind(&SyncWorker::DidQueryAppStatus, | 404 base::Bind(&SyncWorker::DidQueryAppStatus, |
| 406 weak_ptr_factory_.GetWeakPtr(), | 405 weak_ptr_factory_.GetWeakPtr(), |
| 407 base::Owned(app_status)); | 406 base::Owned(app_status)); |
| 408 | 407 |
| 409 context_->GetUITaskRunner()->PostTask( | 408 context_->GetUITaskRunner()->PostTask( |
| 410 FROM_HERE, | 409 FROM_HERE, |
| 411 base::Bind(&SyncWorker::QueryAppStatusOnUIThread, | 410 base::BindOnce(&SyncWorker::QueryAppStatusOnUIThread, extension_service_, |
| 412 extension_service_, | 411 base::Owned(app_ids.release()), app_status, |
| 413 base::Owned(app_ids.release()), | 412 RelayCallbackToTaskRunner(context_->GetWorkerTaskRunner(), |
| 414 app_status, | 413 FROM_HERE, callback))); |
| 415 RelayCallbackToTaskRunner( | |
| 416 context_->GetWorkerTaskRunner(), | |
| 417 FROM_HERE, callback))); | |
| 418 } | 414 } |
| 419 | 415 |
| 420 void SyncWorker::QueryAppStatusOnUIThread( | 416 void SyncWorker::QueryAppStatusOnUIThread( |
| 421 const base::WeakPtr<ExtensionServiceInterface>& extension_service_ptr, | 417 const base::WeakPtr<ExtensionServiceInterface>& extension_service_ptr, |
| 422 const std::vector<std::string>* app_ids, | 418 const std::vector<std::string>* app_ids, |
| 423 AppStatusMap* status, | 419 AppStatusMap* status, |
| 424 const base::Closure& callback) { | 420 const base::Closure& callback) { |
| 425 ExtensionServiceInterface* extension_service = extension_service_ptr.get(); | 421 ExtensionServiceInterface* extension_service = extension_service_ptr.get(); |
| 426 if (!extension_service) { | 422 if (!extension_service) { |
| 427 callback.Run(); | 423 callback.Run(); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 return context_->GetDriveUploader(); | 695 return context_->GetDriveUploader(); |
| 700 } | 696 } |
| 701 | 697 |
| 702 MetadataDatabase* SyncWorker::GetMetadataDatabase() { | 698 MetadataDatabase* SyncWorker::GetMetadataDatabase() { |
| 703 DCHECK(sequence_checker_.CalledOnValidSequence()); | 699 DCHECK(sequence_checker_.CalledOnValidSequence()); |
| 704 return context_->GetMetadataDatabase(); | 700 return context_->GetMetadataDatabase(); |
| 705 } | 701 } |
| 706 | 702 |
| 707 } // namespace drive_backend | 703 } // namespace drive_backend |
| 708 } // namespace sync_file_system | 704 } // namespace sync_file_system |
| OLD | NEW |