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

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

Issue 10310113: Add additional error logging to investigate Autocomplete Sync failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert a couple of stray changes Created 8 years, 7 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/generic_change_processor.h" 5 #include "chrome/browser/sync/glue/generic_change_processor.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 syncable::ModelTypeToRootTag(change.sync_data().GetDataType())) != 184 syncable::ModelTypeToRootTag(change.sync_data().GetDataType())) !=
185 sync_api::BaseNode::INIT_OK) { 185 sync_api::BaseNode::INIT_OK) {
186 NOTREACHED(); 186 NOTREACHED();
187 SyncError error(FROM_HERE, 187 SyncError error(FROM_HERE,
188 "Failed to look up root node for type " + type_str, 188 "Failed to look up root node for type " + type_str,
189 type); 189 type);
190 error_handler()->OnSingleDatatypeUnrecoverableError(error.location(), 190 error_handler()->OnSingleDatatypeUnrecoverableError(error.location(),
191 error.message()); 191 error.message());
192 return error; 192 return error;
193 } 193 }
194 if (!sync_node.InitUniqueByCreation(change.sync_data().GetDataType(), 194 sync_api::WriteNode::InitUniqueByCreationResult result =
195 sync_node.InitUniqueByCreation(change.sync_data().GetDataType(),
195 root_node, 196 root_node,
196 change.sync_data().GetTag())) { 197 change.sync_data().GetTag());
198 if (result != sync_api::WriteNode::INIT_SUCCESS) {
197 NOTREACHED(); 199 NOTREACHED();
198 SyncError error(FROM_HERE, 200 std::string error_prefix = "Failed to create " + type_str + " node: ";
199 "Failed to create " + type_str + " node.", 201 SyncError error;
202 switch (result) {
203 case sync_api::WriteNode::INIT_FAILED_EMPTY_TAG:
204 error.Reset(FROM_HERE, error_prefix + "empty tag", type);
205 error_handler()->OnSingleDatatypeUnrecoverableError(
206 error.location(), error.message());
207 return error;
208
tim (not reviewing) 2012/05/17 00:22:10 There are extra newlines before each case.
Ilya Sherman 2012/05/17 00:40:04 Done.
209 case sync_api::WriteNode::INIT_FAILED_ENTRY_ALREADY_EXISTS:
210 error.Reset(FROM_HERE, error_prefix + "entry already exists", type);
211 error_handler()->OnSingleDatatypeUnrecoverableError(
212 error.location(), error.message());
213 return error;
214
215 case sync_api::WriteNode::INIT_FAILED_COULD_NOT_CREATE_ENTRY:
216 error.Reset(FROM_HERE, error_prefix + "failed to create entry",
200 type); 217 type);
201 error_handler()->OnSingleDatatypeUnrecoverableError(error.location(), 218 error_handler()->OnSingleDatatypeUnrecoverableError(
202 error.message()); 219 error.location(), error.message());
203 return error; 220 return error;
221
222 case sync_api::WriteNode::INIT_FAILED_SET_PREDECESSOR:
223 error.Reset(FROM_HERE, error_prefix + "failed to set predecessor",
224 type);
225 error_handler()->OnSingleDatatypeUnrecoverableError(
226 error.location(), error.message());
227 return error;
228
229 default:
230 error.Reset(FROM_HERE, error_prefix + "unknown error", type);
231 error_handler()->OnSingleDatatypeUnrecoverableError(
232 error.location(), error.message());
233 return error;
234 }
204 } 235 }
205 sync_node.SetTitle(UTF8ToWide(change.sync_data().GetTitle())); 236 sync_node.SetTitle(UTF8ToWide(change.sync_data().GetTitle()));
206 sync_node.SetEntitySpecifics(change.sync_data().GetSpecifics()); 237 sync_node.SetEntitySpecifics(change.sync_data().GetSpecifics());
207 } else if (change.change_type() == SyncChange::ACTION_UPDATE) { 238 } else if (change.change_type() == SyncChange::ACTION_UPDATE) {
208 // TODO(zea): consider having this logic for all possible changes? 239 // TODO(zea): consider having this logic for all possible changes?
209 sync_api::BaseNode::InitByLookupResult result = 240 sync_api::BaseNode::InitByLookupResult result =
210 sync_node.InitByClientTagLookup(change.sync_data().GetDataType(), 241 sync_node.InitByClientTagLookup(change.sync_data().GetDataType(),
211 change.sync_data().GetTag()); 242 change.sync_data().GetTag());
212 SyncError error; 243 SyncError error;
213 if (result != sync_api::BaseNode::INIT_OK) { 244 if (result != sync_api::BaseNode::INIT_OK) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 void GenericChangeProcessor::StopImpl() { 366 void GenericChangeProcessor::StopImpl() {
336 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 367 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
337 } 368 }
338 369
339 sync_api::UserShare* GenericChangeProcessor::share_handle() const { 370 sync_api::UserShare* GenericChangeProcessor::share_handle() const {
340 DCHECK(CalledOnValidThread()); 371 DCHECK(CalledOnValidThread());
341 return share_handle_; 372 return share_handle_;
342 } 373 }
343 374
344 } // namespace browser_sync 375 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/glue/password_change_processor.cc » ('j') | sync/internal_api/write_node.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698