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 // Create TraceConfig object from the trace config dictionary. | |
Primiano Tucci (use gerrit)
2016/03/14 16:53:02
I would probably reword this comment as:
// Functi
Zhen Wang
2016/03/14 21:41:45
Done.
| |
134 explicit TraceConfig(const base::DictionaryValue& config); | |
Primiano Tucci (use gerrit)
2016/03/14 16:53:02
nit: no need of base::, you are already in namespa
Primiano Tucci (use gerrit)
2016/03/14 16:53:02
Since you introduced this, I think you can make a
Primiano Tucci (use gerrit)
2016/03/14 16:53:02
Can we haz a unittest to cover this casE?
I think
Zhen Wang
2016/03/14 21:41:45
Updated trace_config_file.cc and trace_config_unit
| |
135 | |
133 TraceConfig(const TraceConfig& tc); | 136 TraceConfig(const TraceConfig& tc); |
134 | 137 |
135 ~TraceConfig(); | 138 ~TraceConfig(); |
136 | 139 |
137 TraceConfig& operator=(const TraceConfig& rhs); | 140 TraceConfig& operator=(const TraceConfig& rhs); |
138 | 141 |
139 // Return a list of the synthetic delays specified in this category filter. | 142 // Return a list of the synthetic delays specified in this category filter. |
140 const StringList& GetSyntheticDelayValues() const; | 143 const StringList& GetSyntheticDelayValues() const; |
141 | 144 |
142 TraceRecordMode GetTraceRecordMode() const { return record_mode_; } | 145 TraceRecordMode GetTraceRecordMode() const { return record_mode_; } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 IsEmptyOrContainsLeadingOrTrailingWhitespace); | 186 IsEmptyOrContainsLeadingOrTrailingWhitespace); |
184 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString); | 187 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString); |
185 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, LegacyStringToMemoryDumpConfig); | 188 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, LegacyStringToMemoryDumpConfig); |
186 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, EmptyMemoryDumpConfigTest); | 189 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, EmptyMemoryDumpConfigTest); |
187 | 190 |
188 // The default trace config, used when none is provided. | 191 // The default trace config, used when none is provided. |
189 // Allows all non-disabled-by-default categories through, except if they end | 192 // Allows all non-disabled-by-default categories through, except if they end |
190 // in the suffix 'Debug' or 'Test'. | 193 // in the suffix 'Debug' or 'Test'. |
191 void InitializeDefault(); | 194 void InitializeDefault(); |
192 | 195 |
193 // Initialize from the config string | 196 // Initialize from the config dictionary. |
petrcermak
2016/03/14 18:05:09
supernit: s/the/a/
Zhen Wang
2016/03/14 21:41:45
Done.
| |
197 void InitializeFromConfigDict(const base::DictionaryValue& dict); | |
Primiano Tucci (use gerrit)
2016/03/14 16:53:02
nit, ditto: no need of base::
Zhen Wang
2016/03/14 21:41:45
Done.
| |
198 | |
199 // Initialize from the config string. | |
petrcermak
2016/03/14 18:05:09
ditto (s/the/a/)
Zhen Wang
2016/03/14 21:41:45
Done.
| |
194 void InitializeFromConfigString(const std::string& config_string); | 200 void InitializeFromConfigString(const std::string& config_string); |
195 | 201 |
196 // Initialize from category filter and trace options strings | 202 // Initialize from category filter and trace options strings |
197 void InitializeFromStrings(const std::string& category_filter_string, | 203 void InitializeFromStrings(const std::string& category_filter_string, |
198 const std::string& trace_options_string); | 204 const std::string& trace_options_string); |
199 | 205 |
200 void SetCategoriesFromIncludedList(const base::ListValue& included_list); | 206 void SetCategoriesFromIncludedList(const base::ListValue& included_list); |
201 void SetCategoriesFromExcludedList(const base::ListValue& excluded_list); | 207 void SetCategoriesFromExcludedList(const base::ListValue& excluded_list); |
202 void SetSyntheticDelaysFromList(const base::ListValue& list); | 208 void SetSyntheticDelaysFromList(const base::ListValue& list); |
203 void AddCategoryToDict(base::DictionaryValue& dict, | 209 void AddCategoryToDict(base::DictionaryValue& dict, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 StringList included_categories_; | 242 StringList included_categories_; |
237 StringList disabled_categories_; | 243 StringList disabled_categories_; |
238 StringList excluded_categories_; | 244 StringList excluded_categories_; |
239 StringList synthetic_delays_; | 245 StringList synthetic_delays_; |
240 }; | 246 }; |
241 | 247 |
242 } // namespace trace_event | 248 } // namespace trace_event |
243 } // namespace base | 249 } // namespace base |
244 | 250 |
245 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ | 251 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ |
OLD | NEW |