OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/tracing/background_tracing_manager_impl.h" | 5 #include "content/browser/tracing/background_tracing_manager_impl.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/metrics/statistics_recorder.h" | 10 #include "base/metrics/statistics_recorder.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 idle_callback_ = idle_callback; | 131 idle_callback_ = idle_callback; |
132 } | 132 } |
133 | 133 |
134 bool BackgroundTracingManagerImpl::IsSupportedConfig( | 134 bool BackgroundTracingManagerImpl::IsSupportedConfig( |
135 BackgroundTracingConfig* config) { | 135 BackgroundTracingConfig* config) { |
136 // No config is just fine, we just don't do anything. | 136 // No config is just fine, we just don't do anything. |
137 if (!config) | 137 if (!config) |
138 return true; | 138 return true; |
139 | 139 |
140 if (config->mode == BackgroundTracingConfig::PREEMPTIVE_TRACING_MODE) { | 140 if (config->mode == BackgroundTracingConfig::PREEMPTIVE_TRACING_MODE) { |
141 BackgroundTracingPreemptiveConfig* preemptive_config = | 141 for (const auto& preemptive_config : |
142 static_cast<BackgroundTracingPreemptiveConfig*>(config); | 142 static_cast<BackgroundTracingPreemptiveConfig*>(config)->configs) { |
143 for (const auto& config : preemptive_config->configs) { | 143 if (preemptive_config.type == BackgroundTracingPreemptiveConfig:: |
144 if (config.type == BackgroundTracingPreemptiveConfig:: | 144 MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED || |
145 MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED || | 145 preemptive_config.type == |
146 config.type == | |
147 BackgroundTracingPreemptiveConfig:: | 146 BackgroundTracingPreemptiveConfig:: |
148 MONITOR_AND_DUMP_WHEN_SPECIFIC_HISTOGRAM_AND_VALUE) { | 147 MONITOR_AND_DUMP_WHEN_SPECIFIC_HISTOGRAM_AND_VALUE) { |
149 continue; | 148 continue; |
150 } | 149 } |
151 return false; | 150 return false; |
152 } | 151 } |
153 } | 152 } |
154 | 153 |
155 if (config->mode == BackgroundTracingConfig::REACTIVE_TRACING_MODE) { | 154 if (config->mode == BackgroundTracingConfig::REACTIVE_TRACING_MODE) { |
156 BackgroundTracingReactiveConfig* reactive_config = | 155 for (const auto& reactive_config : |
157 static_cast<BackgroundTracingReactiveConfig*>(config); | 156 static_cast<BackgroundTracingReactiveConfig*>(config)->configs) { |
158 for (const auto& config : reactive_config->configs) { | 157 if (reactive_config.type != |
159 if (config.type != | |
160 BackgroundTracingReactiveConfig::TRACE_FOR_10S_OR_TRIGGER_OR_FULL) | 158 BackgroundTracingReactiveConfig::TRACE_FOR_10S_OR_TRIGGER_OR_FULL) |
161 return false; | 159 return false; |
162 } | 160 } |
163 } | 161 } |
164 | 162 |
165 return true; | 163 return true; |
166 } | 164 } |
167 | 165 |
168 void BackgroundTracingManagerImpl::SetupUMACallbacks( | 166 void BackgroundTracingManagerImpl::SetupUMACallbacks( |
169 BackgroundTracingManagerImpl::SetupUMACallMode mode) { | 167 BackgroundTracingManagerImpl::SetupUMACallMode mode) { |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 case BackgroundTracingConfig::CategoryPreset::BENCHMARK: | 611 case BackgroundTracingConfig::CategoryPreset::BENCHMARK: |
614 return "benchmark,toplevel"; | 612 return "benchmark,toplevel"; |
615 case BackgroundTracingConfig::CategoryPreset::BENCHMARK_DEEP: | 613 case BackgroundTracingConfig::CategoryPreset::BENCHMARK_DEEP: |
616 return "*,disabled-by-default-benchmark.detailed"; | 614 return "*,disabled-by-default-benchmark.detailed"; |
617 } | 615 } |
618 NOTREACHED(); | 616 NOTREACHED(); |
619 return ""; | 617 return ""; |
620 } | 618 } |
621 | 619 |
622 } // namspace content | 620 } // namspace content |
OLD | NEW |