OLD | NEW |
---|---|
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 |
(...skipping 24 matching lines...) Expand all Loading... | |
35 using sync_pb::DeviceInfoSpecifics; | 35 using sync_pb::DeviceInfoSpecifics; |
36 using sync_pb::EntitySpecifics; | 36 using sync_pb::EntitySpecifics; |
37 | 37 |
38 using Record = ModelTypeStore::Record; | 38 using Record = ModelTypeStore::Record; |
39 using RecordList = ModelTypeStore::RecordList; | 39 using RecordList = ModelTypeStore::RecordList; |
40 using Result = ModelTypeStore::Result; | 40 using Result = ModelTypeStore::Result; |
41 using WriteBatch = ModelTypeStore::WriteBatch; | 41 using WriteBatch = ModelTypeStore::WriteBatch; |
42 | 42 |
43 DeviceInfoService::DeviceInfoService( | 43 DeviceInfoService::DeviceInfoService( |
44 sync_driver::LocalDeviceInfoProvider* local_device_info_provider, | 44 sync_driver::LocalDeviceInfoProvider* local_device_info_provider, |
45 const StoreFactoryFunction& callback) | 45 const StoreFactoryFunction& callback, |
46 : local_device_info_provider_(local_device_info_provider), | 46 const SharedProcessorFactory& shared_processor_factory) |
maxbogue
2016/03/22 21:40:11
change_processor_factory
Gang Wu
2016/03/24 15:56:25
Done.
| |
47 : ModelTypeService(shared_processor_factory), | |
48 local_device_info_provider_(local_device_info_provider), | |
47 weak_factory_(this) { | 49 weak_factory_(this) { |
48 DCHECK(local_device_info_provider); | 50 DCHECK(local_device_info_provider); |
49 | 51 |
50 // This is not threadsafe, but presuably the provider initializes on the same | 52 // This is not threadsafe, but presuably the provider initializes on the same |
51 // thread as us so we're okay. | 53 // thread as us so we're okay. |
52 if (local_device_info_provider->GetLocalDeviceInfo()) { | 54 if (local_device_info_provider->GetLocalDeviceInfo()) { |
53 OnProviderInitialized(); | 55 OnProviderInitialized(); |
54 } else { | 56 } else { |
55 subscription_ = | 57 subscription_ = |
56 local_device_info_provider->RegisterOnInitializedCallback(base::Bind( | 58 local_device_info_provider->RegisterOnInitializedCallback(base::Bind( |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 // stored device infos. | 422 // stored device infos. |
421 } | 423 } |
422 | 424 |
423 void DeviceInfoService::TryLoadAllMetadata() { | 425 void DeviceInfoService::TryLoadAllMetadata() { |
424 if (has_data_loaded_ && change_processor()) { | 426 if (has_data_loaded_ && change_processor()) { |
425 store_->ReadAllMetadata(base::Bind(&DeviceInfoService::OnReadAllMetadata, | 427 store_->ReadAllMetadata(base::Bind(&DeviceInfoService::OnReadAllMetadata, |
426 weak_factory_.GetWeakPtr())); | 428 weak_factory_.GetWeakPtr())); |
427 } | 429 } |
428 } | 430 } |
429 | 431 |
432 syncer::ModelType DeviceInfoService::type() const { | |
433 return syncer::DEVICE_INFO; | |
434 } | |
435 | |
430 } // namespace sync_driver_v2 | 436 } // namespace sync_driver_v2 |
OLD | NEW |