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