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

Unified Diff: components/sync_driver/device_info_service.h

Issue 1907683003: Convert //components/sync_driver from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix, address feedback 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 side-by-side diff with in-line comments
Download patch
Index: components/sync_driver/device_info_service.h
diff --git a/components/sync_driver/device_info_service.h b/components/sync_driver/device_info_service.h
index 59ea378f6f4a1b379f7ad8dc2503ac090c745253..8afca434454df7dd6148ca4ca748c9c88a169971 100644
--- a/components/sync_driver/device_info_service.h
+++ b/components/sync_driver/device_info_service.h
@@ -8,11 +8,11 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "components/sync_driver/device_info_tracker.h"
@@ -52,12 +52,13 @@ class DeviceInfoService : public syncer_v2::ModelTypeService,
~DeviceInfoService() override;
// ModelTypeService implementation.
- scoped_ptr<syncer_v2::MetadataChangeList> CreateMetadataChangeList() override;
+ std::unique_ptr<syncer_v2::MetadataChangeList> CreateMetadataChangeList()
+ override;
syncer::SyncError MergeSyncData(
- scoped_ptr<syncer_v2::MetadataChangeList> metadata_change_list,
+ std::unique_ptr<syncer_v2::MetadataChangeList> metadata_change_list,
syncer_v2::EntityDataMap entity_data_map) override;
syncer::SyncError ApplySyncChanges(
- scoped_ptr<syncer_v2::MetadataChangeList> metadata_change_list,
+ std::unique_ptr<syncer_v2::MetadataChangeList> metadata_change_list,
syncer_v2::EntityChangeList entity_changes) override;
void GetData(ClientTagList client_tags, DataCallback callback) override;
void GetAllData(DataCallback callback) override;
@@ -66,7 +67,7 @@ class DeviceInfoService : public syncer_v2::ModelTypeService,
// DeviceInfoTracker implementation.
bool IsSyncing() const override;
- scoped_ptr<sync_driver::DeviceInfo> GetDeviceInfo(
+ std::unique_ptr<sync_driver::DeviceInfo> GetDeviceInfo(
const std::string& client_id) const override;
ScopedVector<sync_driver::DeviceInfo> GetAllDeviceInfo() const override;
void AddObserver(Observer* observer) override;
@@ -83,18 +84,18 @@ class DeviceInfoService : public syncer_v2::ModelTypeService,
// Extracts cache_guid from ClientTag.
static std::string TagToCacheGuid(const std::string& tag);
- static scoped_ptr<sync_pb::DeviceInfoSpecifics> CopyToSpecifics(
+ static std::unique_ptr<sync_pb::DeviceInfoSpecifics> CopyToSpecifics(
const sync_driver::DeviceInfo& info);
// Allocate new DeviceInfo from SyncData.
- static scoped_ptr<sync_driver::DeviceInfo> CopyToModel(
+ static std::unique_ptr<sync_driver::DeviceInfo> CopyToModel(
const sync_pb::DeviceInfoSpecifics& specifics);
// Conversion as we prepare to hand data to the processor.
- static scoped_ptr<syncer_v2::EntityData> CopyToEntityData(
+ static std::unique_ptr<syncer_v2::EntityData> CopyToEntityData(
const sync_pb::DeviceInfoSpecifics& specifics);
// Store SyncData in the cache and durable storage.
- void StoreSpecifics(scoped_ptr<sync_pb::DeviceInfoSpecifics> specifics,
+ void StoreSpecifics(std::unique_ptr<sync_pb::DeviceInfoSpecifics> specifics,
syncer_v2::ModelTypeStore::WriteBatch* batch);
// Delete SyncData from the cache and durable storage, returns true if there
// was actually anything at the given tag.
@@ -109,13 +110,13 @@ class DeviceInfoService : public syncer_v2::ModelTypeService,
// Methods used as callbacks given to DataTypeStore.
void OnStoreCreated(syncer_v2::ModelTypeStore::Result result,
- scoped_ptr<syncer_v2::ModelTypeStore> store);
+ std::unique_ptr<syncer_v2::ModelTypeStore> store);
void OnReadAllData(
syncer_v2::ModelTypeStore::Result result,
- scoped_ptr<syncer_v2::ModelTypeStore::RecordList> record_list);
+ std::unique_ptr<syncer_v2::ModelTypeStore::RecordList> record_list);
void OnReadAllMetadata(
syncer_v2::ModelTypeStore::Result result,
- scoped_ptr<syncer_v2::ModelTypeStore::RecordList> metadata_records,
+ std::unique_ptr<syncer_v2::ModelTypeStore::RecordList> metadata_records,
const std::string& global_metadata);
void OnCommit(syncer_v2::ModelTypeStore::Result result);
@@ -131,8 +132,8 @@ class DeviceInfoService : public syncer_v2::ModelTypeService,
// Persists the changes in the given aggregators and notifies observers if
// indicated to do as such.
void CommitAndNotify(
- scoped_ptr<syncer_v2::ModelTypeStore::WriteBatch> batch,
- scoped_ptr<syncer_v2::MetadataChangeList> metadata_change_list,
+ std::unique_ptr<syncer_v2::ModelTypeStore::WriteBatch> batch,
+ std::unique_ptr<syncer_v2::MetadataChangeList> metadata_change_list,
bool should_notify);
// |local_device_info_provider_| isn't owned.
@@ -140,7 +141,7 @@ class DeviceInfoService : public syncer_v2::ModelTypeService,
// Cache of all syncable and local data, stored by device cache guid.
using ClientIdToSpecifics =
- std::map<std::string, scoped_ptr<sync_pb::DeviceInfoSpecifics>>;
+ std::map<std::string, std::unique_ptr<sync_pb::DeviceInfoSpecifics>>;
ClientIdToSpecifics all_data_;
// Registered observers, not owned.
@@ -148,10 +149,11 @@ class DeviceInfoService : public syncer_v2::ModelTypeService,
// Used to listen for provider initialization. If the provider is already
// initialized during our constructor then the subscription is never used.
- scoped_ptr<sync_driver::LocalDeviceInfoProvider::Subscription> subscription_;
+ std::unique_ptr<sync_driver::LocalDeviceInfoProvider::Subscription>
+ subscription_;
// In charge of actually persiting changes to disk, or loading previous data.
- scoped_ptr<syncer_v2::ModelTypeStore> store_;
+ std::unique_ptr<syncer_v2::ModelTypeStore> store_;
// If |local_device_info_provider_| has initialized.
bool has_provider_initialized_ = false;
« no previous file with comments | « components/sync_driver/device_info_model_type_controller.h ('k') | components/sync_driver/device_info_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698