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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 base::WeakPtr<SyncEngine> sync_engine) | 86 base::WeakPtr<SyncEngine> sync_engine) |
87 : ui_task_runner_(ui_task_runner), | 87 : ui_task_runner_(ui_task_runner), |
88 sync_engine_(sync_engine) { | 88 sync_engine_(sync_engine) { |
89 sequence_checker_.DetachFromSequence(); | 89 sequence_checker_.DetachFromSequence(); |
90 } | 90 } |
91 | 91 |
92 virtual ~WorkerObserver() { | 92 virtual ~WorkerObserver() { |
93 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 93 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
94 } | 94 } |
95 | 95 |
96 virtual void OnPendingFileListUpdated(int item_count) OVERRIDE { | 96 virtual void OnPendingFileListUpdated(int item_count) override { |
97 if (ui_task_runner_->RunsTasksOnCurrentThread()) { | 97 if (ui_task_runner_->RunsTasksOnCurrentThread()) { |
98 if (sync_engine_) | 98 if (sync_engine_) |
99 sync_engine_->OnPendingFileListUpdated(item_count); | 99 sync_engine_->OnPendingFileListUpdated(item_count); |
100 return; | 100 return; |
101 } | 101 } |
102 | 102 |
103 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 103 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
104 ui_task_runner_->PostTask( | 104 ui_task_runner_->PostTask( |
105 FROM_HERE, | 105 FROM_HERE, |
106 base::Bind(&SyncEngine::OnPendingFileListUpdated, | 106 base::Bind(&SyncEngine::OnPendingFileListUpdated, |
107 sync_engine_, | 107 sync_engine_, |
108 item_count)); | 108 item_count)); |
109 } | 109 } |
110 | 110 |
111 virtual void OnFileStatusChanged(const storage::FileSystemURL& url, | 111 virtual void OnFileStatusChanged(const storage::FileSystemURL& url, |
112 SyncFileType file_type, | 112 SyncFileType file_type, |
113 SyncFileStatus file_status, | 113 SyncFileStatus file_status, |
114 SyncAction sync_action, | 114 SyncAction sync_action, |
115 SyncDirection direction) OVERRIDE { | 115 SyncDirection direction) override { |
116 if (ui_task_runner_->RunsTasksOnCurrentThread()) { | 116 if (ui_task_runner_->RunsTasksOnCurrentThread()) { |
117 if (sync_engine_) | 117 if (sync_engine_) |
118 sync_engine_->OnFileStatusChanged( | 118 sync_engine_->OnFileStatusChanged( |
119 url, file_type, file_status, sync_action, direction); | 119 url, file_type, file_status, sync_action, direction); |
120 return; | 120 return; |
121 } | 121 } |
122 | 122 |
123 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 123 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
124 ui_task_runner_->PostTask( | 124 ui_task_runner_->PostTask( |
125 FROM_HERE, | 125 FROM_HERE, |
126 base::Bind(&SyncEngine::OnFileStatusChanged, | 126 base::Bind(&SyncEngine::OnFileStatusChanged, |
127 sync_engine_, | 127 sync_engine_, |
128 url, file_type, file_status, sync_action, direction)); | 128 url, file_type, file_status, sync_action, direction)); |
129 } | 129 } |
130 | 130 |
131 virtual void UpdateServiceState(RemoteServiceState state, | 131 virtual void UpdateServiceState(RemoteServiceState state, |
132 const std::string& description) OVERRIDE { | 132 const std::string& description) override { |
133 if (ui_task_runner_->RunsTasksOnCurrentThread()) { | 133 if (ui_task_runner_->RunsTasksOnCurrentThread()) { |
134 if (sync_engine_) | 134 if (sync_engine_) |
135 sync_engine_->UpdateServiceState(state, description); | 135 sync_engine_->UpdateServiceState(state, description); |
136 return; | 136 return; |
137 } | 137 } |
138 | 138 |
139 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 139 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
140 ui_task_runner_->PostTask( | 140 ui_task_runner_->PostTask( |
141 FROM_HERE, | 141 FROM_HERE, |
142 base::Bind(&SyncEngine::UpdateServiceState, | 142 base::Bind(&SyncEngine::UpdateServiceState, |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 | 802 |
803 SyncStatusCallback SyncEngine::TrackCallback( | 803 SyncStatusCallback SyncEngine::TrackCallback( |
804 const SyncStatusCallback& callback) { | 804 const SyncStatusCallback& callback) { |
805 return callback_tracker_.Register( | 805 return callback_tracker_.Register( |
806 base::Bind(callback, SYNC_STATUS_ABORT), | 806 base::Bind(callback, SYNC_STATUS_ABORT), |
807 callback); | 807 callback); |
808 } | 808 } |
809 | 809 |
810 } // namespace drive_backend | 810 } // namespace drive_backend |
811 } // namespace sync_file_system | 811 } // namespace sync_file_system |
OLD | NEW |