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

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

Issue 2294323002: Avoid some pref writes in MetricsLog. Ensure some stability metrics are cleared. (Closed)
Patch Set: Fix unittests 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
« no previous file with comments | « components/metrics/metrics_log_unittest.cc ('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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 IncrementPrefValue(prefs::kStabilityDebuggerNotPresent); 516 IncrementPrefValue(prefs::kStabilityDebuggerNotPresent);
517 else 517 else
518 IncrementPrefValue(prefs::kStabilityDebuggerPresent); 518 IncrementPrefValue(prefs::kStabilityDebuggerPresent);
519 } 519 }
520 520
521 void MetricsService::ClearSavedStabilityMetrics() { 521 void MetricsService::ClearSavedStabilityMetrics() {
522 for (MetricsProvider* provider : metrics_providers_) 522 for (MetricsProvider* provider : metrics_providers_)
523 provider->ClearSavedStabilityMetrics(); 523 provider->ClearSavedStabilityMetrics();
524 524
525 // Reset the prefs that are managed by MetricsService/MetricsLog directly. 525 // Reset the prefs that are managed by MetricsService/MetricsLog directly.
526 local_state_->SetInteger(prefs::kStabilityBreakpadRegistrationSuccess, 0);
527 local_state_->SetInteger(prefs::kStabilityBreakpadRegistrationFail, 0);
526 local_state_->SetInteger(prefs::kStabilityCrashCount, 0); 528 local_state_->SetInteger(prefs::kStabilityCrashCount, 0);
529 local_state_->SetInteger(prefs::kStabilityDebuggerPresent, 0);
530 local_state_->SetInteger(prefs::kStabilityDebuggerNotPresent, 0);
527 local_state_->SetInteger(prefs::kStabilityExecutionPhase, 531 local_state_->SetInteger(prefs::kStabilityExecutionPhase,
528 UNINITIALIZED_PHASE); 532 UNINITIALIZED_PHASE);
529 local_state_->SetInteger(prefs::kStabilityIncompleteSessionEndCount, 0); 533 local_state_->SetInteger(prefs::kStabilityIncompleteSessionEndCount, 0);
530 local_state_->SetInteger(prefs::kStabilityLaunchCount, 0); 534 local_state_->SetInteger(prefs::kStabilityLaunchCount, 0);
531 local_state_->SetBoolean(prefs::kStabilitySessionEndCompleted, true); 535 local_state_->SetBoolean(prefs::kStabilitySessionEndCompleted, true);
532 } 536 }
533 537
534 void MetricsService::PushExternalLog(const std::string& log) { 538 void MetricsService::PushExternalLog(const std::string& log) {
535 log_manager_.StoreLog(log, MetricsLog::ONGOING_LOG); 539 log_manager_.StoreLog(log, MetricsLog::ONGOING_LOG);
536 } 540 }
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 base::Time::Now().ToTimeT()); 1208 base::Time::Now().ToTimeT());
1205 } 1209 }
1206 1210
1207 void MetricsService::SkipAndDiscardUpload() { 1211 void MetricsService::SkipAndDiscardUpload() {
1208 log_manager_.DiscardStagedLog(); 1212 log_manager_.DiscardStagedLog();
1209 scheduler_->UploadCancelled(); 1213 scheduler_->UploadCancelled();
1210 log_upload_in_progress_ = false; 1214 log_upload_in_progress_ = false;
1211 } 1215 }
1212 1216
1213 } // namespace metrics 1217 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/metrics_log_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698