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