| 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 "components/metrics/profiler/profiler_metrics_provider.h" | 5 #include "components/metrics/profiler/profiler_metrics_provider.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // Returns true if the user is assigned to the experiment group for enabled | 110 // Returns true if the user is assigned to the experiment group for enabled |
| 111 // cellular uploads. | 111 // cellular uploads. |
| 112 bool IsCellularEnabledByExperiment() { | 112 bool IsCellularEnabledByExperiment() { |
| 113 const std::string group_name = | 113 const std::string group_name = |
| 114 base::FieldTrialList::FindFullName("UMA_EnableCellularLogUpload"); | 114 base::FieldTrialList::FindFullName("UMA_EnableCellularLogUpload"); |
| 115 return group_name == "Enabled"; | 115 return group_name == "Enabled"; |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace | 118 } // namespace |
| 119 | 119 |
| 120 ProfilerMetricsProvider::ProfilerMetricsProvider() : has_profiler_data_(false) { |
| 121 } |
| 122 |
| 120 ProfilerMetricsProvider::ProfilerMetricsProvider( | 123 ProfilerMetricsProvider::ProfilerMetricsProvider( |
| 121 const base::Callback<void(bool*)>& cellular_callback) | 124 const base::Callback<void(bool*)>& cellular_callback) |
| 122 : has_profiler_data_(false), cellular_callback_(cellular_callback) { | 125 : has_profiler_data_(false), cellular_callback_(cellular_callback) { |
| 123 } | 126 } |
| 124 | 127 |
| 125 ProfilerMetricsProvider::~ProfilerMetricsProvider() { | 128 ProfilerMetricsProvider::~ProfilerMetricsProvider() { |
| 126 } | 129 } |
| 127 | 130 |
| 128 void ProfilerMetricsProvider::ProvideGeneralMetrics( | 131 void ProfilerMetricsProvider::ProvideGeneralMetrics( |
| 129 ChromeUserMetricsExtension* uma_proto) { | 132 ChromeUserMetricsExtension* uma_proto) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 151 } | 154 } |
| 152 | 155 |
| 153 has_profiler_data_ = true; | 156 has_profiler_data_ = true; |
| 154 profiler_event_cache_.set_profile_type(ProfilerEventProto::STARTUP_PROFILE); | 157 profiler_event_cache_.set_profile_type(ProfilerEventProto::STARTUP_PROFILE); |
| 155 profiler_event_cache_.set_time_source(ProfilerEventProto::WALL_CLOCK_TIME); | 158 profiler_event_cache_.set_time_source(ProfilerEventProto::WALL_CLOCK_TIME); |
| 156 WriteProfilerData(process_data, process_type, &profiler_event_cache_); | 159 WriteProfilerData(process_data, process_type, &profiler_event_cache_); |
| 157 } | 160 } |
| 158 | 161 |
| 159 bool ProfilerMetricsProvider::IsCellularConnection() { | 162 bool ProfilerMetricsProvider::IsCellularConnection() { |
| 160 bool is_cellular = false; | 163 bool is_cellular = false; |
| 161 // For android get current connection type from NetworkMetricsProvider. | 164 // For android get current connection type from NetworkMetricsProvider if the |
| 165 // callback exists. |
| 162 #if defined(OS_ANDROID) | 166 #if defined(OS_ANDROID) |
| 163 if (!cellular_callback_.is_null()) | 167 if (!cellular_callback_.is_null()) |
| 164 cellular_callback_.Run(&is_cellular); | 168 cellular_callback_.Run(&is_cellular); |
| 165 #endif | 169 #endif |
| 166 return is_cellular; | 170 return is_cellular; |
| 167 } | 171 } |
| 168 | 172 |
| 169 } // namespace metrics | 173 } // namespace metrics |
| OLD | NEW |