| OLD | NEW |
| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 if (!sync_worker_) | 571 if (!sync_worker_) |
| 572 return; | 572 return; |
| 573 | 573 |
| 574 worker_task_runner_->PostTask( | 574 worker_task_runner_->PostTask( |
| 575 FROM_HERE, | 575 FROM_HERE, |
| 576 base::Bind(&SyncWorkerInterface::SetSyncEnabled, | 576 base::Bind(&SyncWorkerInterface::SetSyncEnabled, |
| 577 base::Unretained(sync_worker_.get()), | 577 base::Unretained(sync_worker_.get()), |
| 578 sync_enabled)); | 578 sync_enabled)); |
| 579 } | 579 } |
| 580 | 580 |
| 581 void SyncEngine::PromoteDemotedChanges() { | 581 void SyncEngine::PromoteDemotedChanges(const base::Closure& callback) { |
| 582 if (!sync_worker_) | 582 if (!sync_worker_) { |
| 583 callback.Run(); |
| 583 return; | 584 return; |
| 585 } |
| 586 |
| 587 base::Closure relayed_callback = RelayCallbackToCurrentThread( |
| 588 FROM_HERE, callback_tracker_.Register(callback, callback)); |
| 584 | 589 |
| 585 worker_task_runner_->PostTask( | 590 worker_task_runner_->PostTask( |
| 586 FROM_HERE, | 591 FROM_HERE, |
| 587 base::Bind(&SyncWorkerInterface::PromoteDemotedChanges, | 592 base::Bind(&SyncWorkerInterface::PromoteDemotedChanges, |
| 588 base::Unretained(sync_worker_.get()))); | 593 base::Unretained(sync_worker_.get()), |
| 594 relayed_callback)); |
| 589 } | 595 } |
| 590 | 596 |
| 591 void SyncEngine::ApplyLocalChange( | 597 void SyncEngine::ApplyLocalChange( |
| 592 const FileChange& local_change, | 598 const FileChange& local_change, |
| 593 const base::FilePath& local_path, | 599 const base::FilePath& local_path, |
| 594 const SyncFileMetadata& local_metadata, | 600 const SyncFileMetadata& local_metadata, |
| 595 const fileapi::FileSystemURL& url, | 601 const fileapi::FileSystemURL& url, |
| 596 const SyncStatusCallback& callback) { | 602 const SyncStatusCallback& callback) { |
| 597 if (GetCurrentState() == REMOTE_SERVICE_DISABLED) { | 603 if (GetCurrentState() == REMOTE_SERVICE_DISABLED) { |
| 598 callback.Run(SYNC_STATUS_SYNC_DISABLED); | 604 callback.Run(SYNC_STATUS_SYNC_DISABLED); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 | 749 |
| 744 SyncStatusCallback SyncEngine::TrackCallback( | 750 SyncStatusCallback SyncEngine::TrackCallback( |
| 745 const SyncStatusCallback& callback) { | 751 const SyncStatusCallback& callback) { |
| 746 return callback_tracker_.Register( | 752 return callback_tracker_.Register( |
| 747 base::Bind(callback, SYNC_STATUS_ABORT), | 753 base::Bind(callback, SYNC_STATUS_ABORT), |
| 748 callback); | 754 callback); |
| 749 } | 755 } |
| 750 | 756 |
| 751 } // namespace drive_backend | 757 } // namespace drive_backend |
| 752 } // namespace sync_file_system | 758 } // namespace sync_file_system |
| OLD | NEW |