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

Side by Side Diff: components/sync_driver/device_info_service.cc

Issue 1888923003: [Sync] DeviceInfoService should format ClientTag in backwards compatible way (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Sky's and Max's comments. Created 4 years, 8 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 unified diff | Download patch
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_driver/device_info_service.h" 5 #include "components/sync_driver/device_info_service.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/strings/string_util.h"
13 #include "sync/api/entity_change.h" 14 #include "sync/api/entity_change.h"
14 #include "sync/api/metadata_batch.h" 15 #include "sync/api/metadata_batch.h"
15 #include "sync/api/sync_error.h" 16 #include "sync/api/sync_error.h"
16 #include "sync/internal_api/public/data_batch_impl.h" 17 #include "sync/internal_api/public/data_batch_impl.h"
17 #include "sync/internal_api/public/simple_metadata_change_list.h" 18 #include "sync/internal_api/public/simple_metadata_change_list.h"
18 #include "sync/protocol/data_type_state.pb.h" 19 #include "sync/protocol/data_type_state.pb.h"
19 #include "sync/protocol/sync.pb.h" 20 #include "sync/protocol/sync.pb.h"
20 21
21 namespace sync_driver_v2 { 22 namespace sync_driver_v2 {
22 23
(...skipping 10 matching lines...) Expand all
33 using sync_driver::DeviceInfo; 34 using sync_driver::DeviceInfo;
34 using sync_pb::DataTypeState; 35 using sync_pb::DataTypeState;
35 using sync_pb::DeviceInfoSpecifics; 36 using sync_pb::DeviceInfoSpecifics;
36 using sync_pb::EntitySpecifics; 37 using sync_pb::EntitySpecifics;
37 38
38 using Record = ModelTypeStore::Record; 39 using Record = ModelTypeStore::Record;
39 using RecordList = ModelTypeStore::RecordList; 40 using RecordList = ModelTypeStore::RecordList;
40 using Result = ModelTypeStore::Result; 41 using Result = ModelTypeStore::Result;
41 using WriteBatch = ModelTypeStore::WriteBatch; 42 using WriteBatch = ModelTypeStore::WriteBatch;
42 43
44 namespace {
45
46 const char kClientTagPrefix[] = "DeviceInfo_";
47
48 } // namespace
49
43 DeviceInfoService::DeviceInfoService( 50 DeviceInfoService::DeviceInfoService(
44 sync_driver::LocalDeviceInfoProvider* local_device_info_provider, 51 sync_driver::LocalDeviceInfoProvider* local_device_info_provider,
45 const StoreFactoryFunction& callback, 52 const StoreFactoryFunction& callback,
46 const ChangeProcessorFactory& change_processor_factory) 53 const ChangeProcessorFactory& change_processor_factory)
47 : ModelTypeService(change_processor_factory, syncer::DEVICE_INFO), 54 : ModelTypeService(change_processor_factory, syncer::DEVICE_INFO),
48 local_device_info_provider_(local_device_info_provider), 55 local_device_info_provider_(local_device_info_provider),
49 weak_factory_(this) { 56 weak_factory_(this) {
50 DCHECK(local_device_info_provider); 57 DCHECK(local_device_info_provider);
51 58
52 // This is not threadsafe, but presuably the provider initializes on the same 59 // This is not threadsafe, but presuably the provider initializes on the same
(...skipping 25 matching lines...) Expand all
78 FROM_HERE, SyncError::DATATYPE_ERROR, 85 FROM_HERE, SyncError::DATATYPE_ERROR,
79 "Cannot call MergeSyncData without provider, data, and processor.", 86 "Cannot call MergeSyncData without provider, data, and processor.",
80 syncer::DEVICE_INFO); 87 syncer::DEVICE_INFO);
81 } 88 }
82 89
83 // Local data should typically be near empty, with the only possible value 90 // Local data should typically be near empty, with the only possible value
84 // corresponding to this device. This is because on signout all device info 91 // corresponding to this device. This is because on signout all device info
85 // data is blown away. However, this simplification is being ignored here and 92 // data is blown away. However, this simplification is being ignored here and
86 // a full difference is going to be calculated to explore what other service 93 // a full difference is going to be calculated to explore what other service
87 // implementations may look like. 94 // implementations may look like.
88 std::set<std::string> local_tags_to_put; 95 std::set<std::string> local_guids_to_put;
89 for (const auto& kv : all_data_) { 96 for (const auto& kv : all_data_) {
90 local_tags_to_put.insert(kv.first); 97 local_guids_to_put.insert(kv.first);
91 } 98 }
92 99
93 bool has_changes = false; 100 bool has_changes = false;
94 const DeviceInfo* local_info = 101 const DeviceInfo* local_info =
95 local_device_info_provider_->GetLocalDeviceInfo(); 102 local_device_info_provider_->GetLocalDeviceInfo();
96 std::string local_tag = local_info->guid(); 103 std::string local_guid = local_info->guid();
97 scoped_ptr<WriteBatch> batch = store_->CreateWriteBatch(); 104 scoped_ptr<WriteBatch> batch = store_->CreateWriteBatch();
98 for (const auto& kv : entity_data_map) { 105 for (const auto& kv : entity_data_map) {
99 const std::string tag = GetClientTag(kv.second.value());
100 const DeviceInfoSpecifics& specifics = 106 const DeviceInfoSpecifics& specifics =
101 kv.second.value().specifics.device_info(); 107 kv.second.value().specifics.device_info();
102 if (tag == local_tag) { 108 DCHECK_EQ(kv.first, SpecificsToTag(specifics));
109 if (specifics.cache_guid() == local_guid) {
103 // Don't Put local data if it's the same as the remote copy. 110 // Don't Put local data if it's the same as the remote copy.
104 if (local_info->Equals(*CopyToModel(specifics))) { 111 if (local_info->Equals(*CopyToModel(specifics))) {
105 local_tags_to_put.erase(tag); 112 local_guids_to_put.erase(local_guid);
106 } 113 }
107 } else { 114 } else {
108 // Remote data wins conflicts. 115 // Remote data wins conflicts.
109 local_tags_to_put.erase(tag); 116 local_guids_to_put.erase(specifics.cache_guid());
110 has_changes = true; 117 has_changes = true;
111 StoreSpecifics(make_scoped_ptr(new DeviceInfoSpecifics(specifics)), 118 StoreSpecifics(make_scoped_ptr(new DeviceInfoSpecifics(specifics)),
112 batch.get()); 119 batch.get());
113 } 120 }
114 } 121 }
115 122
116 for (const std::string& tag : local_tags_to_put) { 123 for (const std::string& guid : local_guids_to_put) {
117 change_processor()->Put(tag, CopyToEntityData(*all_data_[tag]), 124 change_processor()->Put(SpecificsToTag(*all_data_[guid]),
125 CopyToEntityData(*all_data_[guid]),
118 metadata_change_list.get()); 126 metadata_change_list.get());
119 } 127 }
120 128
121 CommitAndNotify(std::move(batch), std::move(metadata_change_list), 129 CommitAndNotify(std::move(batch), std::move(metadata_change_list),
122 has_changes); 130 has_changes);
123 return syncer::SyncError(); 131 return syncer::SyncError();
124 } 132 }
125 133
126 SyncError DeviceInfoService::ApplySyncChanges( 134 SyncError DeviceInfoService::ApplySyncChanges(
127 scoped_ptr<MetadataChangeList> metadata_change_list, 135 scoped_ptr<MetadataChangeList> metadata_change_list,
128 EntityChangeList entity_changes) { 136 EntityChangeList entity_changes) {
129 if (!has_provider_initialized_ || !has_metadata_loaded_) { 137 if (!has_provider_initialized_ || !has_metadata_loaded_) {
130 return SyncError( 138 return SyncError(
131 FROM_HERE, SyncError::DATATYPE_ERROR, 139 FROM_HERE, SyncError::DATATYPE_ERROR,
132 "Cannot call ApplySyncChanges before provider and data have loaded.", 140 "Cannot call ApplySyncChanges before provider and data have loaded.",
133 syncer::DEVICE_INFO); 141 syncer::DEVICE_INFO);
134 } 142 }
135 143
136 scoped_ptr<WriteBatch> batch = store_->CreateWriteBatch(); 144 scoped_ptr<WriteBatch> batch = store_->CreateWriteBatch();
137 bool has_changes = false; 145 bool has_changes = false;
138 for (EntityChange& change : entity_changes) { 146 for (EntityChange& change : entity_changes) {
139 const std::string tag = change.client_tag(); 147 const std::string guid = TagToCacheGuid(change.client_tag());
140 // Each device is the authoritative source for itself, ignore any remote 148 // Each device is the authoritative source for itself, ignore any remote
141 // changes that have our local cache guid. 149 // changes that have our local cache guid.
142 if (tag == local_device_info_provider_->GetLocalDeviceInfo()->guid()) { 150 if (guid == local_device_info_provider_->GetLocalDeviceInfo()->guid()) {
143 continue; 151 continue;
144 } 152 }
145 153
146 if (change.type() == EntityChange::ACTION_DELETE) { 154 if (change.type() == EntityChange::ACTION_DELETE) {
147 has_changes |= DeleteSpecifics(tag, batch.get()); 155 has_changes |= DeleteSpecifics(guid, batch.get());
148 } else { 156 } else {
149 const DeviceInfoSpecifics& specifics = 157 const DeviceInfoSpecifics& specifics =
150 change.data().specifics.device_info(); 158 change.data().specifics.device_info();
151 DCHECK(tag == specifics.cache_guid()); 159 DCHECK(guid == specifics.cache_guid());
152 StoreSpecifics(make_scoped_ptr(new DeviceInfoSpecifics(specifics)), 160 StoreSpecifics(make_scoped_ptr(new DeviceInfoSpecifics(specifics)),
153 batch.get()); 161 batch.get());
154 has_changes = true; 162 has_changes = true;
155 } 163 }
156 } 164 }
157 165
158 CommitAndNotify(std::move(batch), std::move(metadata_change_list), 166 CommitAndNotify(std::move(batch), std::move(metadata_change_list),
159 has_changes); 167 has_changes);
160 return SyncError(); 168 return SyncError();
161 } 169 }
162 170
163 void DeviceInfoService::GetData(ClientTagList client_tags, 171 void DeviceInfoService::GetData(ClientTagList client_tags,
164 DataCallback callback) { 172 DataCallback callback) {
165 if (!has_metadata_loaded_) { 173 if (!has_metadata_loaded_) {
166 callback.Run( 174 callback.Run(
167 SyncError(FROM_HERE, SyncError::DATATYPE_ERROR, 175 SyncError(FROM_HERE, SyncError::DATATYPE_ERROR,
168 "Should not call GetData before metadata has loaded.", 176 "Should not call GetData before metadata has loaded.",
169 syncer::DEVICE_INFO), 177 syncer::DEVICE_INFO),
170 scoped_ptr<DataBatchImpl>()); 178 scoped_ptr<DataBatchImpl>());
171 return; 179 return;
172 } 180 }
173 181
174 scoped_ptr<DataBatchImpl> batch(new DataBatchImpl()); 182 scoped_ptr<DataBatchImpl> batch(new DataBatchImpl());
175 for (const auto& tag : client_tags) { 183 for (const auto& tag : client_tags) {
176 const auto iter = all_data_.find(tag); 184 const auto& iter = all_data_.find(TagToCacheGuid(tag));
177 if (iter != all_data_.end()) { 185 if (iter != all_data_.end()) {
186 DCHECK_EQ(tag, SpecificsToTag(*iter->second));
178 batch->Put(tag, CopyToEntityData(*iter->second)); 187 batch->Put(tag, CopyToEntityData(*iter->second));
179 } 188 }
180 } 189 }
181 callback.Run(syncer::SyncError(), std::move(batch)); 190 callback.Run(syncer::SyncError(), std::move(batch));
182 } 191 }
183 192
184 void DeviceInfoService::GetAllData(DataCallback callback) { 193 void DeviceInfoService::GetAllData(DataCallback callback) {
185 if (!has_metadata_loaded_) { 194 if (!has_metadata_loaded_) {
186 callback.Run( 195 callback.Run(
187 SyncError(FROM_HERE, SyncError::DATATYPE_ERROR, 196 SyncError(FROM_HERE, SyncError::DATATYPE_ERROR,
188 "Should not call GetAllData before metadata has loaded.", 197 "Should not call GetAllData before metadata has loaded.",
189 syncer::DEVICE_INFO), 198 syncer::DEVICE_INFO),
190 scoped_ptr<DataBatchImpl>()); 199 scoped_ptr<DataBatchImpl>());
191 return; 200 return;
192 } 201 }
193 202
194 scoped_ptr<DataBatchImpl> batch(new DataBatchImpl()); 203 scoped_ptr<DataBatchImpl> batch(new DataBatchImpl());
195 for (const auto& kv : all_data_) { 204 for (const auto& kv : all_data_) {
196 batch->Put(kv.first, CopyToEntityData(*kv.second)); 205 batch->Put(SpecificsToTag(*kv.second), CopyToEntityData(*kv.second));
197 } 206 }
198 callback.Run(syncer::SyncError(), std::move(batch)); 207 callback.Run(syncer::SyncError(), std::move(batch));
199 } 208 }
200 209
201 std::string DeviceInfoService::GetClientTag(const EntityData& entity_data) { 210 std::string DeviceInfoService::GetClientTag(const EntityData& entity_data) {
202 DCHECK(entity_data.specifics.has_device_info()); 211 DCHECK(entity_data.specifics.has_device_info());
203 return entity_data.specifics.device_info().cache_guid(); 212 return SpecificsToTag(entity_data.specifics.device_info());
204 } 213 }
205 214
206 void DeviceInfoService::OnChangeProcessorSet() { 215 void DeviceInfoService::OnChangeProcessorSet() {
207 // We've recieved a new processor that needs metadata. If we're still in the 216 // We've recieved a new processor that needs metadata. If we're still in the
208 // process of loading data and/or metadata, then |has_metadata_loaded_| is 217 // process of loading data and/or metadata, then |has_metadata_loaded_| is
209 // false and we'll wait for those async reads to happen. If we've already 218 // false and we'll wait for those async reads to happen. If we've already
210 // loaded metadata and then subsequently we get a new processor, we must not 219 // loaded metadata and then subsequently we get a new processor, we must not
211 // have created the processor ourselves because we had no metadata. So there 220 // have created the processor ourselves because we had no metadata. So there
212 // must not be any metadata on disk. 221 // must not be any metadata on disk.
213 if (has_metadata_loaded_) { 222 if (has_metadata_loaded_) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 260
252 int DeviceInfoService::CountActiveDevices() const { 261 int DeviceInfoService::CountActiveDevices() const {
253 // TODO(skym): crbug.com/590006: Implementation. 262 // TODO(skym): crbug.com/590006: Implementation.
254 return 0; 263 return 0;
255 } 264 }
256 265
257 void DeviceInfoService::NotifyObservers() { 266 void DeviceInfoService::NotifyObservers() {
258 FOR_EACH_OBSERVER(Observer, observers_, OnDeviceInfoChange()); 267 FOR_EACH_OBSERVER(Observer, observers_, OnDeviceInfoChange());
259 } 268 }
260 269
270 std::string DeviceInfoService::SpecificsToTag(
271 const sync_pb::DeviceInfoSpecifics& specifics) {
272 return kClientTagPrefix + specifics.cache_guid();
273 }
274
275 std::string DeviceInfoService::TagToCacheGuid(const std::string& tag) {
276 DCHECK(base::StartsWith(tag, kClientTagPrefix, base::CompareCase::SENSITIVE));
277 return tag.substr(strlen(kClientTagPrefix));
278 }
279
261 // TODO(skym): crbug.com/543406: It might not make sense for this to be a 280 // TODO(skym): crbug.com/543406: It might not make sense for this to be a
262 // scoped_ptr. 281 // scoped_ptr.
263 // Static. 282 // Static.
264 scoped_ptr<DeviceInfoSpecifics> DeviceInfoService::CopyToSpecifics( 283 scoped_ptr<DeviceInfoSpecifics> DeviceInfoService::CopyToSpecifics(
265 const DeviceInfo& info) { 284 const DeviceInfo& info) {
266 scoped_ptr<DeviceInfoSpecifics> specifics = 285 scoped_ptr<DeviceInfoSpecifics> specifics =
267 make_scoped_ptr(new DeviceInfoSpecifics); 286 make_scoped_ptr(new DeviceInfoSpecifics);
268 specifics->set_cache_guid(info.guid()); 287 specifics->set_cache_guid(info.guid());
269 specifics->set_client_name(info.client_name()); 288 specifics->set_client_name(info.client_name());
270 specifics->set_chrome_version(info.chrome_version()); 289 specifics->set_chrome_version(info.chrome_version());
(...skipping 10 matching lines...) Expand all
281 specifics.cache_guid(), specifics.client_name(), 300 specifics.cache_guid(), specifics.client_name(),
282 specifics.chrome_version(), specifics.sync_user_agent(), 301 specifics.chrome_version(), specifics.sync_user_agent(),
283 specifics.device_type(), specifics.signin_scoped_device_id())); 302 specifics.device_type(), specifics.signin_scoped_device_id()));
284 } 303 }
285 304
286 // Static. 305 // Static.
287 scoped_ptr<EntityData> DeviceInfoService::CopyToEntityData( 306 scoped_ptr<EntityData> DeviceInfoService::CopyToEntityData(
288 const DeviceInfoSpecifics& specifics) { 307 const DeviceInfoSpecifics& specifics) {
289 scoped_ptr<EntityData> entity_data(new EntityData()); 308 scoped_ptr<EntityData> entity_data(new EntityData());
290 *entity_data->specifics.mutable_device_info() = specifics; 309 *entity_data->specifics.mutable_device_info() = specifics;
310 entity_data->non_unique_name = specifics.client_name();
291 return entity_data; 311 return entity_data;
292 } 312 }
293 313
294 void DeviceInfoService::StoreSpecifics( 314 void DeviceInfoService::StoreSpecifics(
295 scoped_ptr<DeviceInfoSpecifics> specifics, 315 scoped_ptr<DeviceInfoSpecifics> specifics,
296 WriteBatch* batch) { 316 WriteBatch* batch) {
297 const std::string tag = specifics->cache_guid(); 317 const std::string guid = specifics->cache_guid();
298 DVLOG(1) << "Storing DEVICE_INFO for " << specifics->client_name() 318 DVLOG(1) << "Storing DEVICE_INFO for " << specifics->client_name()
299 << " with ID " << tag; 319 << " with ID " << guid;
300 store_->WriteData(batch, tag, specifics->SerializeAsString()); 320 store_->WriteData(batch, guid, specifics->SerializeAsString());
301 all_data_[tag] = std::move(specifics); 321 all_data_[guid] = std::move(specifics);
302 } 322 }
303 323
304 bool DeviceInfoService::DeleteSpecifics(const std::string& tag, 324 bool DeviceInfoService::DeleteSpecifics(const std::string& guid,
305 WriteBatch* batch) { 325 WriteBatch* batch) {
306 ClientIdToSpecifics::const_iterator iter = all_data_.find(tag); 326 ClientIdToSpecifics::const_iterator iter = all_data_.find(guid);
307 if (iter != all_data_.end()) { 327 if (iter != all_data_.end()) {
308 DVLOG(1) << "Deleting DEVICE_INFO for " << iter->second->client_name() 328 DVLOG(1) << "Deleting DEVICE_INFO for " << iter->second->client_name()
309 << " with ID " << tag; 329 << " with ID " << guid;
310 store_->DeleteData(batch, tag); 330 store_->DeleteData(batch, guid);
311 all_data_.erase(iter); 331 all_data_.erase(iter);
312 return true; 332 return true;
313 } else { 333 } else {
314 return false; 334 return false;
315 } 335 }
316 } 336 }
317 337
318 void DeviceInfoService::OnProviderInitialized() { 338 void DeviceInfoService::OnProviderInitialized() {
319 has_provider_initialized_ = true; 339 has_provider_initialized_ = true;
320 TryReconcileLocalAndStored(); 340 TryReconcileLocalAndStored();
(...skipping 18 matching lines...) Expand all
339 LOG(WARNING) << "Initial load of data failed."; 359 LOG(WARNING) << "Initial load of data failed.";
340 // TODO(skym, crbug.com/582460): Handle unrecoverable initialization 360 // TODO(skym, crbug.com/582460): Handle unrecoverable initialization
341 // failure. 361 // failure.
342 return; 362 return;
343 } 363 }
344 364
345 for (const Record& r : *record_list.get()) { 365 for (const Record& r : *record_list.get()) {
346 scoped_ptr<DeviceInfoSpecifics> specifics( 366 scoped_ptr<DeviceInfoSpecifics> specifics(
347 make_scoped_ptr(new DeviceInfoSpecifics())); 367 make_scoped_ptr(new DeviceInfoSpecifics()));
348 if (specifics->ParseFromString(r.value)) { 368 if (specifics->ParseFromString(r.value)) {
349 all_data_[r.id] = std::move(specifics); 369 all_data_[specifics->cache_guid()] = std::move(specifics);
350 } else { 370 } else {
351 LOG(WARNING) << "Failed to deserialize specifics."; 371 LOG(WARNING) << "Failed to deserialize specifics.";
352 // TODO(skym, crbug.com/582460): Handle unrecoverable initialization 372 // TODO(skym, crbug.com/582460): Handle unrecoverable initialization
353 // failure. 373 // failure.
354 } 374 }
355 } 375 }
356 store_->ReadAllMetadata(base::Bind(&DeviceInfoService::OnReadAllMetadata, 376 store_->ReadAllMetadata(base::Bind(&DeviceInfoService::OnReadAllMetadata,
357 weak_factory_.GetWeakPtr())); 377 weak_factory_.GetWeakPtr()));
358 } 378 }
359 379
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 PutAndStore(*current_info); 462 PutAndStore(*current_info);
443 } 463 }
444 } 464 }
445 } 465 }
446 466
447 void DeviceInfoService::PutAndStore(const DeviceInfo& device_info) { 467 void DeviceInfoService::PutAndStore(const DeviceInfo& device_info) {
448 scoped_ptr<DeviceInfoSpecifics> specifics = CopyToSpecifics(device_info); 468 scoped_ptr<DeviceInfoSpecifics> specifics = CopyToSpecifics(device_info);
449 469
450 scoped_ptr<MetadataChangeList> metadata_change_list = 470 scoped_ptr<MetadataChangeList> metadata_change_list =
451 CreateMetadataChangeList(); 471 CreateMetadataChangeList();
452 change_processor()->Put(device_info.guid(), CopyToEntityData(*specifics), 472 change_processor()->Put(SpecificsToTag(*specifics),
473 CopyToEntityData(*specifics),
453 metadata_change_list.get()); 474 metadata_change_list.get());
454 475
455 scoped_ptr<WriteBatch> batch = store_->CreateWriteBatch(); 476 scoped_ptr<WriteBatch> batch = store_->CreateWriteBatch();
456 StoreSpecifics(std::move(specifics), batch.get()); 477 StoreSpecifics(std::move(specifics), batch.get());
457 478
458 CommitAndNotify(std::move(batch), std::move(metadata_change_list), true); 479 CommitAndNotify(std::move(batch), std::move(metadata_change_list), true);
459 } 480 }
460 481
461 void DeviceInfoService::CommitAndNotify( 482 void DeviceInfoService::CommitAndNotify(
462 scoped_ptr<WriteBatch> batch, 483 scoped_ptr<WriteBatch> batch,
463 scoped_ptr<MetadataChangeList> metadata_change_list, 484 scoped_ptr<MetadataChangeList> metadata_change_list,
464 bool should_notify) { 485 bool should_notify) {
465 static_cast<SimpleMetadataChangeList*>(metadata_change_list.get()) 486 static_cast<SimpleMetadataChangeList*>(metadata_change_list.get())
466 ->TransferChanges(store_.get(), batch.get()); 487 ->TransferChanges(store_.get(), batch.get());
467 store_->CommitWriteBatch( 488 store_->CommitWriteBatch(
468 std::move(batch), 489 std::move(batch),
469 base::Bind(&DeviceInfoService::OnCommit, weak_factory_.GetWeakPtr())); 490 base::Bind(&DeviceInfoService::OnCommit, weak_factory_.GetWeakPtr()));
470 if (should_notify) { 491 if (should_notify) {
471 NotifyObservers(); 492 NotifyObservers();
472 } 493 }
473 } 494 }
474 495
475 } // namespace sync_driver_v2 496 } // namespace sync_driver_v2
OLDNEW
« 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