OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_driver/device_info_sync_service.h" | 5 #include "components/sync_driver/device_info_sync_service.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
8 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
9 #include "components/sync_driver/local_device_info_provider.h" | 11 #include "components/sync_driver/local_device_info_provider.h" |
10 #include "sync/api/sync_change.h" | 12 #include "sync/api/sync_change.h" |
11 #include "sync/protocol/sync.pb.h" | 13 #include "sync/protocol/sync.pb.h" |
12 #include "sync/util/time.h" | 14 #include "sync/util/time.h" |
13 | 15 |
14 namespace sync_driver { | 16 namespace sync_driver { |
15 | 17 |
16 using syncer::ModelType; | 18 using syncer::ModelType; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const std::string& id = iter->GetSpecifics().device_info().cache_guid(); | 103 const std::string& id = iter->GetSpecifics().device_info().cache_guid(); |
102 | 104 |
103 if (id == local_device_info->guid()) { | 105 if (id == local_device_info->guid()) { |
104 // |initial_sync_data| contains data matching the local device. | 106 // |initial_sync_data| contains data matching the local device. |
105 scoped_ptr<DeviceInfo> synced_local_device_info = | 107 scoped_ptr<DeviceInfo> synced_local_device_info = |
106 make_scoped_ptr(CreateDeviceInfo(*iter)); | 108 make_scoped_ptr(CreateDeviceInfo(*iter)); |
107 | 109 |
108 // Retrieve local device backup timestamp value from the sync data. | 110 // Retrieve local device backup timestamp value from the sync data. |
109 bool has_synced_backup_time = | 111 bool has_synced_backup_time = |
110 iter->GetSpecifics().device_info().has_backup_timestamp(); | 112 iter->GetSpecifics().device_info().has_backup_timestamp(); |
111 int64 synced_backup_time = | 113 int64_t synced_backup_time = |
112 has_synced_backup_time | 114 has_synced_backup_time |
113 ? iter->GetSpecifics().device_info().backup_timestamp() | 115 ? iter->GetSpecifics().device_info().backup_timestamp() |
114 : -1; | 116 : -1; |
115 | 117 |
116 // Overwrite |local_device_backup_time_| with this value if it | 118 // Overwrite |local_device_backup_time_| with this value if it |
117 // hasn't been set yet. | 119 // hasn't been set yet. |
118 if (!has_local_device_backup_time() && has_synced_backup_time) { | 120 if (!has_local_device_backup_time() && has_synced_backup_time) { |
119 set_local_device_backup_time(synced_backup_time); | 121 set_local_device_backup_time(synced_backup_time); |
120 } | 122 } |
121 // TODO(pavely): Remove histogram once device_id mismatch is understood | 123 // TODO(pavely): Remove histogram once device_id mismatch is understood |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 SyncDataMap::iterator iter = all_data_.find(client_id); | 387 SyncDataMap::iterator iter = all_data_.find(client_id); |
386 if (iter != all_data_.end()) { | 388 if (iter != all_data_.end()) { |
387 DVLOG(1) << "Deleting DEVICE_INFO for " | 389 DVLOG(1) << "Deleting DEVICE_INFO for " |
388 << iter->second.GetSpecifics().device_info().client_name() | 390 << iter->second.GetSpecifics().device_info().client_name() |
389 << " with ID " << client_id; | 391 << " with ID " << client_id; |
390 all_data_.erase(iter); | 392 all_data_.erase(iter); |
391 } | 393 } |
392 } | 394 } |
393 | 395 |
394 } // namespace sync_driver | 396 } // namespace sync_driver |
OLD | NEW |