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

Unified Diff: components/sync/model_impl/model_type_store_impl.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/sync/model_impl/model_type_store_impl.cc
diff --git a/components/sync/model_impl/model_type_store_impl.cc b/components/sync/model_impl/model_type_store_impl.cc
index 542dfb90a84bef2574eea7aa31484694c1586ee9..6c09dca17e813b7098007f18456484daa2c1521a 100644
--- a/components/sync/model_impl/model_type_store_impl.cc
+++ b/components/sync/model_impl/model_type_store_impl.cc
@@ -69,8 +69,7 @@ ModelTypeStoreImpl::ModelTypeStoreImpl(
ModelType type,
scoped_refptr<ModelTypeStoreBackend> backend,
scoped_refptr<base::SequencedTaskRunner> backend_task_runner)
- : type_(type),
- backend_(backend),
+ : backend_(backend),
backend_task_runner_(backend_task_runner),
data_prefix_(FormatDataPrefix(type)),
metadata_prefix_(FormatMetaPrefix(type)),
@@ -231,7 +230,7 @@ void ModelTypeStoreImpl::ReadMetadataRecordsDone(
Result result) {
DCHECK(CalledOnValidThread());
if (result != Result::SUCCESS) {
- callback.Run(MakeSyncError("Reading metadata failed."),
+ callback.Run(ModelError(FROM_HERE, "Reading metadata failed."),
base::MakeUnique<MetadataBatch>());
return;
}
@@ -262,7 +261,7 @@ void ModelTypeStoreImpl::ReadAllMetadataDone(
DCHECK(CalledOnValidThread());
if (result != Result::SUCCESS) {
- callback.Run(MakeSyncError("Reading metadata failed."),
+ callback.Run(ModelError(FROM_HERE, "Reading metadata failed."),
base::MakeUnique<MetadataBatch>());
return;
}
@@ -290,8 +289,9 @@ void ModelTypeStoreImpl::DeserializeMetadata(
sync_pb::ModelTypeState state;
if (!state.ParseFromString(global_metadata)) {
- callback.Run(MakeSyncError("Failed to deserialize model type state."),
- base::MakeUnique<MetadataBatch>());
+ callback.Run(
+ ModelError(FROM_HERE, "Failed to deserialize model type state."),
+ base::MakeUnique<MetadataBatch>());
return;
}
metadata_batch->SetModelTypeState(state);
@@ -299,18 +299,15 @@ void ModelTypeStoreImpl::DeserializeMetadata(
for (const Record& r : *metadata_records.get()) {
sync_pb::EntityMetadata entity_metadata;
if (!entity_metadata.ParseFromString(r.value)) {
- callback.Run(MakeSyncError("Failed to deserialize entity metadata."),
- base::MakeUnique<MetadataBatch>());
+ callback.Run(
+ ModelError(FROM_HERE, "Failed to deserialize entity metadata."),
+ base::MakeUnique<MetadataBatch>());
return;
}
metadata_batch->AddMetadata(r.id, entity_metadata);
}
- callback.Run(SyncError(), std::move(metadata_batch));
-}
-
-SyncError ModelTypeStoreImpl::MakeSyncError(const std::string& msg) {
- return SyncError(FROM_HERE, SyncError::DATATYPE_ERROR, msg, type_);
+ callback.Run(ModelError(), std::move(metadata_batch));
}
std::unique_ptr<ModelTypeStore::WriteBatch>

Powered by Google App Engine
This is Rietveld 408576698