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 #include "chrome/browser/metrics/chrome_metrics_service_client.h" | 5 #include "chrome/browser/metrics/chrome_metrics_service_client.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 // receives pointers to fully constructed objects. | 137 // receives pointers to fully constructed objects. |
138 scoped_ptr<ChromeMetricsServiceClient> client( | 138 scoped_ptr<ChromeMetricsServiceClient> client( |
139 new ChromeMetricsServiceClient(state_manager)); | 139 new ChromeMetricsServiceClient(state_manager)); |
140 client->Initialize(); | 140 client->Initialize(); |
141 | 141 |
142 return client.Pass(); | 142 return client.Pass(); |
143 } | 143 } |
144 | 144 |
145 // static | 145 // static |
146 void ChromeMetricsServiceClient::RegisterPrefs(PrefRegistrySimple* registry) { | 146 void ChromeMetricsServiceClient::RegisterPrefs(PrefRegistrySimple* registry) { |
147 registry->RegisterInt64Pref(prefs::kInstallDate, 0); | 147 registry->RegisterInt64Pref(metrics::prefs::kInstallDate, 0); |
Ilya Sherman
2014/07/08 03:26:33
It would probably be more appropriate to move this
gab
2014/07/08 17:41:02
Ok, that makes it such that MetricsLog::RecordEnvi
| |
148 registry->RegisterInt64Pref(prefs::kUninstallLastLaunchTimeSec, 0); | 148 registry->RegisterInt64Pref(prefs::kUninstallLastLaunchTimeSec, 0); |
149 registry->RegisterInt64Pref(prefs::kUninstallLastObservedRunTimeSec, 0); | 149 registry->RegisterInt64Pref(prefs::kUninstallLastObservedRunTimeSec, 0); |
150 | 150 |
151 MetricsService::RegisterPrefs(registry); | 151 MetricsService::RegisterPrefs(registry); |
152 ChromeStabilityMetricsProvider::RegisterPrefs(registry); | 152 ChromeStabilityMetricsProvider::RegisterPrefs(registry); |
153 | 153 |
154 #if defined(OS_ANDROID) | 154 #if defined(OS_ANDROID) |
155 AndroidMetricsProvider::RegisterPrefs(registry); | 155 AndroidMetricsProvider::RegisterPrefs(registry); |
156 #endif // defined(OS_ANDROID) | 156 #endif // defined(OS_ANDROID) |
157 | 157 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 std::string version = version_info.Version(); | 190 std::string version = version_info.Version(); |
191 #if defined(ARCH_CPU_64_BITS) | 191 #if defined(ARCH_CPU_64_BITS) |
192 version += "-64"; | 192 version += "-64"; |
193 #endif // defined(ARCH_CPU_64_BITS) | 193 #endif // defined(ARCH_CPU_64_BITS) |
194 if (!version_info.IsOfficialBuild()) | 194 if (!version_info.IsOfficialBuild()) |
195 version.append("-devel"); | 195 version.append("-devel"); |
196 return version; | 196 return version; |
197 } | 197 } |
198 | 198 |
199 int64 ChromeMetricsServiceClient::GetInstallDate() { | 199 int64 ChromeMetricsServiceClient::GetInstallDate() { |
200 return g_browser_process->local_state()->GetInt64(prefs::kInstallDate); | 200 return g_browser_process->local_state()->GetInt64( |
201 metrics::prefs::kInstallDate); | |
201 } | 202 } |
202 | 203 |
203 void ChromeMetricsServiceClient::OnLogUploadComplete() { | 204 void ChromeMetricsServiceClient::OnLogUploadComplete() { |
204 // Collect network stats after each UMA upload. | 205 // Collect network stats after each UMA upload. |
205 network_stats_uploader_.CollectAndReportNetworkStats(); | 206 network_stats_uploader_.CollectAndReportNetworkStats(); |
206 } | 207 } |
207 | 208 |
208 void ChromeMetricsServiceClient::StartGatheringMetrics( | 209 void ChromeMetricsServiceClient::StartGatheringMetrics( |
209 const base::Closure& done_callback) { | 210 const base::Closure& done_callback) { |
210 finished_gathering_initial_metrics_callback_ = done_callback; | 211 finished_gathering_initial_metrics_callback_ = done_callback; |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 // Capture the histogram samples. | 526 // Capture the histogram samples. |
526 if (dumps_with_crash != 0) | 527 if (dumps_with_crash != 0) |
527 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); | 528 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); |
528 if (dumps_with_no_crash != 0) | 529 if (dumps_with_no_crash != 0) |
529 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); | 530 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); |
530 int total_dumps = dumps_with_crash + dumps_with_no_crash; | 531 int total_dumps = dumps_with_crash + dumps_with_no_crash; |
531 if (total_dumps != 0) | 532 if (total_dumps != 0) |
532 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); | 533 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); |
533 } | 534 } |
534 #endif // defined(OS_WIN) | 535 #endif // defined(OS_WIN) |
OLD | NEW |