Chromium Code Reviews| Index: base/trace_event/trace_config.h |
| diff --git a/base/trace_event/trace_config.h b/base/trace_event/trace_config.h |
| index a9f830656203502852ba1ca25b77554bc1867220..8e964ad2d18b7237c3707379a1856c04b1777db4 100644 |
| --- a/base/trace_event/trace_config.h |
| +++ b/base/trace_event/trace_config.h |
| @@ -10,6 +10,7 @@ |
| #include "base/base_export.h" |
| #include "base/gtest_prod_util.h" |
| +#include "base/trace_event/memory_dump_provider.h" |
| #include "base/values.h" |
| namespace base { |
| @@ -35,6 +36,15 @@ class BASE_EXPORT TraceConfig { |
| public: |
| typedef std::vector<std::string> StringList; |
| + // Specifies the memory dump config for tracing. Used only when |
| + // "memory-infra" category is enabled. |
| + struct MemoryDumpTriggerConfig { |
| + uint32 periodic_interval_ms; |
| + MemoryDumpArgs::LevelOfDetail level_of_detail; |
| + }; |
| + |
| + typedef std::vector<MemoryDumpTriggerConfig> MemoryDumpConfig; |
| + |
| TraceConfig(); |
| // Create TraceConfig object from category filter and trace options strings. |
| @@ -99,9 +109,17 @@ class BASE_EXPORT TraceConfig { |
| // "enable_argument_filter": true, |
| // "included_categories": ["included", |
| // "inc_pattern*", |
| - // "disabled-by-default-category1"], |
| + // "disabled-by-default-memory-infra"], |
|
Zhen Wang
2015/08/24 18:38:24
disabled-by-default-memory-infra must be specified
ssid
2015/08/24 19:48:10
Done.
|
| // "excluded_categories": ["excluded", "exc_pattern*"], |
| // "synthetic_delays": ["test.Delay1;16", "test.Delay2;32"] |
| + // "memory_dump_config": { |
| + // "triggers": [ |
| + // { |
| + // "level_of_detail": "high", |
| + // "periodic_interval_ms": 2000 |
| + // } |
| + // ] |
| + // } |
| // } |
| explicit TraceConfig(const std::string& config_string); |
| @@ -140,6 +158,10 @@ class BASE_EXPORT TraceConfig { |
| void Clear(); |
| + const MemoryDumpConfig& memory_dump_config() const { |
| + return memory_dump_config_; |
| + } |
| + |
| private: |
| FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidLegacyFormat); |
| FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, |
| @@ -149,6 +171,8 @@ class BASE_EXPORT TraceConfig { |
| FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromInvalidString); |
| FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, |
| IsEmptyOrContainsLeadingOrTrailingWhitespace); |
| + FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString); |
| + FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, InvalidMemoryConfigString); |
| // The default trace config, used when none is provided. |
| // Allows all non-disabled-by-default categories through, except if they end |
| @@ -169,6 +193,8 @@ class BASE_EXPORT TraceConfig { |
| const char* param, |
| const StringList& categories) const; |
| + void SetMemoryDumpConfig(const base::DictionaryValue& memory_dump_config); |
| + |
| // Convert TraceConfig to the dict representation of the TraceConfig. |
| void ToDict(base::DictionaryValue& dict) const; |
| @@ -193,6 +219,8 @@ class BASE_EXPORT TraceConfig { |
| bool enable_systrace_ : 1; |
| bool enable_argument_filter_ : 1; |
| + MemoryDumpConfig memory_dump_config_; |
| + |
| StringList included_categories_; |
| StringList disabled_categories_; |
| StringList excluded_categories_; |