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

Unified Diff: components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc

Issue 2618483003: [Sync] Introduce ModelError for USS error handling. (Closed)
Patch Set: Fix other iOS test file that I thought was the first one. Created 3 years, 11 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: components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc
diff --git a/components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc b/components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc
index 2edafc505af6332845894885622656c302fc50c0..cc3893e070036b92a25fedcc7417400a198b87c5 100644
--- a/components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc
+++ b/components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc
@@ -17,9 +17,9 @@
#include "components/autofill/core/browser/webdata/autofill_webdata_backend.h"
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
#include "components/sync/model/entity_data.h"
+#include "components/sync/model/model_error.h"
#include "components/sync/model/model_type_change_processor.h"
#include "components/sync/model/mutable_data_batch.h"
-#include "components/sync/model/sync_error.h"
#include "net/base/escape.h"
namespace autofill {
@@ -105,20 +105,20 @@ AutocompleteSyncBridge::CreateMetadataChangeList() {
syncer::AUTOFILL);
}
-syncer::SyncError AutocompleteSyncBridge::MergeSyncData(
+syncer::ModelError AutocompleteSyncBridge::MergeSyncData(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityDataMap entity_data_map) {
DCHECK(thread_checker_.CalledOnValidThread());
NOTIMPLEMENTED();
- return syncer::SyncError();
+ return syncer::ModelError();
}
-syncer::SyncError AutocompleteSyncBridge::ApplySyncChanges(
+syncer::ModelError AutocompleteSyncBridge::ApplySyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) {
DCHECK(thread_checker_.CalledOnValidThread());
NOTIMPLEMENTED();
- return syncer::SyncError();
+ return syncer::ModelError();
}
void AutocompleteSyncBridge::AutocompleteSyncBridge::GetData(
@@ -130,27 +130,38 @@ void AutocompleteSyncBridge::AutocompleteSyncBridge::GetData(
keys_set.insert(key);
}
- auto batch = base::MakeUnique<syncer::MutableDataBatch>();
std::vector<AutofillEntry> entries;
- GetAutofillTable()->GetAllAutofillEntries(&entries);
+ if (!GetAutofillTable()->GetAllAutofillEntries(&entries)) {
skym 2017/01/09 18:20:27 I see you added the logic here but not the unit te
maxbogue 2017/01/09 21:29:33 Taking you up on your offline offer to add them yo
+ change_processor()->ReportError(FROM_HERE,
+ "Failed to load entries from table.");
+ return;
+ }
+
+ auto batch = base::MakeUnique<syncer::MutableDataBatch>();
for (const AutofillEntry& entry : entries) {
std::string key = GetStorageKeyFromModel(entry.key());
if (keys_set.find(key) != keys_set.end()) {
batch->Put(key, CreateEntityData(entry));
}
}
- callback.Run(syncer::SyncError(), std::move(batch));
+ callback.Run(std::move(batch));
}
void AutocompleteSyncBridge::GetAllData(DataCallback callback) {
DCHECK(thread_checker_.CalledOnValidThread());
- auto batch = base::MakeUnique<syncer::MutableDataBatch>();
+
std::vector<AutofillEntry> entries;
- GetAutofillTable()->GetAllAutofillEntries(&entries);
+ if (!GetAutofillTable()->GetAllAutofillEntries(&entries)) {
skym 2017/01/09 18:20:27 This is looking very repeated to above. You could
maxbogue 2017/01/09 21:29:33 Passing on this for now.
+ change_processor()->ReportError(FROM_HERE,
+ "Failed to load entries from table.");
+ return;
+ }
+
+ auto batch = base::MakeUnique<syncer::MutableDataBatch>();
for (const AutofillEntry& entry : entries) {
batch->Put(GetStorageKeyFromModel(entry.key()), CreateEntityData(entry));
}
- callback.Run(syncer::SyncError(), std::move(batch));
+ callback.Run(std::move(batch));
}
std::string AutocompleteSyncBridge::GetClientTag(

Powered by Google App Engine
This is Rietveld 408576698