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

Side by Side Diff: components/metrics/metrics_service.cc

Issue 2517363002: Decouple Metrics Initialization from IO Thread Initialization (Closed)
Patch Set: Fix Unit Test Created 4 years 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 //------------------------------------------------------------------------------ 5 //------------------------------------------------------------------------------
6 // Description of the life cycle of a instance of MetricsService. 6 // Description of the life cycle of a instance of MetricsService.
7 // 7 //
8 // OVERVIEW 8 // OVERVIEW
9 // 9 //
10 // A MetricsService instance is typically created at application startup. It is 10 // A MetricsService instance is typically created at application startup. It is
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 local_state_->SetInteger(prefs::kStabilityDeferredCount, 0); 529 local_state_->SetInteger(prefs::kStabilityDeferredCount, 0);
530 // Note: kStabilityDiscardCount is not cleared as its intent is to measure 530 // Note: kStabilityDiscardCount is not cleared as its intent is to measure
531 // the number of times data is discarded, even across versions. 531 // the number of times data is discarded, even across versions.
532 local_state_->SetInteger(prefs::kStabilityVersionMismatchCount, 0); 532 local_state_->SetInteger(prefs::kStabilityVersionMismatchCount, 0);
533 } 533 }
534 534
535 void MetricsService::PushExternalLog(const std::string& log) { 535 void MetricsService::PushExternalLog(const std::string& log) {
536 log_manager_.StoreLog(log, MetricsLog::ONGOING_LOG); 536 log_manager_.StoreLog(log, MetricsLog::ONGOING_LOG);
537 } 537 }
538 538
539 UpdateUsagePrefCallbackType MetricsService::GetDataUseForwardingCallback() { 539 void MetricsService::UpdateMetricsUsagePrefs(
540 const std::string& service_name, int message_size, bool is_cellular) {
Alexei Svitkine (slow) 2016/11/30 19:16:27 Nit: Each param on its own line if the first param
robliao 2016/11/30 20:33:13 Done. https://google.github.io/styleguide/cppguid
540 DCHECK(IsSingleThreaded()); 541 DCHECK(IsSingleThreaded());
541
542 if (data_use_tracker_) { 542 if (data_use_tracker_) {
543 return data_use_tracker_->GetDataUseForwardingCallback( 543 data_use_tracker_->UpdateMetricsUsagePrefs(
544 base::ThreadTaskRunnerHandle::Get()); 544 service_name, message_size, is_cellular);
545 } 545 }
546 return UpdateUsagePrefCallbackType();
547 } 546 }
548 547
549 void MetricsService::MergeHistogramDeltas() { 548 void MetricsService::MergeHistogramDeltas() {
550 for (MetricsProvider* provider : metrics_providers_) 549 for (MetricsProvider* provider : metrics_providers_)
551 provider->MergeHistogramDeltas(); 550 provider->MergeHistogramDeltas();
552 } 551 }
553 552
554 //------------------------------------------------------------------------------ 553 //------------------------------------------------------------------------------
555 // private methods 554 // private methods
556 //------------------------------------------------------------------------------ 555 //------------------------------------------------------------------------------
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 base::Time::Now().ToTimeT()); 1225 base::Time::Now().ToTimeT());
1227 } 1226 }
1228 1227
1229 void MetricsService::SkipAndDiscardUpload() { 1228 void MetricsService::SkipAndDiscardUpload() {
1230 log_manager_.DiscardStagedLog(); 1229 log_manager_.DiscardStagedLog();
1231 scheduler_->UploadCancelled(); 1230 scheduler_->UploadCancelled();
1232 log_upload_in_progress_ = false; 1231 log_upload_in_progress_ = false;
1233 } 1232 }
1234 1233
1235 } // namespace metrics 1234 } // namespace metrics
OLDNEW
« components/metrics/data_use_tracker.h ('K') | « components/metrics/metrics_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698