| 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/subprocess_metrics_provider.h" |
| 26 #include "chrome/browser/metrics/time_ticks_experiment_win.h" | 27 #include "chrome/browser/metrics/time_ticks_experiment_win.h" |
| 27 #include "chrome/browser/ui/browser_otr_state.h" | 28 #include "chrome/browser/ui/browser_otr_state.h" |
| 28 #include "chrome/common/channel_info.h" | 29 #include "chrome/common/channel_info.h" |
| 29 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 30 #include "chrome/common/chrome_paths.h" | 31 #include "chrome/common/chrome_paths.h" |
| 31 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/common/crash_keys.h" | 33 #include "chrome/common/crash_keys.h" |
| 33 #include "chrome/common/features.h" | 34 #include "chrome/common/features.h" |
| 34 #include "chrome/installer/util/util_constants.h" | 35 #include "chrome/installer/util/util_constants.h" |
| 35 #include "components/metrics/call_stack_profile_metrics_provider.h" | 36 #include "components/metrics/call_stack_profile_metrics_provider.h" |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 // metrics service so that metrics log manager is initialized correctly. | 336 // metrics service so that metrics log manager is initialized correctly. |
| 336 if (ShouldClearSavedMetrics()) { | 337 if (ShouldClearSavedMetrics()) { |
| 337 PrefService* local_state = g_browser_process->local_state(); | 338 PrefService* local_state = g_browser_process->local_state(); |
| 338 local_state->ClearPref(metrics::prefs::kMetricsInitialLogs); | 339 local_state->ClearPref(metrics::prefs::kMetricsInitialLogs); |
| 339 local_state->ClearPref(metrics::prefs::kMetricsOngoingLogs); | 340 local_state->ClearPref(metrics::prefs::kMetricsOngoingLogs); |
| 340 } | 341 } |
| 341 | 342 |
| 342 metrics_service_.reset(new metrics::MetricsService( | 343 metrics_service_.reset(new metrics::MetricsService( |
| 343 metrics_state_manager_, this, g_browser_process->local_state())); | 344 metrics_state_manager_, this, g_browser_process->local_state())); |
| 344 | 345 |
| 346 // Gets access to persistent metrics shared by sub-processes. |
| 347 metrics_service_->RegisterMetricsProvider( |
| 348 scoped_ptr<metrics::MetricsProvider>( |
| 349 new metrics::SubprocessMetricsProvider())); |
| 350 |
| 345 // Register metrics providers. | 351 // Register metrics providers. |
| 346 #if defined(ENABLE_EXTENSIONS) | 352 #if defined(ENABLE_EXTENSIONS) |
| 347 metrics_service_->RegisterMetricsProvider( | 353 metrics_service_->RegisterMetricsProvider( |
| 348 scoped_ptr<metrics::MetricsProvider>( | 354 scoped_ptr<metrics::MetricsProvider>( |
| 349 new ExtensionsMetricsProvider(metrics_state_manager_))); | 355 new ExtensionsMetricsProvider(metrics_state_manager_))); |
| 350 #endif | 356 #endif |
| 351 metrics_service_->RegisterMetricsProvider( | 357 metrics_service_->RegisterMetricsProvider( |
| 352 scoped_ptr<metrics::MetricsProvider>(new metrics::NetworkMetricsProvider( | 358 scoped_ptr<metrics::MetricsProvider>(new metrics::NetworkMetricsProvider( |
| 353 content::BrowserThread::GetBlockingPool()))); | 359 content::BrowserThread::GetBlockingPool()))); |
| 354 | 360 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 break; | 663 break; |
| 658 | 664 |
| 659 default: | 665 default: |
| 660 NOTREACHED(); | 666 NOTREACHED(); |
| 661 } | 667 } |
| 662 } | 668 } |
| 663 | 669 |
| 664 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { | 670 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { |
| 665 metrics_service_->OnApplicationNotIdle(); | 671 metrics_service_->OnApplicationNotIdle(); |
| 666 } | 672 } |
| OLD | NEW |