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

Side by Side Diff: components/rappor/test_rappor_service.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/rappor/test_rappor_service.h" 5 #include "components/rappor/test_rappor_service.h"
6 6
7 #include <utility>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "components/rappor/byte_vector_utils.h" 10 #include "components/rappor/byte_vector_utils.h"
9 #include "components/rappor/proto/rappor_metric.pb.h" 11 #include "components/rappor/proto/rappor_metric.pb.h"
10 #include "components/rappor/rappor_parameters.h" 12 #include "components/rappor/rappor_parameters.h"
11 #include "components/rappor/rappor_prefs.h" 13 #include "components/rappor/rappor_prefs.h"
12 #include "components/rappor/test_log_uploader.h" 14 #include "components/rappor/test_log_uploader.h"
13 15
14 namespace rappor { 16 namespace rappor {
15 17
16 namespace { 18 namespace {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 InitializeInternal(make_scoped_ptr(test_uploader_), 60 InitializeInternal(make_scoped_ptr(test_uploader_),
59 0, 61 0,
60 HmacByteVectorGenerator::GenerateEntropyInput()); 62 HmacByteVectorGenerator::GenerateEntropyInput());
61 Update(UMA_RAPPOR_GROUP | SAFEBROWSING_RAPPOR_GROUP, true); 63 Update(UMA_RAPPOR_GROUP | SAFEBROWSING_RAPPOR_GROUP, true);
62 } 64 }
63 65
64 TestRapporService::~TestRapporService() {} 66 TestRapporService::~TestRapporService() {}
65 67
66 scoped_ptr<Sample> TestRapporService::CreateSample(RapporType type) { 68 scoped_ptr<Sample> TestRapporService::CreateSample(RapporType type) {
67 scoped_ptr<TestSample> test_sample(new TestSample(type)); 69 scoped_ptr<TestSample> test_sample(new TestSample(type));
68 return test_sample.Pass(); 70 return std::move(test_sample);
69 } 71 }
70 72
71 // Intercepts the sample being recorded and saves it in a test structure. 73 // Intercepts the sample being recorded and saves it in a test structure.
72 void TestRapporService::RecordSampleObj(const std::string& metric_name, 74 void TestRapporService::RecordSampleObj(const std::string& metric_name,
73 scoped_ptr<Sample> sample) { 75 scoped_ptr<Sample> sample) {
74 TestSample* test_sample = static_cast<TestSample*>(sample.get()); 76 TestSample* test_sample = static_cast<TestSample*>(sample.get());
75 // Erase the previous sample if we logged one. 77 // Erase the previous sample if we logged one.
76 shadows_.erase(metric_name); 78 shadows_.erase(metric_name);
77 shadows_.insert(std::pair<std::string, TestSample::Shadow>( 79 shadows_.insert(std::pair<std::string, TestSample::Shadow>(
78 metric_name, test_sample->GetShadow())); 80 metric_name, test_sample->GetShadow()));
79 // Original version is still called. 81 // Original version is still called.
80 RapporService::RecordSampleObj(metric_name, sample.Pass()); 82 RapporService::RecordSampleObj(metric_name, std::move(sample));
81 } 83 }
82 84
83 void TestRapporService::RecordSample(const std::string& metric_name, 85 void TestRapporService::RecordSample(const std::string& metric_name,
84 RapporType type, 86 RapporType type,
85 const std::string& sample) { 87 const std::string& sample) {
86 // Save the recorded sample to the local structure. 88 // Save the recorded sample to the local structure.
87 RapporSample rappor_sample; 89 RapporSample rappor_sample;
88 rappor_sample.type = type; 90 rappor_sample.type = type;
89 rappor_sample.value = sample; 91 rappor_sample.value = sample;
90 samples_[metric_name] = rappor_sample; 92 samples_[metric_name] = rappor_sample;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 void TestRapporService::CancelNextLogRotation() { 128 void TestRapporService::CancelNextLogRotation() {
127 next_rotation_ = base::TimeDelta(); 129 next_rotation_ = base::TimeDelta();
128 } 130 }
129 131
130 // Schedule the next call to OnLogInterval. 132 // Schedule the next call to OnLogInterval.
131 void TestRapporService::ScheduleNextLogRotation(base::TimeDelta interval) { 133 void TestRapporService::ScheduleNextLogRotation(base::TimeDelta interval) {
132 next_rotation_ = interval; 134 next_rotation_ = interval;
133 } 135 }
134 136
135 } // namespace rappor 137 } // namespace rappor
OLDNEW
« no previous file with comments | « components/rappor/sampler_unittest.cc ('k') | components/renderer_context_menu/render_view_context_menu_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698