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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
19 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
20 #include "base/threading/platform_thread.h" | 20 #include "base/threading/platform_thread.h" |
21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
24 #include "chrome/browser/google/google_brand.h" | 24 #include "chrome/browser/google/google_brand.h" |
25 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" | 25 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" |
26 #include "chrome/browser/metrics/metrics_reporting_state.h" | 26 #include "chrome/browser/metrics/metrics_reporting_state.h" |
| 27 #include "chrome/browser/metrics/subprocess_metrics_provider.h" |
27 #include "chrome/browser/metrics/time_ticks_experiment_win.h" | 28 #include "chrome/browser/metrics/time_ticks_experiment_win.h" |
28 #include "chrome/browser/sync/chrome_sync_client.h" | 29 #include "chrome/browser/sync/chrome_sync_client.h" |
29 #include "chrome/browser/ui/browser_otr_state.h" | 30 #include "chrome/browser/ui/browser_otr_state.h" |
30 #include "chrome/common/channel_info.h" | 31 #include "chrome/common/channel_info.h" |
31 #include "chrome/common/chrome_constants.h" | 32 #include "chrome/common/chrome_constants.h" |
32 #include "chrome/common/chrome_paths.h" | 33 #include "chrome/common/chrome_paths.h" |
33 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/crash_keys.h" | 35 #include "chrome/common/crash_keys.h" |
35 #include "chrome/common/features.h" | 36 #include "chrome/common/features.h" |
36 #include "chrome/installer/util/util_constants.h" | 37 #include "chrome/installer/util/util_constants.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 // metrics service so that metrics log manager is initialized correctly. | 351 // metrics service so that metrics log manager is initialized correctly. |
351 if (ShouldClearSavedMetrics()) { | 352 if (ShouldClearSavedMetrics()) { |
352 PrefService* local_state = g_browser_process->local_state(); | 353 PrefService* local_state = g_browser_process->local_state(); |
353 local_state->ClearPref(metrics::prefs::kMetricsInitialLogs); | 354 local_state->ClearPref(metrics::prefs::kMetricsInitialLogs); |
354 local_state->ClearPref(metrics::prefs::kMetricsOngoingLogs); | 355 local_state->ClearPref(metrics::prefs::kMetricsOngoingLogs); |
355 } | 356 } |
356 | 357 |
357 metrics_service_.reset(new metrics::MetricsService( | 358 metrics_service_.reset(new metrics::MetricsService( |
358 metrics_state_manager_, this, g_browser_process->local_state())); | 359 metrics_state_manager_, this, g_browser_process->local_state())); |
359 | 360 |
| 361 // Gets access to persistent metrics shared by sub-processes. |
| 362 metrics_service_->RegisterMetricsProvider( |
| 363 scoped_ptr<metrics::MetricsProvider>(new SubprocessMetricsProvider())); |
| 364 |
360 // Register metrics providers. | 365 // Register metrics providers. |
361 #if defined(ENABLE_EXTENSIONS) | 366 #if defined(ENABLE_EXTENSIONS) |
362 metrics_service_->RegisterMetricsProvider( | 367 metrics_service_->RegisterMetricsProvider( |
363 scoped_ptr<metrics::MetricsProvider>( | 368 scoped_ptr<metrics::MetricsProvider>( |
364 new ExtensionsMetricsProvider(metrics_state_manager_))); | 369 new ExtensionsMetricsProvider(metrics_state_manager_))); |
365 #endif | 370 #endif |
366 metrics_service_->RegisterMetricsProvider( | 371 metrics_service_->RegisterMetricsProvider( |
367 scoped_ptr<metrics::MetricsProvider>(new metrics::NetworkMetricsProvider( | 372 scoped_ptr<metrics::MetricsProvider>(new metrics::NetworkMetricsProvider( |
368 content::BrowserThread::GetBlockingPool()))); | 373 content::BrowserThread::GetBlockingPool()))); |
369 | 374 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 } | 686 } |
682 } | 687 } |
683 | 688 |
684 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { | 689 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { |
685 metrics_service_->OnApplicationNotIdle(); | 690 metrics_service_->OnApplicationNotIdle(); |
686 } | 691 } |
687 | 692 |
688 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { | 693 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { |
689 return IsCellularLogicEnabled(); | 694 return IsCellularLogicEnabled(); |
690 } | 695 } |
OLD | NEW |