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

Side by Side Diff: components/sync/device_info/device_info_sync_bridge.cc

Issue 2536043002: [Sync] Stop updating local device info time stamp on merge. (Closed)
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 unified diff | Download patch
« no previous file with comments | « no previous file | components/sync/device_info/device_info_sync_bridge_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync/device_info/device_info_sync_bridge.h" 5 #include "components/sync/device_info/device_info_sync_bridge.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 std::string local_guid = local_info->guid(); 135 std::string local_guid = local_info->guid();
136 std::unique_ptr<WriteBatch> batch = store_->CreateWriteBatch(); 136 std::unique_ptr<WriteBatch> batch = store_->CreateWriteBatch();
137 for (const auto& kv : entity_data_map) { 137 for (const auto& kv : entity_data_map) {
138 const DeviceInfoSpecifics& specifics = 138 const DeviceInfoSpecifics& specifics =
139 kv.second.value().specifics.device_info(); 139 kv.second.value().specifics.device_info();
140 DCHECK_EQ(kv.first, specifics.cache_guid()); 140 DCHECK_EQ(kv.first, specifics.cache_guid());
141 if (specifics.cache_guid() == local_guid) { 141 if (specifics.cache_guid() == local_guid) {
142 // Don't Put local data if it's the same as the remote copy. 142 // Don't Put local data if it's the same as the remote copy.
143 if (local_info->Equals(*SpecificsToModel(specifics))) { 143 if (local_info->Equals(*SpecificsToModel(specifics))) {
144 local_guids_to_put.erase(local_guid); 144 local_guids_to_put.erase(local_guid);
145 } else {
146 // This device is valid right now and this entry is about to be
147 // committed, use this as an opportunity to refresh the timestamp.
148 all_data_[local_guid]->set_last_updated_timestamp(
149 TimeToProtoTime(Time::Now()));
150 } 145 }
151 } else { 146 } else {
152 // Remote data wins conflicts. 147 // Remote data wins conflicts.
153 local_guids_to_put.erase(specifics.cache_guid()); 148 local_guids_to_put.erase(specifics.cache_guid());
154 has_changes = true; 149 has_changes = true;
155 StoreSpecifics(base::MakeUnique<DeviceInfoSpecifics>(specifics), 150 StoreSpecifics(base::MakeUnique<DeviceInfoSpecifics>(specifics),
156 batch.get()); 151 batch.get());
157 } 152 }
158 } 153 }
159 154
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 450 }
456 451
457 void DeviceInfoSyncBridge::ReportStartupErrorToSync(const std::string& msg) { 452 void DeviceInfoSyncBridge::ReportStartupErrorToSync(const std::string& msg) {
458 // TODO(skym): Shouldn't need to log this here, reporting should always log. 453 // TODO(skym): Shouldn't need to log this here, reporting should always log.
459 LOG(WARNING) << msg; 454 LOG(WARNING) << msg;
460 change_processor()->OnMetadataLoaded( 455 change_processor()->OnMetadataLoaded(
461 change_processor()->CreateAndUploadError(FROM_HERE, msg), nullptr); 456 change_processor()->CreateAndUploadError(FROM_HERE, msg), nullptr);
462 } 457 }
463 458
464 } // namespace syncer 459 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | components/sync/device_info/device_info_sync_bridge_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698