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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/prefs/pref_registry_simple.h" | 15 #include "base/prefs/pref_registry_simple.h" |
16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
17 #include "base/rand_util.h" | 17 #include "base/rand_util.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "base/threading/platform_thread.h" | 19 #include "base/threading/platform_thread.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
22 #include "chrome/browser/google/google_brand.h" | 22 #include "chrome/browser/google/google_brand.h" |
| 23 #include "chrome/browser/metrics/chrome_setup_metrics_provider.h" |
23 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" | 24 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" |
24 #include "chrome/browser/metrics/time_ticks_experiment_win.h" | 25 #include "chrome/browser/metrics/time_ticks_experiment_win.h" |
25 #include "chrome/browser/ui/browser_otr_state.h" | 26 #include "chrome/browser/ui/browser_otr_state.h" |
26 #include "chrome/common/channel_info.h" | 27 #include "chrome/common/channel_info.h" |
27 #include "chrome/common/chrome_constants.h" | 28 #include "chrome/common/chrome_constants.h" |
28 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
29 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/crash_keys.h" | 31 #include "chrome/common/crash_keys.h" |
31 #include "chrome/common/features.h" | 32 #include "chrome/common/features.h" |
32 #include "components/metrics/call_stack_profile_metrics_provider.h" | 33 #include "components/metrics/call_stack_profile_metrics_provider.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 scoped_ptr<metrics::MetricsProvider>(new metrics::NetworkMetricsProvider( | 314 scoped_ptr<metrics::MetricsProvider>(new metrics::NetworkMetricsProvider( |
314 content::BrowserThread::GetBlockingPool()))); | 315 content::BrowserThread::GetBlockingPool()))); |
315 | 316 |
316 // Currently, we configure OmniboxMetricsProvider to not log events to UMA | 317 // Currently, we configure OmniboxMetricsProvider to not log events to UMA |
317 // if there is a single incognito session visible. In the future, it may | 318 // if there is a single incognito session visible. In the future, it may |
318 // be worth revisiting this to still log events from non-incognito sessions. | 319 // be worth revisiting this to still log events from non-incognito sessions. |
319 metrics_service_->RegisterMetricsProvider( | 320 metrics_service_->RegisterMetricsProvider( |
320 scoped_ptr<metrics::MetricsProvider>(new OmniboxMetricsProvider( | 321 scoped_ptr<metrics::MetricsProvider>(new OmniboxMetricsProvider( |
321 base::Bind(&chrome::IsOffTheRecordSessionActive)))); | 322 base::Bind(&chrome::IsOffTheRecordSessionActive)))); |
322 metrics_service_->RegisterMetricsProvider( | 323 metrics_service_->RegisterMetricsProvider( |
| 324 scoped_ptr<metrics::MetricsProvider>(new ChromeSetupMetricsProvider( |
| 325 metrics_service_.get(), |
| 326 g_browser_process->local_state()))); |
| 327 metrics_service_->RegisterMetricsProvider( |
323 scoped_ptr<metrics::MetricsProvider>(new ChromeStabilityMetricsProvider( | 328 scoped_ptr<metrics::MetricsProvider>(new ChromeStabilityMetricsProvider( |
324 g_browser_process->local_state()))); | 329 g_browser_process->local_state()))); |
325 metrics_service_->RegisterMetricsProvider( | 330 metrics_service_->RegisterMetricsProvider( |
326 scoped_ptr<metrics::MetricsProvider>(new metrics::GPUMetricsProvider)); | 331 scoped_ptr<metrics::MetricsProvider>(new metrics::GPUMetricsProvider)); |
327 metrics_service_->RegisterMetricsProvider( | 332 metrics_service_->RegisterMetricsProvider( |
328 scoped_ptr<metrics::MetricsProvider>( | 333 scoped_ptr<metrics::MetricsProvider>( |
329 new metrics::ScreenInfoMetricsProvider)); | 334 new metrics::ScreenInfoMetricsProvider)); |
330 | 335 |
331 drive_metrics_provider_ = new metrics::DriveMetricsProvider( | 336 drive_metrics_provider_ = new metrics::DriveMetricsProvider( |
332 content::BrowserThread::GetMessageLoopProxyForThread( | 337 content::BrowserThread::GetMessageLoopProxyForThread( |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 if (!ServiceProcessControl::GetInstance()->GetHistograms(callback, timeout)) { | 514 if (!ServiceProcessControl::GetInstance()->GetHistograms(callback, timeout)) { |
510 // Assume |num_async_histogram_fetches_in_progress_| is not changed by | 515 // Assume |num_async_histogram_fetches_in_progress_| is not changed by |
511 // |GetHistograms()|. | 516 // |GetHistograms()|. |
512 DCHECK_EQ(num_async_histogram_fetches_in_progress_, 2); | 517 DCHECK_EQ(num_async_histogram_fetches_in_progress_, 2); |
513 // Assign |num_async_histogram_fetches_in_progress_| above and decrement it | 518 // Assign |num_async_histogram_fetches_in_progress_| above and decrement it |
514 // here to make code work even if |GetHistograms()| fired |callback|. | 519 // here to make code work even if |GetHistograms()| fired |callback|. |
515 --num_async_histogram_fetches_in_progress_; | 520 --num_async_histogram_fetches_in_progress_; |
516 } | 521 } |
517 #endif // !ENABLE_PRINT_PREVIEW | 522 #endif // !ENABLE_PRINT_PREVIEW |
518 | 523 |
519 // Set up the callback to task to call after we receive histograms from all | 524 // Set up the callback task to call after we receive histograms from all |
520 // child processes. |timeout| specifies how long to wait before absolutely | 525 // child processes. |timeout| specifies how long to wait before absolutely |
521 // calling us back on the task. | 526 // calling us back on the task. |
522 content::FetchHistogramsAsynchronously(base::MessageLoop::current(), callback, | 527 content::FetchHistogramsAsynchronously(base::MessageLoop::current(), callback, |
523 timeout); | 528 timeout); |
524 } | 529 } |
525 | 530 |
526 void ChromeMetricsServiceClient::OnHistogramSynchronizationDone() { | 531 void ChromeMetricsServiceClient::OnHistogramSynchronizationDone() { |
527 DCHECK(thread_checker_.CalledOnValidThread()); | 532 DCHECK(thread_checker_.CalledOnValidThread()); |
528 | 533 |
529 // This function should only be called as the callback from an ansynchronous | 534 // This function should only be called as the callback from an ansynchronous |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 break; | 609 break; |
605 | 610 |
606 default: | 611 default: |
607 NOTREACHED(); | 612 NOTREACHED(); |
608 } | 613 } |
609 } | 614 } |
610 | 615 |
611 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { | 616 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { |
612 metrics_service_->OnApplicationNotIdle(); | 617 metrics_service_->OnApplicationNotIdle(); |
613 } | 618 } |
OLD | NEW |