Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: chrome/browser/sync/glue/shared_change_processor.cc

Issue 15701022: [Sync] Add support for sync Persistence Errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move bookmark change into separate patch Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 error_handler_ = NULL; 88 error_handler_ = NULL;
89 return was_connected; 89 return was_connected;
90 } 90 }
91 91
92 syncer::SyncError SharedChangeProcessor::GetSyncData( 92 syncer::SyncError SharedChangeProcessor::GetSyncData(
93 syncer::SyncDataList* current_sync_data) { 93 syncer::SyncDataList* current_sync_data) {
94 DCHECK(backend_loop_.get()); 94 DCHECK(backend_loop_.get());
95 DCHECK(backend_loop_->BelongsToCurrentThread()); 95 DCHECK(backend_loop_->BelongsToCurrentThread());
96 AutoLock lock(monitor_lock_); 96 AutoLock lock(monitor_lock_);
97 if (disconnected_) { 97 if (disconnected_) {
98 syncer::SyncError error(FROM_HERE, "Change processor disconnected.", type_); 98 syncer::SyncError error(FROM_HERE,
99 syncer::SyncError::DATATYPE_ERROR,
100 "Change processor disconnected.",
101 type_);
99 return error; 102 return error;
100 } 103 }
101 return generic_change_processor_->GetSyncDataForType(type_, 104 return generic_change_processor_->GetSyncDataForType(type_,
102 current_sync_data); 105 current_sync_data);
103 } 106 }
104 107
105 int SharedChangeProcessor::GetSyncCount() { 108 int SharedChangeProcessor::GetSyncCount() {
106 DCHECK(backend_loop_.get()); 109 DCHECK(backend_loop_.get());
107 DCHECK(backend_loop_->BelongsToCurrentThread()); 110 DCHECK(backend_loop_->BelongsToCurrentThread());
108 AutoLock lock(monitor_lock_); 111 AutoLock lock(monitor_lock_);
109 if (disconnected_) { 112 if (disconnected_) {
110 LOG(ERROR) << "Change processor disconnected."; 113 LOG(ERROR) << "Change processor disconnected.";
111 return 0; 114 return 0;
112 } 115 }
113 return generic_change_processor_->GetSyncCountForType(type_); 116 return generic_change_processor_->GetSyncCountForType(type_);
114 } 117 }
115 118
116 syncer::SyncError SharedChangeProcessor::ProcessSyncChanges( 119 syncer::SyncError SharedChangeProcessor::ProcessSyncChanges(
117 const tracked_objects::Location& from_here, 120 const tracked_objects::Location& from_here,
118 const syncer::SyncChangeList& list_of_changes) { 121 const syncer::SyncChangeList& list_of_changes) {
119 DCHECK(backend_loop_.get()); 122 DCHECK(backend_loop_.get());
120 DCHECK(backend_loop_->BelongsToCurrentThread()); 123 DCHECK(backend_loop_->BelongsToCurrentThread());
121 AutoLock lock(monitor_lock_); 124 AutoLock lock(monitor_lock_);
122 if (disconnected_) { 125 if (disconnected_) {
123 // The DTC that disconnects us must ensure it posts a StopSyncing task. 126 // The DTC that disconnects us must ensure it posts a StopSyncing task.
124 // If we reach this, it means it just hasn't executed yet. 127 // If we reach this, it means it just hasn't executed yet.
125 syncer::SyncError error(FROM_HERE, "Change processor disconnected.", type_); 128 syncer::SyncError error(FROM_HERE,
129 syncer::SyncError::DATATYPE_ERROR,
130 "Change processor disconnected.",
131 type_);
126 return error; 132 return error;
127 } 133 }
128 return generic_change_processor_->ProcessSyncChanges( 134 return generic_change_processor_->ProcessSyncChanges(
129 from_here, list_of_changes); 135 from_here, list_of_changes);
130 } 136 }
131 137
132 bool SharedChangeProcessor::SyncModelHasUserCreatedNodes(bool* has_nodes) { 138 bool SharedChangeProcessor::SyncModelHasUserCreatedNodes(bool* has_nodes) {
133 DCHECK(backend_loop_.get()); 139 DCHECK(backend_loop_.get());
134 DCHECK(backend_loop_->BelongsToCurrentThread()); 140 DCHECK(backend_loop_->BelongsToCurrentThread());
135 AutoLock lock(monitor_lock_); 141 AutoLock lock(monitor_lock_);
(...skipping 30 matching lines...) Expand all
166 generic_change_processor_); 172 generic_change_processor_);
167 } 173 }
168 174
169 syncer::SyncError SharedChangeProcessor::CreateAndUploadError( 175 syncer::SyncError SharedChangeProcessor::CreateAndUploadError(
170 const tracked_objects::Location& location, 176 const tracked_objects::Location& location,
171 const std::string& message) { 177 const std::string& message) {
172 AutoLock lock(monitor_lock_); 178 AutoLock lock(monitor_lock_);
173 if (!disconnected_) { 179 if (!disconnected_) {
174 return error_handler_->CreateAndUploadError(location, message, type_); 180 return error_handler_->CreateAndUploadError(location, message, type_);
175 } else { 181 } else {
176 return syncer::SyncError(location, message, type_); 182 return syncer::SyncError(location,
183 syncer::SyncError::DATATYPE_ERROR,
184 message,
185 type_);
177 } 186 }
178 } 187 }
179 188
180 } // namespace browser_sync 189 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698