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/files/file_util.h" | 15 #include "base/files/file_util.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
18 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
19 #include "base/metrics/persistent_histogram_allocator.h" | 19 #include "base/metrics/persistent_histogram_allocator.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/rand_util.h" | 21 #include "base/rand_util.h" |
22 #include "base/strings/string16.h" | 22 #include "base/strings/string16.h" |
23 #include "base/threading/platform_thread.h" | 23 #include "base/threading/platform_thread.h" |
| 24 #include "base/threading/thread_task_runner_handle.h" |
24 #include "build/build_config.h" | 25 #include "build/build_config.h" |
25 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
26 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
27 #include "chrome/browser/google/google_brand.h" | 28 #include "chrome/browser/google/google_brand.h" |
28 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 29 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
29 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" | 30 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" |
30 #include "chrome/browser/metrics/https_engagement_metrics_provider.h" | 31 #include "chrome/browser/metrics/https_engagement_metrics_provider.h" |
31 #include "chrome/browser/metrics/metrics_reporting_state.h" | 32 #include "chrome/browser/metrics/metrics_reporting_state.h" |
32 #include "chrome/browser/metrics/sampling_metrics_provider.h" | 33 #include "chrome/browser/metrics/sampling_metrics_provider.h" |
33 #include "chrome/browser/metrics/subprocess_metrics_provider.h" | 34 #include "chrome/browser/metrics/subprocess_metrics_provider.h" |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 content::BrowserThread::PostTaskAndReply( | 737 content::BrowserThread::PostTaskAndReply( |
737 content::BrowserThread::UI, | 738 content::BrowserThread::UI, |
738 FROM_HERE, | 739 FROM_HERE, |
739 base::Bind(&ChromeMetricsServiceClient::MergeHistogramDeltas, | 740 base::Bind(&ChromeMetricsServiceClient::MergeHistogramDeltas, |
740 weak_ptr_factory_.GetWeakPtr()), | 741 weak_ptr_factory_.GetWeakPtr()), |
741 callback); | 742 callback); |
742 | 743 |
743 // Set up the callback task to call after we receive histograms from all | 744 // Set up the callback task to call after we receive histograms from all |
744 // child processes. |timeout| specifies how long to wait before absolutely | 745 // child processes. |timeout| specifies how long to wait before absolutely |
745 // calling us back on the task. | 746 // calling us back on the task. |
746 content::FetchHistogramsAsynchronously(base::MessageLoop::current(), callback, | 747 content::FetchHistogramsAsynchronously(base::ThreadTaskRunnerHandle::Get(), |
747 timeout); | 748 callback, timeout); |
748 } | 749 } |
749 | 750 |
750 void ChromeMetricsServiceClient::OnHistogramSynchronizationDone() { | 751 void ChromeMetricsServiceClient::OnHistogramSynchronizationDone() { |
751 DCHECK(thread_checker_.CalledOnValidThread()); | 752 DCHECK(thread_checker_.CalledOnValidThread()); |
752 | 753 |
753 // This function should only be called as the callback from an ansynchronous | 754 // This function should only be called as the callback from an ansynchronous |
754 // step. | 755 // step. |
755 DCHECK(waiting_for_collect_final_metrics_step_); | 756 DCHECK(waiting_for_collect_final_metrics_step_); |
756 DCHECK_GT(num_async_histogram_fetches_in_progress_, 0); | 757 DCHECK_GT(num_async_histogram_fetches_in_progress_, 0); |
757 | 758 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 } | 833 } |
833 } | 834 } |
834 | 835 |
835 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { | 836 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { |
836 metrics_service_->OnApplicationNotIdle(); | 837 metrics_service_->OnApplicationNotIdle(); |
837 } | 838 } |
838 | 839 |
839 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { | 840 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { |
840 return metrics::IsCellularLogicEnabled(); | 841 return metrics::IsCellularLogicEnabled(); |
841 } | 842 } |
OLD | NEW |