OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |