OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/glue/shared_change_processor.h" | 5 #include "chrome/browser/sync/glue/shared_change_processor.h" |
6 | 6 |
7 #include "chrome/browser/sync/glue/generic_change_processor.h" | 7 #include "chrome/browser/sync/glue/generic_change_processor.h" |
8 #include "chrome/browser/sync/profile_sync_components_factory.h" | 8 #include "chrome/browser/sync/profile_sync_components_factory.h" |
9 #include "chrome/browser/sync/profile_sync_service.h" | 9 #include "chrome/browser/sync/profile_sync_service.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 syncer::SyncError error(FROM_HERE, | 128 syncer::SyncError error(FROM_HERE, |
129 syncer::SyncError::DATATYPE_ERROR, | 129 syncer::SyncError::DATATYPE_ERROR, |
130 "Change processor disconnected.", | 130 "Change processor disconnected.", |
131 type_); | 131 type_); |
132 return error; | 132 return error; |
133 } | 133 } |
134 return generic_change_processor_->ProcessSyncChanges( | 134 return generic_change_processor_->ProcessSyncChanges( |
135 from_here, list_of_changes); | 135 from_here, list_of_changes); |
136 } | 136 } |
137 | 137 |
| 138 syncer::SyncDataList SharedChangeProcessor::GetAllSyncData( |
| 139 syncer::ModelType type) const { |
| 140 DCHECK(backend_loop_.get()); |
| 141 DCHECK(backend_loop_->BelongsToCurrentThread()); |
| 142 AutoLock lock(monitor_lock_); |
| 143 if (disconnected_) { |
| 144 LOG(ERROR) << "Change processor disconnected."; |
| 145 return syncer::SyncDataList(); |
| 146 } |
| 147 return generic_change_processor_->GetAllSyncData(type); |
| 148 } |
| 149 |
138 bool SharedChangeProcessor::SyncModelHasUserCreatedNodes(bool* has_nodes) { | 150 bool SharedChangeProcessor::SyncModelHasUserCreatedNodes(bool* has_nodes) { |
139 DCHECK(backend_loop_.get()); | 151 DCHECK(backend_loop_.get()); |
140 DCHECK(backend_loop_->BelongsToCurrentThread()); | 152 DCHECK(backend_loop_->BelongsToCurrentThread()); |
141 AutoLock lock(monitor_lock_); | 153 AutoLock lock(monitor_lock_); |
142 if (disconnected_) { | 154 if (disconnected_) { |
143 LOG(ERROR) << "Change processor disconnected."; | 155 LOG(ERROR) << "Change processor disconnected."; |
144 return false; | 156 return false; |
145 } | 157 } |
146 return generic_change_processor_->SyncModelHasUserCreatedNodes( | 158 return generic_change_processor_->SyncModelHasUserCreatedNodes( |
147 type_, has_nodes); | 159 type_, has_nodes); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return error_handler_->CreateAndUploadError(location, message, type_); | 192 return error_handler_->CreateAndUploadError(location, message, type_); |
181 } else { | 193 } else { |
182 return syncer::SyncError(location, | 194 return syncer::SyncError(location, |
183 syncer::SyncError::DATATYPE_ERROR, | 195 syncer::SyncError::DATATYPE_ERROR, |
184 message, | 196 message, |
185 type_); | 197 type_); |
186 } | 198 } |
187 } | 199 } |
188 | 200 |
189 } // namespace browser_sync | 201 } // namespace browser_sync |
OLD | NEW |