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

Unified Diff: chrome/browser/sync/glue/autofill_profile_model_associator.cc

Issue 7453014: [Sync] Refactor sync datatype error handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and fix final unit test <3 c++ Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/autofill_profile_model_associator.cc
diff --git a/chrome/browser/sync/glue/autofill_profile_model_associator.cc b/chrome/browser/sync/glue/autofill_profile_model_associator.cc
index ca01b083b17251e40c8a4bcdb4bb5ce5979d1053..9c2692b426c1b9b210492fa3016f20dc4ef89b20 100644
--- a/chrome/browser/sync/glue/autofill_profile_model_associator.cc
+++ b/chrome/browser/sync/glue/autofill_profile_model_associator.cc
@@ -6,6 +6,7 @@
#include "base/tracked.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/sync/api/sync_error.h"
#include "chrome/browser/sync/glue/autofill_profile_change_processor.h"
#include "chrome/browser/sync/glue/do_optimistic_refresh_task.h"
#include "chrome/browser/sync/profile_sync_service.h"
@@ -136,7 +137,7 @@ bool AutofillProfileModelAssociator::LoadAutofillData(
return true;
}
-bool AutofillProfileModelAssociator::AssociateModels() {
+bool AutofillProfileModelAssociator::AssociateModels(SyncError* error) {
VLOG(1) << "Associating Autofill Models";
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
{
@@ -147,7 +148,9 @@ bool AutofillProfileModelAssociator::AssociateModels() {
ScopedVector<AutofillProfile> profiles;
if (!LoadAutofillData(&profiles.get())) {
- LOG(ERROR) << "Could not get the autofill data from WebDatabase.";
+ error->Reset(FROM_HERE,
+ "Could not get the autofill data from WebDatabase.",
+ model_type());
return false;
}
@@ -162,8 +165,10 @@ bool AutofillProfileModelAssociator::AssociateModels() {
sync_api::ReadNode autofill_root(&trans);
if (!autofill_root.InitByTagLookup(kAutofillProfileTag)) {
- LOG(ERROR) << "Server did not create the top-level autofill node. We "
- << "might be running against an out-of-date server.";
+ error->Reset(FROM_HERE,
+ "Server did not create the top-level autofill node. We "
+ "might be running against an out-of-date server.",
+ model_type());
return false;
}
@@ -173,12 +178,15 @@ bool AutofillProfileModelAssociator::AssociateModels() {
&bundle.new_profiles,
&bundle.profiles_to_delete) ||
!TraverseAndAssociateAllSyncNodes(&trans, autofill_root, &bundle)) {
+ error->Reset(FROM_HERE,
+ "Failed to associate all sync nodes.",
+ model_type());
return false;
}
}
if (!SaveChangesToWebData(bundle)) {
- LOG(ERROR) << "Failed to update autofill entries.";
+ error->Reset(FROM_HERE, "Failed to update webdata.", model_type());
return false;
}
@@ -187,7 +195,7 @@ bool AutofillProfileModelAssociator::AssociateModels() {
return true;
}
-bool AutofillProfileModelAssociator::DisassociateModels() {
+bool AutofillProfileModelAssociator::DisassociateModels(SyncError* error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
id_map_.clear();
id_map_inverse_.clear();

Powered by Google App Engine
This is Rietveld 408576698