| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 : ui_task_runner_(ui_task_runner), | 111 : ui_task_runner_(ui_task_runner), |
| 112 sync_engine_(sync_engine) { | 112 sync_engine_(sync_engine) { |
| 113 sequence_checker_.DetachFromSequence(); | 113 sequence_checker_.DetachFromSequence(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 ~WorkerObserver() override { | 116 ~WorkerObserver() override { |
| 117 DCHECK(sequence_checker_.CalledOnValidSequence()); | 117 DCHECK(sequence_checker_.CalledOnValidSequence()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void OnPendingFileListUpdated(int item_count) override { | 120 void OnPendingFileListUpdated(int item_count) override { |
| 121 if (ui_task_runner_->RunsTasksOnCurrentThread()) { | 121 if (ui_task_runner_->RunsTasksInCurrentSequence()) { |
| 122 if (sync_engine_) | 122 if (sync_engine_) |
| 123 sync_engine_->OnPendingFileListUpdated(item_count); | 123 sync_engine_->OnPendingFileListUpdated(item_count); |
| 124 return; | 124 return; |
| 125 } | 125 } |
| 126 | 126 |
| 127 DCHECK(sequence_checker_.CalledOnValidSequence()); | 127 DCHECK(sequence_checker_.CalledOnValidSequence()); |
| 128 ui_task_runner_->PostTask( | 128 ui_task_runner_->PostTask( |
| 129 FROM_HERE, base::BindOnce(&SyncEngine::OnPendingFileListUpdated, | 129 FROM_HERE, base::BindOnce(&SyncEngine::OnPendingFileListUpdated, |
| 130 sync_engine_, item_count)); | 130 sync_engine_, item_count)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void OnFileStatusChanged(const storage::FileSystemURL& url, | 133 void OnFileStatusChanged(const storage::FileSystemURL& url, |
| 134 SyncFileType file_type, | 134 SyncFileType file_type, |
| 135 SyncFileStatus file_status, | 135 SyncFileStatus file_status, |
| 136 SyncAction sync_action, | 136 SyncAction sync_action, |
| 137 SyncDirection direction) override { | 137 SyncDirection direction) override { |
| 138 if (ui_task_runner_->RunsTasksOnCurrentThread()) { | 138 if (ui_task_runner_->RunsTasksInCurrentSequence()) { |
| 139 if (sync_engine_) | 139 if (sync_engine_) |
| 140 sync_engine_->OnFileStatusChanged( | 140 sync_engine_->OnFileStatusChanged( |
| 141 url, file_type, file_status, sync_action, direction); | 141 url, file_type, file_status, sync_action, direction); |
| 142 return; | 142 return; |
| 143 } | 143 } |
| 144 | 144 |
| 145 DCHECK(sequence_checker_.CalledOnValidSequence()); | 145 DCHECK(sequence_checker_.CalledOnValidSequence()); |
| 146 ui_task_runner_->PostTask( | 146 ui_task_runner_->PostTask( |
| 147 FROM_HERE, | 147 FROM_HERE, |
| 148 base::BindOnce(&SyncEngine::OnFileStatusChanged, sync_engine_, url, | 148 base::BindOnce(&SyncEngine::OnFileStatusChanged, sync_engine_, url, |
| 149 file_type, file_status, sync_action, direction)); | 149 file_type, file_status, sync_action, direction)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void UpdateServiceState(RemoteServiceState state, | 152 void UpdateServiceState(RemoteServiceState state, |
| 153 const std::string& description) override { | 153 const std::string& description) override { |
| 154 if (ui_task_runner_->RunsTasksOnCurrentThread()) { | 154 if (ui_task_runner_->RunsTasksInCurrentSequence()) { |
| 155 if (sync_engine_) | 155 if (sync_engine_) |
| 156 sync_engine_->UpdateServiceState(state, description); | 156 sync_engine_->UpdateServiceState(state, description); |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 | 159 |
| 160 DCHECK(sequence_checker_.CalledOnValidSequence()); | 160 DCHECK(sequence_checker_.CalledOnValidSequence()); |
| 161 ui_task_runner_->PostTask( | 161 ui_task_runner_->PostTask( |
| 162 FROM_HERE, base::BindOnce(&SyncEngine::UpdateServiceState, sync_engine_, | 162 FROM_HERE, base::BindOnce(&SyncEngine::UpdateServiceState, sync_engine_, |
| 163 state, description)); | 163 state, description)); |
| 164 } | 164 } |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 | 771 |
| 772 SyncStatusCallback SyncEngine::TrackCallback( | 772 SyncStatusCallback SyncEngine::TrackCallback( |
| 773 const SyncStatusCallback& callback) { | 773 const SyncStatusCallback& callback) { |
| 774 return callback_tracker_.Register( | 774 return callback_tracker_.Register( |
| 775 base::Bind(callback, SYNC_STATUS_ABORT), | 775 base::Bind(callback, SYNC_STATUS_ABORT), |
| 776 callback); | 776 callback); |
| 777 } | 777 } |
| 778 | 778 |
| 779 } // namespace drive_backend | 779 } // namespace drive_backend |
| 780 } // namespace sync_file_system | 780 } // namespace sync_file_system |
| OLD | NEW |