| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 collect_final_metrics_done_callback_ = done_callback; | 232 collect_final_metrics_done_callback_ = done_callback; |
| 233 | 233 |
| 234 // Begin the multi-step process of collecting memory usage histograms: | 234 // Begin the multi-step process of collecting memory usage histograms: |
| 235 // First spawn a task to collect the memory details; when that task is | 235 // First spawn a task to collect the memory details; when that task is |
| 236 // finished, it will call OnMemoryDetailCollectionDone. That will in turn | 236 // finished, it will call OnMemoryDetailCollectionDone. That will in turn |
| 237 // call HistogramSynchronization to collect histograms from all renderers and | 237 // call HistogramSynchronization to collect histograms from all renderers and |
| 238 // then call OnHistogramSynchronizationDone to continue processing. | 238 // then call OnHistogramSynchronizationDone to continue processing. |
| 239 DCHECK(!waiting_for_collect_final_metrics_step_); | 239 DCHECK(!waiting_for_collect_final_metrics_step_); |
| 240 waiting_for_collect_final_metrics_step_ = true; | 240 waiting_for_collect_final_metrics_step_ = true; |
| 241 | 241 |
| 242 #if !defined(OS_CHROMEOS) && !defined(OS_IOS) | |
| 243 // Record the signin status histogram value. | |
| 244 signin_status_metrics_provider_->RecordSigninStatusHistogram(); | |
| 245 #endif | |
| 246 | |
| 247 base::Closure callback = | 242 base::Closure callback = |
| 248 base::Bind(&ChromeMetricsServiceClient::OnMemoryDetailCollectionDone, | 243 base::Bind(&ChromeMetricsServiceClient::OnMemoryDetailCollectionDone, |
| 249 weak_ptr_factory_.GetWeakPtr()); | 244 weak_ptr_factory_.GetWeakPtr()); |
| 250 | 245 |
| 251 scoped_refptr<MetricsMemoryDetails> details( | 246 scoped_refptr<MetricsMemoryDetails> details( |
| 252 new MetricsMemoryDetails(callback, &memory_growth_tracker_)); | 247 new MetricsMemoryDetails(callback, &memory_growth_tracker_)); |
| 253 details->StartFetch(MemoryDetails::UPDATE_USER_METRICS); | 248 details->StartFetch(MemoryDetails::UPDATE_USER_METRICS); |
| 254 | 249 |
| 255 // Collect WebCore cache information to put into a histogram. | 250 // Collect WebCore cache information to put into a histogram. |
| 256 for (content::RenderProcessHost::iterator i( | 251 for (content::RenderProcessHost::iterator i( |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 327 |
| 333 #if defined(OS_CHROMEOS) | 328 #if defined(OS_CHROMEOS) |
| 334 ChromeOSMetricsProvider* chromeos_metrics_provider = | 329 ChromeOSMetricsProvider* chromeos_metrics_provider = |
| 335 new ChromeOSMetricsProvider; | 330 new ChromeOSMetricsProvider; |
| 336 chromeos_metrics_provider_ = chromeos_metrics_provider; | 331 chromeos_metrics_provider_ = chromeos_metrics_provider; |
| 337 metrics_service_->RegisterMetricsProvider( | 332 metrics_service_->RegisterMetricsProvider( |
| 338 scoped_ptr<metrics::MetricsProvider>(chromeos_metrics_provider)); | 333 scoped_ptr<metrics::MetricsProvider>(chromeos_metrics_provider)); |
| 339 #endif // defined(OS_CHROMEOS) | 334 #endif // defined(OS_CHROMEOS) |
| 340 | 335 |
| 341 #if !defined(OS_CHROMEOS) && !defined(OS_IOS) | 336 #if !defined(OS_CHROMEOS) && !defined(OS_IOS) |
| 342 signin_status_metrics_provider_ = | |
| 343 SigninStatusMetricsProvider::CreateInstance(); | |
| 344 metrics_service_->RegisterMetricsProvider( | 337 metrics_service_->RegisterMetricsProvider( |
| 345 scoped_ptr<metrics::MetricsProvider>(signin_status_metrics_provider_)); | 338 scoped_ptr<metrics::MetricsProvider>( |
| 339 SigninStatusMetricsProvider::CreateInstance())); |
| 346 #endif | 340 #endif |
| 347 } | 341 } |
| 348 | 342 |
| 349 void ChromeMetricsServiceClient::OnInitTaskGotHardwareClass() { | 343 void ChromeMetricsServiceClient::OnInitTaskGotHardwareClass() { |
| 350 const base::Closure got_plugin_info_callback = | 344 const base::Closure got_plugin_info_callback = |
| 351 base::Bind(&ChromeMetricsServiceClient::OnInitTaskGotPluginInfo, | 345 base::Bind(&ChromeMetricsServiceClient::OnInitTaskGotPluginInfo, |
| 352 weak_ptr_factory_.GetWeakPtr()); | 346 weak_ptr_factory_.GetWeakPtr()); |
| 353 | 347 |
| 354 #if defined(ENABLE_PLUGINS) | 348 #if defined(ENABLE_PLUGINS) |
| 355 plugin_metrics_provider_->GetPluginInformation(got_plugin_info_callback); | 349 plugin_metrics_provider_->GetPluginInformation(got_plugin_info_callback); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 // Capture the histogram samples. | 547 // Capture the histogram samples. |
| 554 if (dumps_with_crash != 0) | 548 if (dumps_with_crash != 0) |
| 555 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); | 549 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); |
| 556 if (dumps_with_no_crash != 0) | 550 if (dumps_with_no_crash != 0) |
| 557 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); | 551 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); |
| 558 int total_dumps = dumps_with_crash + dumps_with_no_crash; | 552 int total_dumps = dumps_with_crash + dumps_with_no_crash; |
| 559 if (total_dumps != 0) | 553 if (total_dumps != 0) |
| 560 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); | 554 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); |
| 561 } | 555 } |
| 562 #endif // defined(OS_WIN) | 556 #endif // defined(OS_WIN) |
| OLD | NEW |