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

Unified Diff: sync/internal_api/shared_model_type_processor.cc

Issue 1486363002: USS: Introduce dependency of SharedModelTypeProcessor on ModelTypeService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback Created 5 years 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: sync/internal_api/shared_model_type_processor.cc
diff --git a/sync/internal_api/shared_model_type_processor.cc b/sync/internal_api/shared_model_type_processor.cc
index db511dfa4309c09518f9275a44f0ab1d204a6e22..97cf8e5c7a72b2fbf70959911561b80cf5c00072 100644
--- a/sync/internal_api/shared_model_type_processor.cc
+++ b/sync/internal_api/shared_model_type_processor.cc
@@ -69,15 +69,16 @@ void ModelTypeProcessorProxy::OnUpdateReceived(
} // namespace
-SharedModelTypeProcessor::SharedModelTypeProcessor(
- syncer::ModelType type,
- base::WeakPtr<ModelTypeStore> store)
+SharedModelTypeProcessor::SharedModelTypeProcessor(syncer::ModelType type,
+ ModelTypeService* service)
: type_(type),
is_enabled_(false),
is_connected_(false),
- store_(store),
+ service_(service),
weak_ptr_factory_for_ui_(this),
- weak_ptr_factory_for_sync_(this) {}
+ weak_ptr_factory_for_sync_(this) {
+ DCHECK(service);
+}
SharedModelTypeProcessor::~SharedModelTypeProcessor() {}
@@ -272,8 +273,8 @@ void SharedModelTypeProcessor::OnUpdateReceived(
ModelTypeEntity* entity = nullptr;
EntityMap::const_iterator it = entities_.find(client_tag_hash);
if (it == entities_.end()) {
- // TODO(stanisc): crbug/561821: Get client_tag from the service.
- std::string client_tag = client_tag_hash;
+ // Let the service define |client_tag| based on the entity data.
+ std::string client_tag = service_->GetClientTag(data);
scoped_ptr<ModelTypeEntity> scoped_entity = ModelTypeEntity::CreateNew(
client_tag, client_tag_hash, data.id, data.creation_time);
« no previous file with comments | « sync/internal_api/public/test/fake_model_type_service.h ('k') | sync/internal_api/shared_model_type_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698