OLD | NEW |
---|---|
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 #include "components/metrics/metrics_log_manager.h" | 154 #include "components/metrics/metrics_log_manager.h" |
155 #include "components/metrics/metrics_log_uploader.h" | 155 #include "components/metrics/metrics_log_uploader.h" |
156 #include "components/metrics/metrics_pref_names.h" | 156 #include "components/metrics/metrics_pref_names.h" |
157 #include "components/metrics/metrics_reporting_scheduler.h" | 157 #include "components/metrics/metrics_reporting_scheduler.h" |
158 #include "components/metrics/metrics_service_client.h" | 158 #include "components/metrics/metrics_service_client.h" |
159 #include "components/metrics/metrics_state_manager.h" | 159 #include "components/metrics/metrics_state_manager.h" |
160 #include "components/prefs/pref_registry_simple.h" | 160 #include "components/prefs/pref_registry_simple.h" |
161 #include "components/prefs/pref_service.h" | 161 #include "components/prefs/pref_service.h" |
162 #include "components/variations/entropy_provider.h" | 162 #include "components/variations/entropy_provider.h" |
163 | 163 |
164 #if defined(OS_WIN) | |
165 #include "components/browser_watcher/stability_debugging_win.h" | |
bcwhite
2016/12/01 16:35:20
Can you use a generic stability_debugging.h with p
manzagop (departed)
2016/12/05 15:44:05
Done.
| |
166 #endif // defined(OS_WIN) | |
167 | |
164 namespace metrics { | 168 namespace metrics { |
165 | 169 |
166 namespace { | 170 namespace { |
167 | 171 |
168 // Check to see that we're being called on only one thread. | 172 // Check to see that we're being called on only one thread. |
169 bool IsSingleThreaded() { | 173 bool IsSingleThreaded() { |
170 static base::PlatformThreadId thread_id = 0; | 174 static base::PlatformThreadId thread_id = 0; |
171 if (!thread_id) | 175 if (!thread_id) |
172 thread_id = base::PlatformThread::CurrentId(); | 176 thread_id = base::PlatformThread::CurrentId(); |
173 return base::PlatformThread::CurrentId() == thread_id; | 177 return base::PlatformThread::CurrentId() == thread_id; |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 // Redundant setting to be sure we call for a clean shutdown. | 492 // Redundant setting to be sure we call for a clean shutdown. |
489 clean_shutdown_status_ = NEED_TO_SHUTDOWN; | 493 clean_shutdown_status_ = NEED_TO_SHUTDOWN; |
490 } | 494 } |
491 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 495 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
492 | 496 |
493 // static | 497 // static |
494 void MetricsService::SetExecutionPhase(ExecutionPhase execution_phase, | 498 void MetricsService::SetExecutionPhase(ExecutionPhase execution_phase, |
495 PrefService* local_state) { | 499 PrefService* local_state) { |
496 execution_phase_ = execution_phase; | 500 execution_phase_ = execution_phase; |
497 local_state->SetInteger(prefs::kStabilityExecutionPhase, execution_phase_); | 501 local_state->SetInteger(prefs::kStabilityExecutionPhase, execution_phase_); |
502 #if defined(OS_WIN) | |
503 browser_watcher::SetStabilityDataInt(prefs::kStabilityExecutionPhase, | |
504 execution_phase_); | |
505 #endif // defined(OS_WIN) | |
498 } | 506 } |
499 | 507 |
500 void MetricsService::RecordBreakpadRegistration(bool success) { | 508 void MetricsService::RecordBreakpadRegistration(bool success) { |
501 if (!success) | 509 if (!success) |
502 IncrementPrefValue(prefs::kStabilityBreakpadRegistrationFail); | 510 IncrementPrefValue(prefs::kStabilityBreakpadRegistrationFail); |
503 else | 511 else |
504 IncrementPrefValue(prefs::kStabilityBreakpadRegistrationSuccess); | 512 IncrementPrefValue(prefs::kStabilityBreakpadRegistrationSuccess); |
505 } | 513 } |
506 | 514 |
507 void MetricsService::RecordBreakpadHasDebugger(bool has_debugger) { | 515 void MetricsService::RecordBreakpadHasDebugger(bool has_debugger) { |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1226 base::Time::Now().ToTimeT()); | 1234 base::Time::Now().ToTimeT()); |
1227 } | 1235 } |
1228 | 1236 |
1229 void MetricsService::SkipAndDiscardUpload() { | 1237 void MetricsService::SkipAndDiscardUpload() { |
1230 log_manager_.DiscardStagedLog(); | 1238 log_manager_.DiscardStagedLog(); |
1231 scheduler_->UploadCancelled(); | 1239 scheduler_->UploadCancelled(); |
1232 log_upload_in_progress_ = false; | 1240 log_upload_in_progress_ = false; |
1233 } | 1241 } |
1234 | 1242 |
1235 } // namespace metrics | 1243 } // namespace metrics |
OLD | NEW |