Chromium Code Reviews| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 tracked_object->set_process_id(process_id); | 69 tracked_object->set_process_id(process_id); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace | 73 } // namespace |
| 74 | 74 |
| 75 ProfilerMetricsProvider::ProfilerMetricsProvider() { | 75 ProfilerMetricsProvider::ProfilerMetricsProvider() { |
| 76 } | 76 } |
| 77 | 77 |
| 78 ProfilerMetricsProvider::ProfilerMetricsProvider( | 78 ProfilerMetricsProvider::ProfilerMetricsProvider( |
| 79 const base::Callback<bool(void)>& cellular_callback) | 79 const base::Callback<void(bool*)>& cellular_callback) |
| 80 : cellular_callback_(cellular_callback) { | 80 : cellular_callback_(cellular_callback) {} |
| 81 } | |
| 82 | 81 |
| 83 ProfilerMetricsProvider::~ProfilerMetricsProvider() { | 82 ProfilerMetricsProvider::~ProfilerMetricsProvider() { |
| 84 } | 83 } |
| 85 | 84 |
| 86 void ProfilerMetricsProvider::ProvideGeneralMetrics( | 85 void ProfilerMetricsProvider::ProvideGeneralMetrics( |
| 87 ChromeUserMetricsExtension* uma_proto) { | 86 ChromeUserMetricsExtension* uma_proto) { |
| 88 DCHECK_EQ(0, uma_proto->profiler_event_size()); | 87 DCHECK_EQ(0, uma_proto->profiler_event_size()); |
| 89 | 88 |
| 90 for (auto& event : profiler_events_cache_) { | 89 for (auto& event : profiler_events_cache_) { |
| 91 uma_proto->add_profiler_event()->Swap(&event.second); | 90 uma_proto->add_profiler_event()->Swap(&event.second); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 119 for (const auto& event : past_events) { | 118 for (const auto& event : past_events) { |
| 120 profiler_event->add_past_session_event(event); | 119 profiler_event->add_past_session_event(event); |
| 121 } | 120 } |
| 122 } | 121 } |
| 123 | 122 |
| 124 WriteProfilerData(process_data_phase, process_id, process_type, | 123 WriteProfilerData(process_data_phase, process_id, process_type, |
| 125 profiler_event); | 124 profiler_event); |
| 126 } | 125 } |
| 127 | 126 |
| 128 bool ProfilerMetricsProvider::IsCellularLogicEnabled() { | 127 bool ProfilerMetricsProvider::IsCellularLogicEnabled() { |
| 129 if (cellular_callback_.is_null()) | 128 bool is_cellular_enabled = false; |
| 130 return false; | 129 if (!cellular_callback_.is_null()) { |
|
Alexei Svitkine (slow)
2016/03/29 16:29:11
Nit: No {}'s for 1-liner ifs.
gayane -on leave until 09-2017
2016/03/31 01:38:24
Done.
| |
| 131 | 130 cellular_callback_.Run(&is_cellular_enabled); |
| 132 return cellular_callback_.Run(); | 131 } |
| 132 return is_cellular_enabled; | |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace metrics | 135 } // namespace metrics |
| OLD | NEW |