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

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: nit 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..84cd707bc525de7965340a261558fa09136447ad 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.empty()) {
+ 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()));
}
« no previous file with comments | « components/sync_driver/device_info_service.h ('k') | components/sync_driver/device_info_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698