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

Unified Diff: chrome/browser/extensions/api/storage/syncable_settings_storage.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header 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: chrome/browser/extensions/api/storage/syncable_settings_storage.cc
diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
index 8d43d8e3361c20bd4af54d9acee83f4d948be342..543d2b443407195d772b22f3e98ea8753501cb6c 100644
--- a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
+++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
@@ -153,8 +153,8 @@ void SyncableSettingsStorage::SyncResultIfEnabled(
// Sync-related methods.
syncer::SyncError SyncableSettingsStorage::StartSyncing(
- scoped_ptr<base::DictionaryValue> sync_state,
- scoped_ptr<SettingsSyncProcessor> sync_processor) {
+ std::unique_ptr<base::DictionaryValue> sync_state,
+ std::unique_ptr<SettingsSyncProcessor> sync_processor) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(sync_state);
DCHECK(!sync_processor_.get());
@@ -171,7 +171,7 @@ syncer::SyncError SyncableSettingsStorage::StartSyncing(
sync_processor_->type());
}
- scoped_ptr<base::DictionaryValue> current_settings =
+ std::unique_ptr<base::DictionaryValue> current_settings =
maybe_settings->PassSettings();
return sync_state->empty()
? SendLocalSettingsToSync(std::move(current_settings))
@@ -180,7 +180,7 @@ syncer::SyncError SyncableSettingsStorage::StartSyncing(
}
syncer::SyncError SyncableSettingsStorage::SendLocalSettingsToSync(
- scoped_ptr<base::DictionaryValue> local_state) {
+ std::unique_ptr<base::DictionaryValue> local_state) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
if (local_state->empty())
@@ -192,7 +192,7 @@ syncer::SyncError SyncableSettingsStorage::SendLocalSettingsToSync(
// It's not possible to iterate over a DictionaryValue and modify it at the
// same time, so hack around that restriction.
std::string key = base::DictionaryValue::Iterator(*local_state).key();
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
local_state->RemoveWithoutPathExpansion(key, &value);
changes.push_back(ValueStoreChange(key, nullptr, value.release()));
}
@@ -204,16 +204,16 @@ syncer::SyncError SyncableSettingsStorage::SendLocalSettingsToSync(
}
syncer::SyncError SyncableSettingsStorage::OverwriteLocalSettingsWithSync(
- scoped_ptr<base::DictionaryValue> sync_state,
- scoped_ptr<base::DictionaryValue> local_state) {
+ std::unique_ptr<base::DictionaryValue> sync_state,
+ std::unique_ptr<base::DictionaryValue> local_state) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
// This is implemented by building up a list of sync changes then sending
// those to ProcessSyncChanges. This generates events like onStorageChanged.
- scoped_ptr<SettingSyncDataList> changes(new SettingSyncDataList());
+ std::unique_ptr<SettingSyncDataList> changes(new SettingSyncDataList());
for (base::DictionaryValue::Iterator it(*local_state); !it.IsAtEnd();
it.Advance()) {
- scoped_ptr<base::Value> sync_value;
+ std::unique_ptr<base::Value> sync_value;
if (sync_state->RemoveWithoutPathExpansion(it.key(), &sync_value)) {
if (sync_value->Equals(&it.value())) {
// Sync and local values are the same, no changes to send.
@@ -227,7 +227,7 @@ syncer::SyncError SyncableSettingsStorage::OverwriteLocalSettingsWithSync(
// Not synced, delete local setting.
changes->push_back(new SettingSyncData(
syncer::SyncChange::ACTION_DELETE, extension_id_, it.key(),
- scoped_ptr<base::Value>(new base::DictionaryValue())));
+ std::unique_ptr<base::Value>(new base::DictionaryValue())));
}
}
@@ -236,7 +236,7 @@ syncer::SyncError SyncableSettingsStorage::OverwriteLocalSettingsWithSync(
// It's not possible to iterate over a DictionaryValue and modify it at the
// same time, so hack around that restriction.
std::string key = base::DictionaryValue::Iterator(*sync_state).key();
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
CHECK(sync_state->RemoveWithoutPathExpansion(key, &value));
changes->push_back(new SettingSyncData(
syncer::SyncChange::ACTION_ADD, extension_id_, key, std::move(value)));
@@ -253,7 +253,7 @@ void SyncableSettingsStorage::StopSyncing() {
}
syncer::SyncError SyncableSettingsStorage::ProcessSyncChanges(
- scoped_ptr<SettingSyncDataList> sync_changes) {
+ std::unique_ptr<SettingSyncDataList> sync_changes) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(!sync_changes->empty()) << "No sync changes for " << extension_id_;
@@ -272,9 +272,9 @@ syncer::SyncError SyncableSettingsStorage::ProcessSyncChanges(
it != sync_changes->end(); ++it) {
DCHECK_EQ(extension_id_, (*it)->extension_id());
const std::string& key = (*it)->key();
- scoped_ptr<base::Value> change_value = (*it)->PassValue();
+ std::unique_ptr<base::Value> change_value = (*it)->PassValue();
- scoped_ptr<base::Value> current_value;
+ std::unique_ptr<base::Value> current_value;
{
ReadResult maybe_settings = Get(key);
if (!maybe_settings->status().ok()) {

Powered by Google App Engine
This is Rietveld 408576698