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

Unified Diff: components/sync/device_info/device_info_sync_bridge.cc

Issue 2563123002: [Sync] Update local device info when re-enabled.
Patch Set: Created 4 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
« no previous file with comments | « components/sync/device_info/device_info_sync_bridge.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/device_info/device_info_sync_bridge.cc
diff --git a/components/sync/device_info/device_info_sync_bridge.cc b/components/sync/device_info/device_info_sync_bridge.cc
index e1387abef361d7f0fcfff38b043161c3ef10810c..ce57cefdc742cb04a0d8711c565ec3ef0a4a1c96 100644
--- a/components/sync/device_info/device_info_sync_bridge.cc
+++ b/components/sync/device_info/device_info_sync_bridge.cc
@@ -116,7 +116,6 @@ DeviceInfoSyncBridge::CreateMetadataChangeList() {
SyncError DeviceInfoSyncBridge::MergeSyncData(
std::unique_ptr<MetadataChangeList> metadata_change_list,
EntityDataMap entity_data_map) {
- DCHECK(has_provider_initialized_);
DCHECK(change_processor()->IsTrackingMetadata());
const DeviceInfo* local_info =
local_device_info_provider_->GetLocalDeviceInfo();
@@ -170,7 +169,6 @@ SyncError DeviceInfoSyncBridge::MergeSyncData(
SyncError DeviceInfoSyncBridge::ApplySyncChanges(
std::unique_ptr<MetadataChangeList> metadata_change_list,
EntityChangeList entity_changes) {
- DCHECK(has_provider_initialized_);
const DeviceInfo* local_info =
local_device_info_provider_->GetLocalDeviceInfo();
// If our dependency was yanked out from beneath us, we cannot correctly
@@ -323,6 +321,7 @@ bool DeviceInfoSyncBridge::DeleteSpecifics(const std::string& guid,
}
void DeviceInfoSyncBridge::OnProviderInitialized() {
+ DCHECK(local_device_info_provider_->GetLocalDeviceInfo() != nullptr);
// Now that the provider has initialized, remove the subscription. The bridge
// should only need to give the processor metadata upon initialization. If
// sync is disabled and enabled, our provider will try to retrigger this
@@ -330,8 +329,6 @@ void DeviceInfoSyncBridge::OnProviderInitialized() {
// TODO(skym, crbug.com/672600): Handle re-initialization and start the pulse
// timer.
subscription_.reset();
-
- has_provider_initialized_ = true;
LoadMetadataIfReady();
}
@@ -370,7 +367,8 @@ void DeviceInfoSyncBridge::OnReadAllData(
}
void DeviceInfoSyncBridge::LoadMetadataIfReady() {
- if (has_data_loaded_ && has_provider_initialized_) {
+ if (has_data_loaded_ &&
+ local_device_info_provider_->GetLocalDeviceInfo() != nullptr) {
store_->ReadAllMetadata(base::Bind(&DeviceInfoSyncBridge::OnReadAllMetadata,
base::AsWeakPtr(this)));
}
@@ -391,14 +389,6 @@ void DeviceInfoSyncBridge::OnCommit(Result result) {
}
void DeviceInfoSyncBridge::ReconcileLocalAndStored() {
- // On initial syncing we will have a change processor here, but it will not be
- // tracking changes. We need to persist a copy of our local device info to
- // disk, but the Put call to the processor will be ignored. That should be
- // fine however, as the discrepancy will be picked up later in merge. We don't
- // bother trying to track this case and act intelligently because simply not
- // much of a benefit in doing so.
- DCHECK(has_provider_initialized_);
-
const DeviceInfo* current_info =
local_device_info_provider_->GetLocalDeviceInfo();
// Must ensure |pulse_timer_| is started even if sync is in the process of
@@ -428,8 +418,6 @@ void DeviceInfoSyncBridge::ReconcileLocalAndStored() {
}
void DeviceInfoSyncBridge::SendLocalData() {
- DCHECK(has_provider_initialized_);
-
// It is possible that the provider no longer has data for us, such as when
// the user signs out. No-op this pulse, but keep the timer going in case sync
// is enabled later.
« no previous file with comments | « components/sync/device_info/device_info_sync_bridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698