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

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: Sky's 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..45d513d89c70e51c6f63546555eaa5a2c0fdab62 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),
+ 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) {
+ GetOrCreateChangeProcessor();
+ }
if (!change_processor()) {
// This datatype was disabled while this read was oustanding.
return;
@@ -421,10 +426,15 @@ void DeviceInfoService::TryReconcileLocalAndStored() {
}
void DeviceInfoService::TryLoadAllMetadata() {
- if (has_data_loaded_ && change_processor()) {
+ // TODO(skym): fix the double load metadata issue
skym 2016/03/24 22:51:37 nit: Comments should look like sentences with capi
Gang Wu 2016/03/25 02:07:00 Done.
+ if (has_data_loaded_) {
store_->ReadAllMetadata(base::Bind(&DeviceInfoService::OnReadAllMetadata,
weak_factory_.GetWeakPtr()));
}
}
+syncer::ModelType DeviceInfoService::type() const {
+ return syncer::DEVICE_INFO;
+}
+
} // namespace sync_driver_v2

Powered by Google App Engine
This is Rietveld 408576698