Convert Pass()→std::move() in //components/[n-z]*
BUG=557422
[email protected]
[email protected]
Review URL: https://codereview.chromium.org/1548203002
Cr-Commit-Position: refs/heads/master@{#366914}
diff --git a/components/rappor/log_uploader.cc b/components/rappor/log_uploader.cc
index 3e594a01..247ddc1 100644
--- a/components/rappor/log_uploader.cc
+++ b/components/rappor/log_uploader.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <utility>
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
@@ -142,7 +143,7 @@
// Note however that |source| is aliased to the fetcher, so we should be
// careful not to delete it too early.
DCHECK_EQ(current_fetch_.get(), source);
- scoped_ptr<net::URLFetcher> fetch(current_fetch_.Pass());
+ scoped_ptr<net::URLFetcher> fetch(std::move(current_fetch_));
const net::URLRequestStatus& request_status = source->GetStatus();
diff --git a/components/rappor/rappor_service.cc b/components/rappor/rappor_service.cc
index 0d2c4233..02853afb 100644
--- a/components/rappor/rappor_service.cc
+++ b/components/rappor/rappor_service.cc
@@ -4,6 +4,8 @@
#include "components/rappor/rappor_service.h"
+#include <utility>
+
#include "base/metrics/field_trial.h"
#include "base/metrics/metrics_hashes.h"
#include "base/stl_util.h"
@@ -67,7 +69,7 @@
void RapporService::AddDailyObserver(
scoped_ptr<metrics::DailyEvent::Observer> observer) {
- daily_event_.AddObserver(observer.Pass());
+ daily_event_.AddObserver(std::move(observer));
}
void RapporService::Initialize(net::URLRequestContextGetter* request_context) {
@@ -260,7 +262,7 @@
if (!RecordingAllowed(sample->parameters()))
return;
DVLOG(1) << "Recording sample of metric \"" << metric_name << "\"";
- sampler_.AddSample(metric_name, sample.Pass());
+ sampler_.AddSample(metric_name, std::move(sample));
}
} // namespace rappor
diff --git a/components/rappor/rappor_service_unittest.cc b/components/rappor/rappor_service_unittest.cc
index 75f0605c..b475dbc 100644
--- a/components/rappor/rappor_service_unittest.cc
+++ b/components/rappor/rappor_service_unittest.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <utility>
#include "base/base64.h"
#include "base/metrics/metrics_hashes.h"
@@ -124,7 +125,7 @@
rappor_service.CreateSample(SAFEBROWSING_RAPPOR_TYPE);
sample->SetStringField("Url", "example.com");
sample->SetFlagsField("Flags1", 0xbcd, 12);
- rappor_service.RecordSampleObj("ObjMetric", sample.Pass());
+ rappor_service.RecordSampleObj("ObjMetric", std::move(sample));
uint64_t url_hash = base::HashMetricName("ObjMetric.Url");
uint64_t flags_hash = base::HashMetricName("ObjMetric.Flags1");
RapporReports reports;
diff --git a/components/rappor/sampler.cc b/components/rappor/sampler.cc
index 5d3e8e3..9ad0da9 100644
--- a/components/rappor/sampler.cc
+++ b/components/rappor/sampler.cc
@@ -6,6 +6,7 @@
#include <map>
#include <string>
+#include <utility>
#include "base/rand_util.h"
@@ -23,7 +24,7 @@
// Replace the previous sample with a 1 in sample_count_ chance so that each
// sample has equal probability of being reported.
if (base::RandGenerator(sample_counts_[metric_name]) == 0)
- samples_.set(metric_name, sample.Pass());
+ samples_.set(metric_name, std::move(sample));
}
void Sampler::ExportMetrics(const std::string& secret, RapporReports* reports) {
diff --git a/components/rappor/sampler_unittest.cc b/components/rappor/sampler_unittest.cc
index 122abc26..210576d 100644
--- a/components/rappor/sampler_unittest.cc
+++ b/components/rappor/sampler_unittest.cc
@@ -4,6 +4,8 @@
#include "components/rappor/sampler.h"
+#include <utility>
+
#include "components/rappor/byte_vector_utils.h"
#include "components/rappor/proto/rappor_metric.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -35,11 +37,11 @@
scoped_ptr<Sample> sample1 = TestSamplerFactory::CreateSample();
sample1->SetStringField("Foo", "Junk");
- sampler.AddSample("Metric1", sample1.Pass());
+ sampler.AddSample("Metric1", std::move(sample1));
scoped_ptr<Sample> sample2 = TestSamplerFactory::CreateSample();
sample2->SetStringField("Foo", "Junk2");
- sampler.AddSample("Metric1", sample2.Pass());
+ sampler.AddSample("Metric1", std::move(sample2));
// Since the two samples were for one metric, we should randomly get one
// of the two.
diff --git a/components/rappor/test_rappor_service.cc b/components/rappor/test_rappor_service.cc
index 3056738..fb24202 100644
--- a/components/rappor/test_rappor_service.cc
+++ b/components/rappor/test_rappor_service.cc
@@ -4,6 +4,8 @@
#include "components/rappor/test_rappor_service.h"
+#include <utility>
+
#include "base/logging.h"
#include "components/rappor/byte_vector_utils.h"
#include "components/rappor/proto/rappor_metric.pb.h"
@@ -65,7 +67,7 @@
scoped_ptr<Sample> TestRapporService::CreateSample(RapporType type) {
scoped_ptr<TestSample> test_sample(new TestSample(type));
- return test_sample.Pass();
+ return std::move(test_sample);
}
// Intercepts the sample being recorded and saves it in a test structure.
@@ -77,7 +79,7 @@
shadows_.insert(std::pair<std::string, TestSample::Shadow>(
metric_name, test_sample->GetShadow()));
// Original version is still called.
- RapporService::RecordSampleObj(metric_name, sample.Pass());
+ RapporService::RecordSampleObj(metric_name, std::move(sample));
}
void TestRapporService::RecordSample(const std::string& metric_name,