diff options
author | dcheng <dcheng@chromium.org> | 2015-12-26 14:45:17 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-26 22:46:08 +0000 |
commit | 51ace48ad51bae53cef3d63a27fbabeb7d0ecafa (patch) | |
tree | 75688ca279a49d844a7f7b08026836c7e352ccfd /components/user_prefs/tracked | |
parent | 4a9d9829bc889e6a2cc02dbc443d3032e1d2c81f (diff) | |
download | chromium_src-51ace48ad51bae53cef3d63a27fbabeb7d0ecafa.zip chromium_src-51ace48ad51bae53cef3d63a27fbabeb7d0ecafa.tar.gz chromium_src-51ace48ad51bae53cef3d63a27fbabeb7d0ecafa.tar.bz2 |
Convert Pass()→std::move() in //components/[n-z]*
BUG=557422
R=avi@chromium.org
TBR=jochen@chromium.org
Review URL: https://codereview.chromium.org/1548203002
Cr-Commit-Position: refs/heads/master@{#366914}
Diffstat (limited to 'components/user_prefs/tracked')
8 files changed, 46 insertions, 40 deletions
diff --git a/components/user_prefs/tracked/interceptable_pref_filter.cc b/components/user_prefs/tracked/interceptable_pref_filter.cc index 180ee7e..cfe081d 100644 --- a/components/user_prefs/tracked/interceptable_pref_filter.cc +++ b/components/user_prefs/tracked/interceptable_pref_filter.cc @@ -4,6 +4,8 @@ #include "components/user_prefs/tracked/interceptable_pref_filter.h" +#include <utility> + #include "base/bind.h" InterceptablePrefFilter::InterceptablePrefFilter() { @@ -16,7 +18,7 @@ void InterceptablePrefFilter::FilterOnLoad( scoped_ptr<base::DictionaryValue> pref_store_contents) { if (filter_on_load_interceptor_.is_null()) { FinalizeFilterOnLoad(post_filter_on_load_callback, - pref_store_contents.Pass(), false); + std::move(pref_store_contents), false); } else { // Note, in practice (in the implementation as it was in May 2014) it would // be okay to pass an unretained |this| pointer below, but in order to avoid @@ -27,7 +29,7 @@ void InterceptablePrefFilter::FilterOnLoad( base::Bind(&InterceptablePrefFilter::FinalizeFilterOnLoad, AsWeakPtr(), post_filter_on_load_callback)); filter_on_load_interceptor_.Run(finalize_filter_on_load, - pref_store_contents.Pass()); + std::move(pref_store_contents)); filter_on_load_interceptor_.Reset(); } } diff --git a/components/user_prefs/tracked/pref_hash_filter.cc b/components/user_prefs/tracked/pref_hash_filter.cc index ac27892..f77aaed 100644 --- a/components/user_prefs/tracked/pref_hash_filter.cc +++ b/components/user_prefs/tracked/pref_hash_filter.cc @@ -5,8 +5,8 @@ #include "components/user_prefs/tracked/pref_hash_filter.h" #include <stdint.h> - #include <algorithm> +#include <utility> #include "base/logging.h" #include "base/macros.h" @@ -54,7 +54,7 @@ PrefHashFilter::PrefHashFilter( TrackedPreferenceValidationDelegate* delegate, size_t reporting_ids_count, bool report_super_mac_validity) - : pref_hash_store_(pref_hash_store.Pass()), + : pref_hash_store_(std::move(pref_hash_store)), on_reset_on_load_(on_reset_on_load), report_super_mac_validity_(report_super_mac_validity) { DCHECK(pref_hash_store_); @@ -86,8 +86,8 @@ PrefHashFilter::PrefHashFilter( } DCHECK(tracked_preference); - bool is_new = tracked_paths_.add(metadata.name, - tracked_preference.Pass()).second; + bool is_new = + tracked_paths_.add(metadata.name, std::move(tracked_preference)).second; DCHECK(is_new); } } @@ -229,5 +229,6 @@ void PrefHashFilter::FinalizeFilterOnLoad( UMA_HISTOGRAM_TIMES("Settings.FilterOnLoadTime", base::TimeTicks::Now() - checkpoint); - post_filter_on_load_callback.Run(pref_store_contents.Pass(), prefs_altered); + post_filter_on_load_callback.Run(std::move(pref_store_contents), + prefs_altered); } diff --git a/components/user_prefs/tracked/pref_hash_filter_unittest.cc b/components/user_prefs/tracked/pref_hash_filter_unittest.cc index dfd3324..9eceefc 100644 --- a/components/user_prefs/tracked/pref_hash_filter_unittest.cc +++ b/components/user_prefs/tracked/pref_hash_filter_unittest.cc @@ -388,7 +388,7 @@ class PrefHashFilterTest new MockPrefHashStore); mock_pref_hash_store_ = temp_mock_pref_hash_store.get(); pref_hash_filter_.reset(new PrefHashFilter( - temp_mock_pref_hash_store.Pass(), configuration, + std::move(temp_mock_pref_hash_store), configuration, base::Bind(&PrefHashFilterTest::RecordReset, base::Unretained(this)), &mock_validation_delegate_, arraysize(kTestTrackedPrefs), true)); } @@ -410,7 +410,7 @@ class PrefHashFilterTest pref_hash_filter_->FilterOnLoad( base::Bind(&PrefHashFilterTest::GetPrefsBack, base::Unretained(this), expect_prefs_modifications), - pref_store_contents_.Pass()); + std::move(pref_store_contents_)); } MockPrefHashStore* mock_pref_hash_store_; @@ -424,7 +424,7 @@ class PrefHashFilterTest void GetPrefsBack(bool expected_schedule_write, scoped_ptr<base::DictionaryValue> prefs, bool schedule_write) { - pref_store_contents_ = prefs.Pass(); + pref_store_contents_ = std::move(prefs); EXPECT_TRUE(pref_store_contents_); EXPECT_EQ(expected_schedule_write, schedule_write); } diff --git a/components/user_prefs/tracked/pref_hash_store_impl.cc b/components/user_prefs/tracked/pref_hash_store_impl.cc index 820c098..125f662 100644 --- a/components/user_prefs/tracked/pref_hash_store_impl.cc +++ b/components/user_prefs/tracked/pref_hash_store_impl.cc @@ -5,6 +5,7 @@ #include "components/user_prefs/tracked/pref_hash_store_impl.h" #include <stddef.h> +#include <utility> #include "base/logging.h" #include "base/macros.h" @@ -74,20 +75,20 @@ PrefHashStoreImpl::~PrefHashStoreImpl() { void PrefHashStoreImpl::set_legacy_hash_store_contents( scoped_ptr<HashStoreContents> legacy_hash_store_contents) { - legacy_hash_store_contents_ = legacy_hash_store_contents.Pass(); + legacy_hash_store_contents_ = std::move(legacy_hash_store_contents); } scoped_ptr<PrefHashStoreTransaction> PrefHashStoreImpl::BeginTransaction( scoped_ptr<HashStoreContents> storage) { return scoped_ptr<PrefHashStoreTransaction>( - new PrefHashStoreTransactionImpl(this, storage.Pass())); + new PrefHashStoreTransactionImpl(this, std::move(storage))); } PrefHashStoreImpl::PrefHashStoreTransactionImpl::PrefHashStoreTransactionImpl( PrefHashStoreImpl* outer, scoped_ptr<HashStoreContents> storage) : outer_(outer), - contents_(storage.Pass()), + contents_(std::move(storage)), super_mac_valid_(false), super_mac_dirty_(false) { if (!outer_->use_super_mac_) diff --git a/components/user_prefs/tracked/segregated_pref_store.cc b/components/user_prefs/tracked/segregated_pref_store.cc index 0d2ef94..177736c 100644 --- a/components/user_prefs/tracked/segregated_pref_store.cc +++ b/components/user_prefs/tracked/segregated_pref_store.cc @@ -4,6 +4,8 @@ #include "components/user_prefs/tracked/segregated_pref_store.h" +#include <utility> + #include "base/logging.h" #include "base/stl_util.h" #include "base/values.h" @@ -85,7 +87,7 @@ bool SegregatedPrefStore::GetValue(const std::string& key, void SegregatedPrefStore::SetValue(const std::string& key, scoped_ptr<base::Value> value, uint32_t flags) { - StoreForKey(key)->SetValue(key, value.Pass(), flags); + StoreForKey(key)->SetValue(key, std::move(value), flags); } void SegregatedPrefStore::RemoveValue(const std::string& key, uint32_t flags) { @@ -105,7 +107,7 @@ void SegregatedPrefStore::ReportValueChanged(const std::string& key, void SegregatedPrefStore::SetValueSilently(const std::string& key, scoped_ptr<base::Value> value, uint32_t flags) { - StoreForKey(key)->SetValueSilently(key, value.Pass(), flags); + StoreForKey(key)->SetValueSilently(key, std::move(value), flags); } bool SegregatedPrefStore::ReadOnly() const { diff --git a/components/user_prefs/tracked/segregated_pref_store_unittest.cc b/components/user_prefs/tracked/segregated_pref_store_unittest.cc index dc458a5..1986758 100644 --- a/components/user_prefs/tracked/segregated_pref_store_unittest.cc +++ b/components/user_prefs/tracked/segregated_pref_store_unittest.cc @@ -6,6 +6,7 @@ #include <set> #include <string> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -80,7 +81,7 @@ class SegregatedPrefStoreTest : public testing::Test { protected: scoped_ptr<PersistentPrefStore::ReadErrorDelegate> GetReadErrorDelegate() { EXPECT_TRUE(read_error_delegate_); - return read_error_delegate_.Pass(); + return std::move(read_error_delegate_); } PrefStoreObserverMock observer_; diff --git a/components/user_prefs/tracked/tracked_preferences_migration.cc b/components/user_prefs/tracked/tracked_preferences_migration.cc index edcbae5..eceb5b2 100644 --- a/components/user_prefs/tracked/tracked_preferences_migration.cc +++ b/components/user_prefs/tracked/tracked_preferences_migration.cc @@ -4,6 +4,8 @@ #include "components/user_prefs/tracked/tracked_preferences_migration.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/macros.h" @@ -227,9 +229,9 @@ TrackedPreferencesMigrator::TrackedPreferencesMigrator( register_on_successful_unprotected_store_write_callback), register_on_successful_protected_store_write_callback_( register_on_successful_protected_store_write_callback), - unprotected_pref_hash_store_(unprotected_pref_hash_store.Pass()), - protected_pref_hash_store_(protected_pref_hash_store.Pass()), - legacy_pref_hash_store_(legacy_pref_hash_store.Pass()) { + unprotected_pref_hash_store_(std::move(unprotected_pref_hash_store)), + protected_pref_hash_store_(std::move(protected_pref_hash_store)), + legacy_pref_hash_store_(std::move(legacy_pref_hash_store)) { // The callbacks bound below will own this TrackedPreferencesMigrator by // reference. unprotected_pref_filter->InterceptNextFilterOnLoad( @@ -252,11 +254,11 @@ void TrackedPreferencesMigrator::InterceptFilterOnLoad( switch (id) { case UNPROTECTED_PREF_FILTER: finalize_unprotected_filter_on_load_ = finalize_filter_on_load; - unprotected_prefs_ = prefs.Pass(); + unprotected_prefs_ = std::move(prefs); break; case PROTECTED_PREF_FILTER: finalize_protected_filter_on_load_ = finalize_filter_on_load; - protected_prefs_ = prefs.Pass(); + protected_prefs_ = std::move(prefs); break; } @@ -309,9 +311,9 @@ void TrackedPreferencesMigrator::MigrateIfReady() { } // Hand the processed prefs back to their respective filters. - finalize_unprotected_filter_on_load_.Run(unprotected_prefs_.Pass(), + finalize_unprotected_filter_on_load_.Run(std::move(unprotected_prefs_), unprotected_prefs_altered); - finalize_protected_filter_on_load_.Run(protected_prefs_.Pass(), + finalize_protected_filter_on_load_.Run(std::move(protected_prefs_), protected_prefs_altered); if (unprotected_prefs_need_cleanup) { @@ -356,15 +358,12 @@ void SetupTrackedPreferencesMigration( InterceptablePrefFilter* protected_pref_filter) { scoped_refptr<TrackedPreferencesMigrator> prefs_migrator( new TrackedPreferencesMigrator( - unprotected_pref_names, - protected_pref_names, - unprotected_store_cleaner, - protected_store_cleaner, + unprotected_pref_names, protected_pref_names, + unprotected_store_cleaner, protected_store_cleaner, register_on_successful_unprotected_store_write_callback, register_on_successful_protected_store_write_callback, - unprotected_pref_hash_store.Pass(), - protected_pref_hash_store.Pass(), - legacy_pref_hash_store.Pass(), - unprotected_pref_filter, + std::move(unprotected_pref_hash_store), + std::move(protected_pref_hash_store), + std::move(legacy_pref_hash_store), unprotected_pref_filter, protected_pref_filter)); } diff --git a/components/user_prefs/tracked/tracked_preferences_migration_unittest.cc b/components/user_prefs/tracked/tracked_preferences_migration_unittest.cc index fc134aa..4c837f9 100644 --- a/components/user_prefs/tracked/tracked_preferences_migration_unittest.cc +++ b/components/user_prefs/tracked/tracked_preferences_migration_unittest.cc @@ -6,6 +6,7 @@ #include <set> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -58,7 +59,8 @@ class SimpleInterceptablePrefFilter : public InterceptablePrefFilter { const PostFilterOnLoadCallback& post_filter_on_load_callback, scoped_ptr<base::DictionaryValue> pref_store_contents, bool prefs_altered) override { - post_filter_on_load_callback.Run(pref_store_contents.Pass(), prefs_altered); + post_filter_on_load_callback.Run(std::move(pref_store_contents), + prefs_altered); } }; @@ -276,16 +278,14 @@ class TrackedPreferencesMigrationTest : public testing::Test { case MOCK_UNPROTECTED_PREF_STORE: mock_unprotected_pref_filter_.FilterOnLoad( base::Bind(&TrackedPreferencesMigrationTest::GetPrefsBack, - base::Unretained(this), - MOCK_UNPROTECTED_PREF_STORE), - unprotected_prefs_.Pass()); + base::Unretained(this), MOCK_UNPROTECTED_PREF_STORE), + std::move(unprotected_prefs_)); break; case MOCK_PROTECTED_PREF_STORE: mock_protected_pref_filter_.FilterOnLoad( base::Bind(&TrackedPreferencesMigrationTest::GetPrefsBack, - base::Unretained(this), - MOCK_PROTECTED_PREF_STORE), - protected_prefs_.Pass()); + base::Unretained(this), MOCK_PROTECTED_PREF_STORE), + std::move(protected_prefs_)); break; } } @@ -356,13 +356,13 @@ class TrackedPreferencesMigrationTest : public testing::Test { switch (store_id) { case MOCK_UNPROTECTED_PREF_STORE: EXPECT_FALSE(unprotected_prefs_); - unprotected_prefs_ = prefs.Pass(); + unprotected_prefs_ = std::move(prefs); migration_modified_unprotected_store_ = prefs_altered; unprotected_store_migration_complete_ = true; break; case MOCK_PROTECTED_PREF_STORE: EXPECT_FALSE(protected_prefs_); - protected_prefs_ = prefs.Pass(); + protected_prefs_ = std::move(prefs); migration_modified_protected_store_ = prefs_altered; protected_store_migration_complete_ = true; break; |