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

Side by Side Diff: components/ukm/ukm_service.cc

Issue 2708293002: Switch UKM service to properly mark upload data as UKM and not UMA. (Closed)
Patch Set: no switch default now requires a default value Created 3 years, 10 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/ukm/ukm_service.h" 5 #include "components/ukm/ukm_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 if (!persisted_logs_.has_unsent_logs()) { 270 if (!persisted_logs_.has_unsent_logs()) {
271 // No logs to send, so early out and schedule the next rotation. 271 // No logs to send, so early out and schedule the next rotation.
272 scheduler_->UploadFinished(true, /* has_unsent_logs */ false); 272 scheduler_->UploadFinished(true, /* has_unsent_logs */ false);
273 return; 273 return;
274 } 274 }
275 if (!persisted_logs_.has_staged_log()) 275 if (!persisted_logs_.has_staged_log())
276 persisted_logs_.StageNextLog(); 276 persisted_logs_.StageNextLog();
277 // TODO(holte): Handle data usage on cellular, etc. 277 // TODO(holte): Handle data usage on cellular, etc.
278 if (!log_uploader_) { 278 if (!log_uploader_) {
279 log_uploader_ = client_->CreateUploader( 279 log_uploader_ = client_->CreateUploader(
280 GetServerUrl(), kMimeType, base::Bind(&UkmService::OnLogUploadComplete, 280 GetServerUrl(), kMimeType, metrics::MetricsLogUploader::UKM,
281 self_ptr_factory_.GetWeakPtr())); 281 base::Bind(&UkmService::OnLogUploadComplete,
282 self_ptr_factory_.GetWeakPtr()));
282 } 283 }
283 log_upload_in_progress_ = true; 284 log_upload_in_progress_ = true;
284 285
285 const std::string hash = 286 const std::string hash =
286 base::HexEncode(persisted_logs_.staged_log_hash().data(), 287 base::HexEncode(persisted_logs_.staged_log_hash().data(),
287 persisted_logs_.staged_log_hash().size()); 288 persisted_logs_.staged_log_hash().size());
288 log_uploader_->UploadLog(persisted_logs_.staged_log(), hash); 289 log_uploader_->UploadLog(persisted_logs_.staged_log(), hash);
289 } 290 }
290 291
291 void UkmService::OnLogUploadComplete(int response_code) { 292 void UkmService::OnLogUploadComplete(int response_code) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 329 }
329 if (sources_.size() >= kMaxSources) { 330 if (sources_.size() >= kMaxSources) {
330 RecordDroppedSource(DroppedSourceReason::MAX_SOURCES_HIT); 331 RecordDroppedSource(DroppedSourceReason::MAX_SOURCES_HIT);
331 return; 332 return;
332 } 333 }
333 334
334 sources_.push_back(std::move(source)); 335 sources_.push_back(std::move(source));
335 } 336 }
336 337
337 } // namespace ukm 338 } // namespace ukm
OLDNEW
« no previous file with comments | « components/metrics/test_metrics_service_client.cc ('k') | ios/chrome/browser/metrics/ios_chrome_metrics_service_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698