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 #ifndef BASE_TRACE_EVENT_TRACE_CONFIG_H_ | 5 #ifndef BASE_TRACE_EVENT_TRACE_CONFIG_H_ |
6 #define BASE_TRACE_EVENT_TRACE_CONFIG_H_ | 6 #define BASE_TRACE_EVENT_TRACE_CONFIG_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // "periodic_interval_ms": 2000 | 123 // "periodic_interval_ms": 2000 |
124 // } | 124 // } |
125 // ] | 125 // ] |
126 // } | 126 // } |
127 // } | 127 // } |
128 // | 128 // |
129 // Note: memory_dump_config can be specified only if | 129 // Note: memory_dump_config can be specified only if |
130 // disabled-by-default-memory-infra category is enabled. | 130 // disabled-by-default-memory-infra category is enabled. |
131 explicit TraceConfig(const std::string& config_string); | 131 explicit TraceConfig(const std::string& config_string); |
132 | 132 |
| 133 // Functionally identical to the above, but takes a parsed dictionary as input |
| 134 // instead of its JSON serialization. |
| 135 explicit TraceConfig(const DictionaryValue& config); |
| 136 |
133 TraceConfig(const TraceConfig& tc); | 137 TraceConfig(const TraceConfig& tc); |
134 | 138 |
135 ~TraceConfig(); | 139 ~TraceConfig(); |
136 | 140 |
137 TraceConfig& operator=(const TraceConfig& rhs); | 141 TraceConfig& operator=(const TraceConfig& rhs); |
138 | 142 |
139 // Return a list of the synthetic delays specified in this category filter. | 143 // Return a list of the synthetic delays specified in this category filter. |
140 const StringList& GetSyntheticDelayValues() const; | 144 const StringList& GetSyntheticDelayValues() const; |
141 | 145 |
142 TraceRecordMode GetTraceRecordMode() const { return record_mode_; } | 146 TraceRecordMode GetTraceRecordMode() const { return record_mode_; } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 IsEmptyOrContainsLeadingOrTrailingWhitespace); | 187 IsEmptyOrContainsLeadingOrTrailingWhitespace); |
184 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString); | 188 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString); |
185 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, LegacyStringToMemoryDumpConfig); | 189 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, LegacyStringToMemoryDumpConfig); |
186 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, EmptyMemoryDumpConfigTest); | 190 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, EmptyMemoryDumpConfigTest); |
187 | 191 |
188 // The default trace config, used when none is provided. | 192 // The default trace config, used when none is provided. |
189 // Allows all non-disabled-by-default categories through, except if they end | 193 // Allows all non-disabled-by-default categories through, except if they end |
190 // in the suffix 'Debug' or 'Test'. | 194 // in the suffix 'Debug' or 'Test'. |
191 void InitializeDefault(); | 195 void InitializeDefault(); |
192 | 196 |
193 // Initialize from the config string | 197 // Initialize from a config dictionary. |
| 198 void InitializeFromConfigDict(const DictionaryValue& dict); |
| 199 |
| 200 // Initialize from a config string. |
194 void InitializeFromConfigString(const std::string& config_string); | 201 void InitializeFromConfigString(const std::string& config_string); |
195 | 202 |
196 // Initialize from category filter and trace options strings | 203 // Initialize from category filter and trace options strings |
197 void InitializeFromStrings(const std::string& category_filter_string, | 204 void InitializeFromStrings(const std::string& category_filter_string, |
198 const std::string& trace_options_string); | 205 const std::string& trace_options_string); |
199 | 206 |
200 void SetCategoriesFromIncludedList(const base::ListValue& included_list); | 207 void SetCategoriesFromIncludedList(const base::ListValue& included_list); |
201 void SetCategoriesFromExcludedList(const base::ListValue& excluded_list); | 208 void SetCategoriesFromExcludedList(const base::ListValue& excluded_list); |
202 void SetSyntheticDelaysFromList(const base::ListValue& list); | 209 void SetSyntheticDelaysFromList(const base::ListValue& list); |
203 void AddCategoryToDict(base::DictionaryValue& dict, | 210 void AddCategoryToDict(base::DictionaryValue& dict, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 StringList included_categories_; | 243 StringList included_categories_; |
237 StringList disabled_categories_; | 244 StringList disabled_categories_; |
238 StringList excluded_categories_; | 245 StringList excluded_categories_; |
239 StringList synthetic_delays_; | 246 StringList synthetic_delays_; |
240 }; | 247 }; |
241 | 248 |
242 } // namespace trace_event | 249 } // namespace trace_event |
243 } // namespace base | 250 } // namespace base |
244 | 251 |
245 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ | 252 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ |
OLD | NEW |