| 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_config_impl.h" | 5 #include "content/browser/tracing/background_tracing_config_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 const char kConfigScenarioName[] = "scenario_name"; | 23 const char kConfigScenarioName[] = "scenario_name"; |
| 24 const char kConfigEnableBlinkFeatures[] = "enable_blink_features"; | 24 const char kConfigEnableBlinkFeatures[] = "enable_blink_features"; |
| 25 const char kConfigDisableBlinkFeatures[] = "disable_blink_features"; | 25 const char kConfigDisableBlinkFeatures[] = "disable_blink_features"; |
| 26 | 26 |
| 27 const char kConfigCategoryKey[] = "category"; | 27 const char kConfigCategoryKey[] = "category"; |
| 28 const char kConfigCategoryBenchmark[] = "BENCHMARK"; | 28 const char kConfigCategoryBenchmark[] = "BENCHMARK"; |
| 29 const char kConfigCategoryBenchmarkDeep[] = "BENCHMARK_DEEP"; | 29 const char kConfigCategoryBenchmarkDeep[] = "BENCHMARK_DEEP"; |
| 30 const char kConfigCategoryBenchmarkGPU[] = "BENCHMARK_GPU"; | 30 const char kConfigCategoryBenchmarkGPU[] = "BENCHMARK_GPU"; |
| 31 const char kConfigCategoryBenchmarkIPC[] = "BENCHMARK_IPC"; | 31 const char kConfigCategoryBenchmarkIPC[] = "BENCHMARK_IPC"; |
| 32 const char kConfigCategoryBenchmarkStartup[] = "BENCHMARK_STARTUP"; | 32 const char kConfigCategoryBenchmarkStartup[] = "BENCHMARK_STARTUP"; |
| 33 const char kConfigCategoryBenchmarkBlinkGC[] = "BENCHMARK_BLINK_GC"; |
| 33 const char kConfigCategoryBlinkStyle[] = "BLINK_STYLE"; | 34 const char kConfigCategoryBlinkStyle[] = "BLINK_STYLE"; |
| 34 | 35 |
| 35 } // namespace | 36 } // namespace |
| 36 | 37 |
| 37 BackgroundTracingConfigImpl::BackgroundTracingConfigImpl( | 38 BackgroundTracingConfigImpl::BackgroundTracingConfigImpl( |
| 38 TracingMode tracing_mode) | 39 TracingMode tracing_mode) |
| 39 : BackgroundTracingConfig(tracing_mode), | 40 : BackgroundTracingConfig(tracing_mode), |
| 40 category_preset_(BackgroundTracingConfigImpl::BENCHMARK) {} | 41 category_preset_(BackgroundTracingConfigImpl::BENCHMARK) {} |
| 41 | 42 |
| 42 BackgroundTracingConfigImpl::~BackgroundTracingConfigImpl() {} | 43 BackgroundTracingConfigImpl::~BackgroundTracingConfigImpl() {} |
| 43 | 44 |
| 44 std::string BackgroundTracingConfigImpl::CategoryPresetToString( | 45 std::string BackgroundTracingConfigImpl::CategoryPresetToString( |
| 45 BackgroundTracingConfigImpl::CategoryPreset category_preset) { | 46 BackgroundTracingConfigImpl::CategoryPreset category_preset) { |
| 46 switch (category_preset) { | 47 switch (category_preset) { |
| 47 case BackgroundTracingConfigImpl::BENCHMARK: | 48 case BackgroundTracingConfigImpl::BENCHMARK: |
| 48 return kConfigCategoryBenchmark; | 49 return kConfigCategoryBenchmark; |
| 49 case BackgroundTracingConfigImpl::BENCHMARK_DEEP: | 50 case BackgroundTracingConfigImpl::BENCHMARK_DEEP: |
| 50 return kConfigCategoryBenchmarkDeep; | 51 return kConfigCategoryBenchmarkDeep; |
| 51 case BackgroundTracingConfigImpl::BENCHMARK_GPU: | 52 case BackgroundTracingConfigImpl::BENCHMARK_GPU: |
| 52 return kConfigCategoryBenchmarkGPU; | 53 return kConfigCategoryBenchmarkGPU; |
| 53 case BackgroundTracingConfigImpl::BENCHMARK_IPC: | 54 case BackgroundTracingConfigImpl::BENCHMARK_IPC: |
| 54 return kConfigCategoryBenchmarkIPC; | 55 return kConfigCategoryBenchmarkIPC; |
| 55 case BackgroundTracingConfigImpl::BENCHMARK_STARTUP: | 56 case BackgroundTracingConfigImpl::BENCHMARK_STARTUP: |
| 56 return kConfigCategoryBenchmarkStartup; | 57 return kConfigCategoryBenchmarkStartup; |
| 58 case BackgroundTracingConfigImpl::BENCHMARK_BLINK_GC: |
| 59 return kConfigCategoryBenchmarkBlinkGC; |
| 57 case BackgroundTracingConfigImpl::BLINK_STYLE: | 60 case BackgroundTracingConfigImpl::BLINK_STYLE: |
| 58 return kConfigCategoryBlinkStyle; | 61 return kConfigCategoryBlinkStyle; |
| 59 } | 62 } |
| 60 NOTREACHED(); | 63 NOTREACHED(); |
| 61 return ""; | 64 return ""; |
| 62 } | 65 } |
| 63 | 66 |
| 64 bool BackgroundTracingConfigImpl::StringToCategoryPreset( | 67 bool BackgroundTracingConfigImpl::StringToCategoryPreset( |
| 65 const std::string& category_preset_string, | 68 const std::string& category_preset_string, |
| 66 BackgroundTracingConfigImpl::CategoryPreset* category_preset) { | 69 BackgroundTracingConfigImpl::CategoryPreset* category_preset) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 82 if (category_preset_string == kConfigCategoryBenchmarkIPC) { | 85 if (category_preset_string == kConfigCategoryBenchmarkIPC) { |
| 83 *category_preset = BackgroundTracingConfigImpl::BENCHMARK_IPC; | 86 *category_preset = BackgroundTracingConfigImpl::BENCHMARK_IPC; |
| 84 return true; | 87 return true; |
| 85 } | 88 } |
| 86 | 89 |
| 87 if (category_preset_string == kConfigCategoryBenchmarkStartup) { | 90 if (category_preset_string == kConfigCategoryBenchmarkStartup) { |
| 88 *category_preset = BackgroundTracingConfigImpl::BENCHMARK_STARTUP; | 91 *category_preset = BackgroundTracingConfigImpl::BENCHMARK_STARTUP; |
| 89 return true; | 92 return true; |
| 90 } | 93 } |
| 91 | 94 |
| 95 if (category_preset_string == kConfigCategoryBenchmarkBlinkGC) { |
| 96 *category_preset = BackgroundTracingConfigImpl::BENCHMARK_BLINK_GC; |
| 97 return true; |
| 98 } |
| 99 |
| 92 if (category_preset_string == kConfigCategoryBlinkStyle) { | 100 if (category_preset_string == kConfigCategoryBlinkStyle) { |
| 93 *category_preset = BackgroundTracingConfigImpl::BLINK_STYLE; | 101 *category_preset = BackgroundTracingConfigImpl::BLINK_STYLE; |
| 94 return true; | 102 return true; |
| 95 } | 103 } |
| 96 | 104 |
| 97 return false; | 105 return false; |
| 98 } | 106 } |
| 99 | 107 |
| 100 void BackgroundTracingConfigImpl::IntoDict(base::DictionaryValue* dict) const { | 108 void BackgroundTracingConfigImpl::IntoDict(base::DictionaryValue* dict) const { |
| 101 switch (tracing_mode()) { | 109 switch (tracing_mode()) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 config->AddReactiveRule(config_dict, new_category_preset); | 243 config->AddReactiveRule(config_dict, new_category_preset); |
| 236 } | 244 } |
| 237 | 245 |
| 238 if (config->rules().empty()) | 246 if (config->rules().empty()) |
| 239 return nullptr; | 247 return nullptr; |
| 240 | 248 |
| 241 return config; | 249 return config; |
| 242 } | 250 } |
| 243 | 251 |
| 244 } // namspace content | 252 } // namspace content |
| OLD | NEW |