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

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: De-nitting 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
« no previous file with comments | « no previous file | chrome/browser/sync/glue/password_change_processor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 case sync_api::WriteNode::INIT_FAILED_ENTRY_ALREADY_EXISTS:
209 error.Reset(FROM_HERE, error_prefix + "entry already exists", type);
210 error_handler()->OnSingleDatatypeUnrecoverableError(
211 error.location(), error.message());
212 return error;
213 case sync_api::WriteNode::INIT_FAILED_COULD_NOT_CREATE_ENTRY:
214 error.Reset(FROM_HERE, error_prefix + "failed to create entry",
200 type); 215 type);
201 error_handler()->OnSingleDatatypeUnrecoverableError(error.location(), 216 error_handler()->OnSingleDatatypeUnrecoverableError(
202 error.message()); 217 error.location(), error.message());
203 return error; 218 return error;
219 case sync_api::WriteNode::INIT_FAILED_SET_PREDECESSOR:
220 error.Reset(FROM_HERE, error_prefix + "failed to set predecessor",
221 type);
222 error_handler()->OnSingleDatatypeUnrecoverableError(
223 error.location(), error.message());
224 return error;
225 default:
226 error.Reset(FROM_HERE, error_prefix + "unknown error", type);
227 error_handler()->OnSingleDatatypeUnrecoverableError(
228 error.location(), error.message());
229 return error;
230 }
204 } 231 }
205 sync_node.SetTitle(UTF8ToWide(change.sync_data().GetTitle())); 232 sync_node.SetTitle(UTF8ToWide(change.sync_data().GetTitle()));
206 sync_node.SetEntitySpecifics(change.sync_data().GetSpecifics()); 233 sync_node.SetEntitySpecifics(change.sync_data().GetSpecifics());
207 } else if (change.change_type() == SyncChange::ACTION_UPDATE) { 234 } else if (change.change_type() == SyncChange::ACTION_UPDATE) {
208 // TODO(zea): consider having this logic for all possible changes? 235 // TODO(zea): consider having this logic for all possible changes?
209 sync_api::BaseNode::InitByLookupResult result = 236 sync_api::BaseNode::InitByLookupResult result =
210 sync_node.InitByClientTagLookup(change.sync_data().GetDataType(), 237 sync_node.InitByClientTagLookup(change.sync_data().GetDataType(),
211 change.sync_data().GetTag()); 238 change.sync_data().GetTag());
212 SyncError error; 239 SyncError error;
213 if (result != sync_api::BaseNode::INIT_OK) { 240 if (result != sync_api::BaseNode::INIT_OK) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 void GenericChangeProcessor::StopImpl() { 362 void GenericChangeProcessor::StopImpl() {
336 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 363 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
337 } 364 }
338 365
339 sync_api::UserShare* GenericChangeProcessor::share_handle() const { 366 sync_api::UserShare* GenericChangeProcessor::share_handle() const {
340 DCHECK(CalledOnValidThread()); 367 DCHECK(CalledOnValidThread());
341 return share_handle_; 368 return share_handle_;
342 } 369 }
343 370
344 } // namespace browser_sync 371 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/glue/password_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698