| 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 24 matching lines...) Expand all Loading... |
| 35 // Echo to console. Events are discarded. | 35 // Echo to console. Events are discarded. |
| 36 ECHO_TO_CONSOLE, | 36 ECHO_TO_CONSOLE, |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 class BASE_EXPORT TraceConfig { | 39 class BASE_EXPORT TraceConfig { |
| 40 public: | 40 public: |
| 41 typedef std::vector<std::string> StringList; | 41 typedef std::vector<std::string> StringList; |
| 42 | 42 |
| 43 // Specifies the memory dump config for tracing. | 43 // Specifies the memory dump config for tracing. |
| 44 // Used only when "memory-infra" category is enabled. | 44 // Used only when "memory-infra" category is enabled. |
| 45 struct MemoryDumpConfig { | 45 struct BASE_EXPORT MemoryDumpConfig { |
| 46 MemoryDumpConfig(); | 46 MemoryDumpConfig(); |
| 47 MemoryDumpConfig(const MemoryDumpConfig& other); | 47 MemoryDumpConfig(const MemoryDumpConfig& other); |
| 48 ~MemoryDumpConfig(); | 48 ~MemoryDumpConfig(); |
| 49 | 49 |
| 50 // Specifies the triggers in the memory dump config. | 50 // Specifies the triggers in the memory dump config. |
| 51 struct Trigger { | 51 struct Trigger { |
| 52 uint32_t periodic_interval_ms; | 52 uint32_t periodic_interval_ms; |
| 53 MemoryDumpLevelOfDetail level_of_detail; | 53 MemoryDumpLevelOfDetail level_of_detail; |
| 54 }; | 54 }; |
| 55 | 55 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 // Returns true if at least one category in the list is enabled by this | 190 // Returns true if at least one category in the list is enabled by this |
| 191 // trace config. | 191 // trace config. |
| 192 bool IsCategoryGroupEnabled(const char* category_group) const; | 192 bool IsCategoryGroupEnabled(const char* category_group) const; |
| 193 | 193 |
| 194 // Merges config with the current TraceConfig | 194 // Merges config with the current TraceConfig |
| 195 void Merge(const TraceConfig& config); | 195 void Merge(const TraceConfig& config); |
| 196 | 196 |
| 197 void Clear(); | 197 void Clear(); |
| 198 | 198 |
| 199 // Clears and resets the memory dump config. |
| 200 void ResetMemoryDumpConfig(const MemoryDumpConfig& memory_dump_config); |
| 201 |
| 199 const MemoryDumpConfig& memory_dump_config() const { | 202 const MemoryDumpConfig& memory_dump_config() const { |
| 200 return memory_dump_config_; | 203 return memory_dump_config_; |
| 201 } | 204 } |
| 202 | 205 |
| 203 private: | 206 private: |
| 204 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidLegacyFormat); | 207 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidLegacyFormat); |
| 205 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, | 208 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, |
| 206 TraceConfigFromInvalidLegacyStrings); | 209 TraceConfigFromInvalidLegacyStrings); |
| 207 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, ConstructDefaultTraceConfig); | 210 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, ConstructDefaultTraceConfig); |
| 208 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidString); | 211 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidString); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 228 void InitializeFromStrings(const std::string& category_filter_string, | 231 void InitializeFromStrings(const std::string& category_filter_string, |
| 229 const std::string& trace_options_string); | 232 const std::string& trace_options_string); |
| 230 | 233 |
| 231 void SetCategoriesFromIncludedList(const base::ListValue& included_list); | 234 void SetCategoriesFromIncludedList(const base::ListValue& included_list); |
| 232 void SetCategoriesFromExcludedList(const base::ListValue& excluded_list); | 235 void SetCategoriesFromExcludedList(const base::ListValue& excluded_list); |
| 233 void SetSyntheticDelaysFromList(const base::ListValue& list); | 236 void SetSyntheticDelaysFromList(const base::ListValue& list); |
| 234 void AddCategoryToDict(base::DictionaryValue& dict, | 237 void AddCategoryToDict(base::DictionaryValue& dict, |
| 235 const char* param, | 238 const char* param, |
| 236 const StringList& categories) const; | 239 const StringList& categories) const; |
| 237 | 240 |
| 238 void SetMemoryDumpConfig(const base::DictionaryValue& memory_dump_config); | 241 void SetMemoryDumpConfigFromConfigDict( |
| 242 const base::DictionaryValue& memory_dump_config); |
| 239 void SetDefaultMemoryDumpConfig(); | 243 void SetDefaultMemoryDumpConfig(); |
| 240 | 244 |
| 241 // Convert TraceConfig to the dict representation of the TraceConfig. | 245 // Convert TraceConfig to the dict representation of the TraceConfig. |
| 242 void ToDict(base::DictionaryValue& dict) const; | 246 void ToDict(base::DictionaryValue& dict) const; |
| 243 | 247 |
| 244 std::string ToTraceOptionsString() const; | 248 std::string ToTraceOptionsString() const; |
| 245 | 249 |
| 246 void WriteCategoryFilterString(const StringList& values, | 250 void WriteCategoryFilterString(const StringList& values, |
| 247 std::string* out, | 251 std::string* out, |
| 248 bool included) const; | 252 bool included) const; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 267 StringList included_categories_; | 271 StringList included_categories_; |
| 268 StringList disabled_categories_; | 272 StringList disabled_categories_; |
| 269 StringList excluded_categories_; | 273 StringList excluded_categories_; |
| 270 StringList synthetic_delays_; | 274 StringList synthetic_delays_; |
| 271 }; | 275 }; |
| 272 | 276 |
| 273 } // namespace trace_event | 277 } // namespace trace_event |
| 274 } // namespace base | 278 } // namespace base |
| 275 | 279 |
| 276 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ | 280 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ |
| OLD | NEW |