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

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

Issue 2752073002: Avoid double initializing reporting_service_ (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | components/metrics/reporting_service.cc » ('j') | 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 494
495 bool version_changed = false; 495 bool version_changed = false;
496 EnvironmentRecorder recorder(local_state_); 496 EnvironmentRecorder recorder(local_state_);
497 int64_t previous_buildtime = recorder.GetLastBuildtime(); 497 int64_t previous_buildtime = recorder.GetLastBuildtime();
498 std::string previous_version = recorder.GetLastVersion(); 498 std::string previous_version = recorder.GetLastVersion();
499 if (previous_buildtime != buildtime || previous_version != version) { 499 if (previous_buildtime != buildtime || previous_version != version) {
500 recorder.SetBuildtimeAndVersion(buildtime, version); 500 recorder.SetBuildtimeAndVersion(buildtime, version);
501 version_changed = true; 501 version_changed = true;
502 } 502 }
503 503
504 reporting_service_.Initialize();
505
506 session_id_ = local_state_->GetInteger(prefs::kMetricsSessionID); 504 session_id_ = local_state_->GetInteger(prefs::kMetricsSessionID);
507 505
508 StabilityMetricsProvider provider(local_state_); 506 StabilityMetricsProvider provider(local_state_);
509 if (!clean_exit_beacon_.exited_cleanly()) { 507 if (!clean_exit_beacon_.exited_cleanly()) {
510 provider.LogCrash(); 508 provider.LogCrash();
511 // Reset flag, and wait until we call LogNeedForCleanShutdown() before 509 // Reset flag, and wait until we call LogNeedForCleanShutdown() before
512 // monitoring. 510 // monitoring.
513 clean_exit_beacon_.WriteBeaconValue(true); 511 clean_exit_beacon_.WriteBeaconValue(true);
514 ExecutionPhaseManager manager(local_state_); 512 ExecutionPhaseManager manager(local_state_);
515 UMA_HISTOGRAM_SPARSE_SLOWLY("Chrome.Browser.CrashedExecutionPhase", 513 UMA_HISTOGRAM_SPARSE_SLOWLY("Chrome.Browser.CrashedExecutionPhase",
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 // Redundant setting to assure that we always reset this value at shutdown 996 // Redundant setting to assure that we always reset this value at shutdown
999 // (and that we don't use some alternate path, and not call LogCleanShutdown). 997 // (and that we don't use some alternate path, and not call LogCleanShutdown).
1000 clean_shutdown_status_ = CLEANLY_SHUTDOWN; 998 clean_shutdown_status_ = CLEANLY_SHUTDOWN;
1001 client_->OnLogCleanShutdown(); 999 client_->OnLogCleanShutdown();
1002 clean_exit_beacon_.WriteBeaconValue(true); 1000 clean_exit_beacon_.WriteBeaconValue(true);
1003 SetExecutionPhase(ExecutionPhase::SHUTDOWN_COMPLETE, local_state_); 1001 SetExecutionPhase(ExecutionPhase::SHUTDOWN_COMPLETE, local_state_);
1004 StabilityMetricsProvider(local_state_).MarkSessionEndCompleted(end_completed); 1002 StabilityMetricsProvider(local_state_).MarkSessionEndCompleted(end_completed);
1005 } 1003 }
1006 1004
1007 } // namespace metrics 1005 } // namespace metrics
OLDNEW
« no previous file with comments | « no previous file | components/metrics/reporting_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698