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 <memory> | 10 #include <memory> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <unordered_set> | 13 #include <unordered_set> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/base_export.h" | 16 #include "base/base_export.h" |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/strings/string_piece.h" | 18 #include "base/strings/string_piece.h" |
19 #include "base/trace_event/memory_dump_request_args.h" | 19 #include "base/trace_event/memory_dump_request_args.h" |
| 20 #include "base/trace_event/trace_event_filter.h" |
20 #include "base/values.h" | 21 #include "base/values.h" |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 namespace trace_event { | 24 namespace trace_event { |
24 | 25 |
25 class ConvertableToTraceFormat; | 26 class ConvertableToTraceFormat; |
26 | 27 |
27 // Options determines how the trace buffer stores data. | 28 // Options determines how the trace buffer stores data. |
28 enum TraceRecordMode { | 29 enum TraceRecordMode { |
29 // Record until the trace buffer is full. | 30 // Record until the trace buffer is full. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 78 |
78 // Set of memory dump modes allowed for the tracing session. The explicitly | 79 // Set of memory dump modes allowed for the tracing session. The explicitly |
79 // triggered dumps will be successful only if the dump mode is allowed in | 80 // triggered dumps will be successful only if the dump mode is allowed in |
80 // the config. | 81 // the config. |
81 std::set<MemoryDumpLevelOfDetail> allowed_dump_modes; | 82 std::set<MemoryDumpLevelOfDetail> allowed_dump_modes; |
82 | 83 |
83 std::vector<Trigger> triggers; | 84 std::vector<Trigger> triggers; |
84 HeapProfiler heap_profiler_options; | 85 HeapProfiler heap_profiler_options; |
85 }; | 86 }; |
86 | 87 |
87 class EventFilterConfig { | 88 class EventFilterConfig : public TraceEventFilter::Config { |
88 public: | 89 public: |
89 EventFilterConfig(const std::string& predicate_name); | 90 EventFilterConfig(const std::string& predicate_name); |
90 EventFilterConfig(const EventFilterConfig& tc); | 91 EventFilterConfig(const EventFilterConfig& tc); |
91 | 92 |
92 ~EventFilterConfig(); | 93 ~EventFilterConfig() override; |
93 | 94 |
94 EventFilterConfig& operator=(const EventFilterConfig& rhs); | 95 EventFilterConfig& operator=(const EventFilterConfig& rhs); |
95 | 96 |
96 void AddIncludedCategory(const std::string& category); | 97 void AddIncludedCategory(const std::string& category); |
97 void AddExcludedCategory(const std::string& category); | 98 void AddExcludedCategory(const std::string& category); |
98 void SetArgs(std::unique_ptr<base::DictionaryValue> args); | 99 void SetArgs(std::unique_ptr<base::DictionaryValue> args); |
99 bool GetArgAsSet(const char* key, std::unordered_set<std::string>*) const; | 100 bool GetArgAsSet(const char* key, std::unordered_set<std::string>*) const; |
100 | 101 |
101 bool IsCategoryGroupEnabled(const char* category_group_name) const; | 102 bool IsCategoryGroupEnabled(const char* category_group_name) const; |
102 | 103 |
103 const std::string& predicate_name() const { return predicate_name_; } | 104 const std::string& predicate_name() const { return predicate_name_; } |
104 base::DictionaryValue* filter_args() const { return args_.get(); } | 105 base::DictionaryValue* filter_args() const { return args_.get(); } |
105 const StringList& included_categories() const { | 106 const StringList& included_categories() const { |
106 return included_categories_; | 107 return included_categories_; |
107 } | 108 } |
108 const StringList& excluded_categories() const { | 109 const StringList& excluded_categories() const { |
109 return excluded_categories_; | 110 return excluded_categories_; |
110 } | 111 } |
111 | 112 |
| 113 // TraceEventFilter::CategoryConfig implementation. |
| 114 bool IsEnabledForCategory(const char* category_name) const override; |
| 115 |
112 private: | 116 private: |
113 std::string predicate_name_; | 117 std::string predicate_name_; |
114 StringList included_categories_; | 118 StringList included_categories_; |
115 StringList excluded_categories_; | 119 StringList excluded_categories_; |
116 std::unique_ptr<base::DictionaryValue> args_; | 120 std::unique_ptr<base::DictionaryValue> args_; |
117 }; | 121 }; |
118 typedef std::vector<EventFilterConfig> EventFilters; | 122 typedef std::vector<EventFilterConfig> EventFilters; |
119 | 123 |
120 TraceConfig(); | 124 TraceConfig(); |
121 | 125 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 StringList disabled_categories_; | 324 StringList disabled_categories_; |
321 StringList excluded_categories_; | 325 StringList excluded_categories_; |
322 StringList synthetic_delays_; | 326 StringList synthetic_delays_; |
323 EventFilters event_filters_; | 327 EventFilters event_filters_; |
324 }; | 328 }; |
325 | 329 |
326 } // namespace trace_event | 330 } // namespace trace_event |
327 } // namespace base | 331 } // namespace base |
328 | 332 |
329 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ | 333 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ |
OLD | NEW |