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

Unified Diff: components/sync_driver/device_info_service.cc

Issue 1763953002: [USS] Change the place where SharedModelTypeProcessor got created (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update base on recent review Created 4 years, 9 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_driver/device_info_service.cc
diff --git a/components/sync_driver/device_info_service.cc b/components/sync_driver/device_info_service.cc
index 6a63dcbeb0a0b68746b37410b56a3c585b3c3574..28287669ae6a2cf1c62a9887587d1a700e7f2fc3 100644
--- a/components/sync_driver/device_info_service.cc
+++ b/components/sync_driver/device_info_service.cc
@@ -42,8 +42,10 @@ using WriteBatch = ModelTypeStore::WriteBatch;
DeviceInfoService::DeviceInfoService(
sync_driver::LocalDeviceInfoProvider* local_device_info_provider,
- const StoreFactoryFunction& callback)
- : local_device_info_provider_(local_device_info_provider),
+ const StoreFactoryFunction& callback,
+ const ChangeProcessorFactory& change_processor_factory)
+ : ModelTypeService(change_processor_factory, syncer::DEVICE_INFO),
+ local_device_info_provider_(local_device_info_provider),
weak_factory_(this) {
DCHECK(local_device_info_provider);
@@ -370,6 +372,9 @@ void DeviceInfoService::OnReadAllMetadata(
Result result,
scoped_ptr<RecordList> metadata_records,
const std::string& global_metadata) {
+ if (metadata_records->size() > 0 || global_metadata.size() > 0) {
maxbogue 2016/03/25 17:32:41 nit: !global_metadata.empty() instead of global_me
Gang Wu 2016/03/25 18:08:33 Done.
+ GetOrCreateChangeProcessor();
+ }
if (!change_processor()) {
// This datatype was disabled while this read was oustanding.
return;
@@ -421,7 +426,8 @@ void DeviceInfoService::TryReconcileLocalAndStored() {
}
void DeviceInfoService::TryLoadAllMetadata() {
- if (has_data_loaded_ && change_processor()) {
+ // TODO(skym): Fix the double load metadata issue.
+ if (has_data_loaded_) {
store_->ReadAllMetadata(base::Bind(&DeviceInfoService::OnReadAllMetadata,
weak_factory_.GetWeakPtr()));
}

Powered by Google App Engine
This is Rietveld 408576698