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

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

Issue 2257793002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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/rappor_service.h" 5 #include "components/rappor/rappor_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 DCHECK(thread_checker_.CalledOnValidThread()); 77 DCHECK(thread_checker_.CalledOnValidThread());
78 DCHECK(!IsInitialized()); 78 DCHECK(!IsInitialized());
79 const GURL server_url = GetServerUrl(); 79 const GURL server_url = GetServerUrl();
80 if (!server_url.is_valid()) { 80 if (!server_url.is_valid()) {
81 DVLOG(1) << server_url.spec() << " is invalid. " 81 DVLOG(1) << server_url.spec() << " is invalid. "
82 << "RapporService not started."; 82 << "RapporService not started.";
83 return; 83 return;
84 } 84 }
85 DVLOG(1) << "RapporService reporting to " << server_url.spec(); 85 DVLOG(1) << "RapporService reporting to " << server_url.spec();
86 InitializeInternal( 86 InitializeInternal(
87 base::WrapUnique(new LogUploader(server_url, kMimeType, request_context)), 87 base::MakeUnique<LogUploader>(server_url, kMimeType, request_context),
88 internal::LoadCohort(pref_service_), internal::LoadSecret(pref_service_)); 88 internal::LoadCohort(pref_service_), internal::LoadSecret(pref_service_));
89 } 89 }
90 90
91 void RapporService::Update(int recording_groups, bool may_upload) { 91 void RapporService::Update(int recording_groups, bool may_upload) {
92 DCHECK(thread_checker_.CalledOnValidThread()); 92 DCHECK(thread_checker_.CalledOnValidThread());
93 DCHECK(IsInitialized()); 93 DCHECK(IsInitialized());
94 if (recording_groups_ != recording_groups) { 94 if (recording_groups_ != recording_groups) {
95 if (recording_groups == 0) { 95 if (recording_groups == 0) {
96 DVLOG(1) << "Rappor service stopped because all groups were disabled."; 96 DVLOG(1) << "Rappor service stopped because all groups were disabled.";
97 recording_groups_ = 0; 97 recording_groups_ = 0;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 void RapporService::RecordSampleObj(const std::string& metric_name, 258 void RapporService::RecordSampleObj(const std::string& metric_name,
259 std::unique_ptr<Sample> sample) { 259 std::unique_ptr<Sample> sample) {
260 DCHECK(thread_checker_.CalledOnValidThread()); 260 DCHECK(thread_checker_.CalledOnValidThread());
261 if (!RecordingAllowed(sample->parameters())) 261 if (!RecordingAllowed(sample->parameters()))
262 return; 262 return;
263 DVLOG(1) << "Recording sample of metric \"" << metric_name << "\""; 263 DVLOG(1) << "Recording sample of metric \"" << metric_name << "\"";
264 sampler_.AddSample(metric_name, std::move(sample)); 264 sampler_.AddSample(metric_name, std::move(sample));
265 } 265 }
266 266
267 } // namespace rappor 267 } // namespace rappor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698