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

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

Issue 2517363002: Decouple Metrics Initialization from IO Thread Initialization (Closed)
Patch Set: CR Feedback 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
« no previous file with comments | « components/metrics/metrics_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(const std::string& service_name,
540 int message_size,
541 bool is_cellular) {
540 DCHECK(IsSingleThreaded()); 542 DCHECK(IsSingleThreaded());
541
542 if (data_use_tracker_) { 543 if (data_use_tracker_) {
543 return data_use_tracker_->GetDataUseForwardingCallback( 544 data_use_tracker_->UpdateMetricsUsagePrefs(service_name,
544 base::ThreadTaskRunnerHandle::Get()); 545 message_size,
546 is_cellular);
545 } 547 }
546 return UpdateUsagePrefCallbackType();
547 } 548 }
548 549
549 void MetricsService::MergeHistogramDeltas() { 550 void MetricsService::MergeHistogramDeltas() {
550 for (MetricsProvider* provider : metrics_providers_) 551 for (MetricsProvider* provider : metrics_providers_)
551 provider->MergeHistogramDeltas(); 552 provider->MergeHistogramDeltas();
552 } 553 }
553 554
554 //------------------------------------------------------------------------------ 555 //------------------------------------------------------------------------------
555 // private methods 556 // private methods
556 //------------------------------------------------------------------------------ 557 //------------------------------------------------------------------------------
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 base::Time::Now().ToTimeT()); 1227 base::Time::Now().ToTimeT());
1227 } 1228 }
1228 1229
1229 void MetricsService::SkipAndDiscardUpload() { 1230 void MetricsService::SkipAndDiscardUpload() {
1230 log_manager_.DiscardStagedLog(); 1231 log_manager_.DiscardStagedLog();
1231 scheduler_->UploadCancelled(); 1232 scheduler_->UploadCancelled();
1232 log_upload_in_progress_ = false; 1233 log_upload_in_progress_ = false;
1233 } 1234 }
1234 1235
1235 } // namespace metrics 1236 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/metrics_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698