Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 #include "chrome/browser/ui/search/search_tab_helper.h" | 192 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 193 #include "chrome/common/chrome_constants.h" | 193 #include "chrome/common/chrome_constants.h" |
| 194 #include "chrome/common/chrome_result_codes.h" | 194 #include "chrome/common/chrome_result_codes.h" |
| 195 #include "chrome/common/chrome_switches.h" | 195 #include "chrome/common/chrome_switches.h" |
| 196 #include "chrome/common/crash_keys.h" | 196 #include "chrome/common/crash_keys.h" |
| 197 #include "chrome/common/metrics/caching_permuted_entropy_provider.h" | 197 #include "chrome/common/metrics/caching_permuted_entropy_provider.h" |
| 198 #include "chrome/common/metrics/metrics_log_manager.h" | 198 #include "chrome/common/metrics/metrics_log_manager.h" |
| 199 #include "chrome/common/net/test_server_locations.h" | 199 #include "chrome/common/net/test_server_locations.h" |
| 200 #include "chrome/common/pref_names.h" | 200 #include "chrome/common/pref_names.h" |
| 201 #include "chrome/common/render_messages.h" | 201 #include "chrome/common/render_messages.h" |
| 202 #include "components/user_prefs/pref_registry_syncable.h" | |
| 202 #include "components/variations/entropy_provider.h" | 203 #include "components/variations/entropy_provider.h" |
| 203 #include "content/public/browser/child_process_data.h" | 204 #include "content/public/browser/child_process_data.h" |
| 204 #include "content/public/browser/histogram_fetcher.h" | 205 #include "content/public/browser/histogram_fetcher.h" |
| 205 #include "content/public/browser/load_notification_details.h" | 206 #include "content/public/browser/load_notification_details.h" |
| 206 #include "content/public/browser/notification_service.h" | 207 #include "content/public/browser/notification_service.h" |
| 207 #include "content/public/browser/plugin_service.h" | 208 #include "content/public/browser/plugin_service.h" |
| 208 #include "content/public/browser/render_process_host.h" | 209 #include "content/public/browser/render_process_host.h" |
| 209 #include "content/public/browser/user_metrics.h" | 210 #include "content/public/browser/user_metrics.h" |
| 210 #include "content/public/browser/web_contents.h" | 211 #include "content/public/browser/web_contents.h" |
| 211 #include "content/public/common/process_type.h" | 212 #include "content/public/common/process_type.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 virtual ~MetricsMemoryDetails() {} | 391 virtual ~MetricsMemoryDetails() {} |
| 391 | 392 |
| 392 base::Closure callback_; | 393 base::Closure callback_; |
| 393 DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails); | 394 DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails); |
| 394 }; | 395 }; |
| 395 | 396 |
| 396 // static | 397 // static |
| 397 void MetricsService::RegisterPrefs(PrefRegistrySimple* registry) { | 398 void MetricsService::RegisterPrefs(PrefRegistrySimple* registry) { |
| 398 DCHECK(IsSingleThreaded()); | 399 DCHECK(IsSingleThreaded()); |
| 399 registry->RegisterStringPref(prefs::kMetricsClientID, std::string()); | 400 registry->RegisterStringPref(prefs::kMetricsClientID, std::string()); |
| 401 // TODO make sure this doesn't get uploaded anywhere. | |
|
Steven Holte
2013/10/28 21:02:44
Can anyone confirm that the prefs in this registry
Ilya Sherman
2013/10/29 00:32:31
I'm fairly confident that the difference between P
| |
| 402 registry->RegisterStringPref(prefs::kMetricsSecretClientID, | |
| 403 std::string()); | |
| 400 registry->RegisterIntegerPref(prefs::kMetricsLowEntropySource, | 404 registry->RegisterIntegerPref(prefs::kMetricsLowEntropySource, |
| 401 kLowEntropySourceNotSet); | 405 kLowEntropySourceNotSet); |
| 402 registry->RegisterInt64Pref(prefs::kMetricsClientIDTimestamp, 0); | 406 registry->RegisterInt64Pref(prefs::kMetricsClientIDTimestamp, 0); |
| 403 registry->RegisterInt64Pref(prefs::kStabilityLaunchTimeSec, 0); | 407 registry->RegisterInt64Pref(prefs::kStabilityLaunchTimeSec, 0); |
| 404 registry->RegisterInt64Pref(prefs::kStabilityLastTimestampSec, 0); | 408 registry->RegisterInt64Pref(prefs::kStabilityLastTimestampSec, 0); |
| 405 registry->RegisterStringPref(prefs::kStabilityStatsVersion, std::string()); | 409 registry->RegisterStringPref(prefs::kStabilityStatsVersion, std::string()); |
| 406 registry->RegisterInt64Pref(prefs::kStabilityStatsBuildTime, 0); | 410 registry->RegisterInt64Pref(prefs::kStabilityStatsBuildTime, 0); |
| 407 registry->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); | 411 registry->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); |
| 408 registry->RegisterBooleanPref(prefs::kStabilitySessionEndCompleted, true); | 412 registry->RegisterBooleanPref(prefs::kStabilitySessionEndCompleted, true); |
| 409 registry->RegisterIntegerPref(prefs::kMetricsSessionID, -1); | 413 registry->RegisterIntegerPref(prefs::kMetricsSessionID, -1); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 void MetricsService::ForceClientIdCreation() { | 574 void MetricsService::ForceClientIdCreation() { |
| 571 if (!client_id_.empty()) | 575 if (!client_id_.empty()) |
| 572 return; | 576 return; |
| 573 PrefService* pref = g_browser_process->local_state(); | 577 PrefService* pref = g_browser_process->local_state(); |
| 574 client_id_ = pref->GetString(prefs::kMetricsClientID); | 578 client_id_ = pref->GetString(prefs::kMetricsClientID); |
| 575 if (!client_id_.empty()) | 579 if (!client_id_.empty()) |
| 576 return; | 580 return; |
| 577 | 581 |
| 578 client_id_ = GenerateClientID(); | 582 client_id_ = GenerateClientID(); |
| 579 pref->SetString(prefs::kMetricsClientID, client_id_); | 583 pref->SetString(prefs::kMetricsClientID, client_id_); |
| 584 pref->SetString(prefs::kMetricsSecretClientID, GenerateClientID()); | |
| 580 | 585 |
| 581 // Might as well make a note of how long this ID has existed | 586 // Might as well make a note of how long this ID has existed |
| 582 pref->SetString(prefs::kMetricsClientIDTimestamp, | 587 pref->SetString(prefs::kMetricsClientIDTimestamp, |
| 583 base::Int64ToString(Time::Now().ToTimeT())); | 588 base::Int64ToString(Time::Now().ToTimeT())); |
| 584 } | 589 } |
| 585 | 590 |
| 586 void MetricsService::EnableRecording() { | 591 void MetricsService::EnableRecording() { |
| 587 DCHECK(IsSingleThreaded()); | 592 DCHECK(IsSingleThreaded()); |
| 588 | 593 |
| 589 if (recording_active_) | 594 if (recording_active_) |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1818 if (local_state) { | 1823 if (local_state) { |
| 1819 const PrefService::Preference* uma_pref = | 1824 const PrefService::Preference* uma_pref = |
| 1820 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1825 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1821 if (uma_pref) { | 1826 if (uma_pref) { |
| 1822 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1827 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1823 DCHECK(success); | 1828 DCHECK(success); |
| 1824 } | 1829 } |
| 1825 } | 1830 } |
| 1826 return result; | 1831 return result; |
| 1827 } | 1832 } |
| OLD | NEW |