Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: content/browser/tracing/background_tracing_config_impl.cc

Issue 1423133007: Background tracing: Added preset category for blink_style (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/values.h" 6 #include "base/values.h"
7 #include "content/browser/tracing/background_tracing_config_impl.h" 7 #include "content/browser/tracing/background_tracing_config_impl.h"
8 #include "content/browser/tracing/background_tracing_rule.h" 8 #include "content/browser/tracing/background_tracing_rule.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 namespace { 12 namespace {
13 13
14 const char kConfigsKey[] = "configs"; 14 const char kConfigsKey[] = "configs";
15 15
16 const char kConfigModeKey[] = "mode"; 16 const char kConfigModeKey[] = "mode";
17 const char kConfigModePreemptive[] = "PREEMPTIVE_TRACING_MODE"; 17 const char kConfigModePreemptive[] = "PREEMPTIVE_TRACING_MODE";
18 const char kConfigModeReactive[] = "REACTIVE_TRACING_MODE"; 18 const char kConfigModeReactive[] = "REACTIVE_TRACING_MODE";
19 19
20 const char kConfigCategoryKey[] = "category"; 20 const char kConfigCategoryKey[] = "category";
21 const char kConfigCategoryBenchmark[] = "BENCHMARK"; 21 const char kConfigCategoryBenchmark[] = "BENCHMARK";
22 const char kConfigCategoryBenchmarkDeep[] = "BENCHMARK_DEEP"; 22 const char kConfigCategoryBenchmarkDeep[] = "BENCHMARK_DEEP";
23 const char kConfigCategoryBenchmarkGPU[] = "BENCHMARK_GPU"; 23 const char kConfigCategoryBenchmarkGPU[] = "BENCHMARK_GPU";
24 const char kConfigCategoryBenchmarkIPC[] = "BENCHMARK_IPC"; 24 const char kConfigCategoryBenchmarkIPC[] = "BENCHMARK_IPC";
25 const char kConfigCategoryBenchmarkStartup[] = "BENCHMARK_STARTUP"; 25 const char kConfigCategoryBenchmarkStartup[] = "BENCHMARK_STARTUP";
26 const char kConfigCategoryBlinkStyle[] = "BLINK_STYLE";
26 27
27 } // namespace 28 } // namespace
28 29
29 BackgroundTracingConfigImpl::BackgroundTracingConfigImpl( 30 BackgroundTracingConfigImpl::BackgroundTracingConfigImpl(
30 TracingMode tracing_mode) 31 TracingMode tracing_mode)
31 : BackgroundTracingConfig(tracing_mode), 32 : BackgroundTracingConfig(tracing_mode),
32 category_preset_(BackgroundTracingConfigImpl::BENCHMARK) {} 33 category_preset_(BackgroundTracingConfigImpl::BENCHMARK) {}
33 34
34 BackgroundTracingConfigImpl::~BackgroundTracingConfigImpl() {} 35 BackgroundTracingConfigImpl::~BackgroundTracingConfigImpl() {}
35 36
36 std::string BackgroundTracingConfigImpl::CategoryPresetToString( 37 std::string BackgroundTracingConfigImpl::CategoryPresetToString(
37 BackgroundTracingConfigImpl::CategoryPreset category_preset) { 38 BackgroundTracingConfigImpl::CategoryPreset category_preset) {
38 switch (category_preset) { 39 switch (category_preset) {
39 case BackgroundTracingConfigImpl::BENCHMARK: 40 case BackgroundTracingConfigImpl::BENCHMARK:
40 return kConfigCategoryBenchmark; 41 return kConfigCategoryBenchmark;
41 case BackgroundTracingConfigImpl::BENCHMARK_DEEP: 42 case BackgroundTracingConfigImpl::BENCHMARK_DEEP:
42 return kConfigCategoryBenchmarkDeep; 43 return kConfigCategoryBenchmarkDeep;
43 case BackgroundTracingConfigImpl::BENCHMARK_GPU: 44 case BackgroundTracingConfigImpl::BENCHMARK_GPU:
44 return kConfigCategoryBenchmarkGPU; 45 return kConfigCategoryBenchmarkGPU;
45 case BackgroundTracingConfigImpl::BENCHMARK_IPC: 46 case BackgroundTracingConfigImpl::BENCHMARK_IPC:
46 return kConfigCategoryBenchmarkIPC; 47 return kConfigCategoryBenchmarkIPC;
47 case BackgroundTracingConfigImpl::BENCHMARK_STARTUP: 48 case BackgroundTracingConfigImpl::BENCHMARK_STARTUP:
48 return kConfigCategoryBenchmarkStartup; 49 return kConfigCategoryBenchmarkStartup;
50 case BackgroundTracingConfigImpl::BLINK_STYLE:
51 return kConfigCategoryBlinkStyle;
49 } 52 }
50 NOTREACHED(); 53 NOTREACHED();
51 return ""; 54 return "";
52 } 55 }
53 56
54 bool BackgroundTracingConfigImpl::StringToCategoryPreset( 57 bool BackgroundTracingConfigImpl::StringToCategoryPreset(
55 const std::string& category_preset_string, 58 const std::string& category_preset_string,
56 BackgroundTracingConfigImpl::CategoryPreset* category_preset) { 59 BackgroundTracingConfigImpl::CategoryPreset* category_preset) {
57 if (category_preset_string == kConfigCategoryBenchmark) { 60 if (category_preset_string == kConfigCategoryBenchmark) {
58 *category_preset = BackgroundTracingConfigImpl::BENCHMARK; 61 *category_preset = BackgroundTracingConfigImpl::BENCHMARK;
(...skipping 13 matching lines...) Expand all
72 if (category_preset_string == kConfigCategoryBenchmarkIPC) { 75 if (category_preset_string == kConfigCategoryBenchmarkIPC) {
73 *category_preset = BackgroundTracingConfigImpl::BENCHMARK_IPC; 76 *category_preset = BackgroundTracingConfigImpl::BENCHMARK_IPC;
74 return true; 77 return true;
75 } 78 }
76 79
77 if (category_preset_string == kConfigCategoryBenchmarkStartup) { 80 if (category_preset_string == kConfigCategoryBenchmarkStartup) {
78 *category_preset = BackgroundTracingConfigImpl::BENCHMARK_STARTUP; 81 *category_preset = BackgroundTracingConfigImpl::BENCHMARK_STARTUP;
79 return true; 82 return true;
80 } 83 }
81 84
85 if (category_preset_string == kConfigCategoryBlinkStyle) {
86 *category_preset = BackgroundTracingConfigImpl::BLINK_STYLE;
87 return true;
88 }
89
82 return false; 90 return false;
83 } 91 }
84 92
85 void BackgroundTracingConfigImpl::IntoDict(base::DictionaryValue* dict) const { 93 void BackgroundTracingConfigImpl::IntoDict(base::DictionaryValue* dict) const {
86 switch (tracing_mode()) { 94 switch (tracing_mode()) {
87 case BackgroundTracingConfigImpl::PREEMPTIVE: 95 case BackgroundTracingConfigImpl::PREEMPTIVE:
88 dict->SetString(kConfigModeKey, kConfigModePreemptive); 96 dict->SetString(kConfigModeKey, kConfigModePreemptive);
89 dict->SetString(kConfigCategoryKey, 97 dict->SetString(kConfigCategoryKey,
90 CategoryPresetToString(category_preset_)); 98 CategoryPresetToString(category_preset_));
91 break; 99 break;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 config->AddReactiveRule(config_dict, new_category_preset); 213 config->AddReactiveRule(config_dict, new_category_preset);
206 } 214 }
207 215
208 if (config->rules().empty()) 216 if (config->rules().empty())
209 return nullptr; 217 return nullptr;
210 218
211 return config.Pass(); 219 return config.Pass();
212 } 220 }
213 221
214 } // namspace content 222 } // namspace content
OLDNEW
« no previous file with comments | « content/browser/tracing/background_tracing_config_impl.h ('k') | content/browser/tracing/background_tracing_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698