OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "base/trace_event/trace_config.h" | 5 #include "base/trace_event/trace_config.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 return false; | 179 return false; |
180 for (size_t i = 0; i < list->GetSize(); ++i) { | 180 for (size_t i = 0; i < list->GetSize(); ++i) { |
181 std::string value; | 181 std::string value; |
182 if (list->GetString(i, &value)) | 182 if (list->GetString(i, &value)) |
183 out_set->insert(value); | 183 out_set->insert(value); |
184 } | 184 } |
185 return true; | 185 return true; |
186 } | 186 } |
187 | 187 |
188 bool TraceConfig::EventFilterConfig::IsCategoryGroupEnabled( | 188 bool TraceConfig::EventFilterConfig::IsCategoryGroupEnabled( |
189 const char* category_group_name) const { | 189 const StringPiece& category_group_name) const { |
190 return category_filter_.IsCategoryGroupEnabled(category_group_name); | 190 return category_filter_.IsCategoryGroupEnabled(category_group_name); |
191 } | 191 } |
192 | 192 |
193 TraceConfig::TraceConfig() { | 193 TraceConfig::TraceConfig() { |
194 InitializeDefault(); | 194 InitializeDefault(); |
195 } | 195 } |
196 | 196 |
197 TraceConfig::TraceConfig(StringPiece category_filter_string, | 197 TraceConfig::TraceConfig(StringPiece category_filter_string, |
198 StringPiece trace_options_string) { | 198 StringPiece trace_options_string) { |
199 InitializeFromStrings(category_filter_string, trace_options_string); | 199 InitializeFromStrings(category_filter_string, trace_options_string); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 std::unique_ptr<ConvertableToTraceFormat> | 270 std::unique_ptr<ConvertableToTraceFormat> |
271 TraceConfig::AsConvertableToTraceFormat() const { | 271 TraceConfig::AsConvertableToTraceFormat() const { |
272 return MakeUnique<ConvertableTraceConfigToTraceFormat>(*this); | 272 return MakeUnique<ConvertableTraceConfigToTraceFormat>(*this); |
273 } | 273 } |
274 | 274 |
275 std::string TraceConfig::ToCategoryFilterString() const { | 275 std::string TraceConfig::ToCategoryFilterString() const { |
276 return category_filter_.ToFilterString(); | 276 return category_filter_.ToFilterString(); |
277 } | 277 } |
278 | 278 |
279 bool TraceConfig::IsCategoryGroupEnabled( | 279 bool TraceConfig::IsCategoryGroupEnabled( |
280 const char* category_group_name) const { | 280 const StringPiece& category_group_name) const { |
281 // TraceLog should call this method only as part of enabling/disabling | 281 // TraceLog should call this method only as part of enabling/disabling |
282 // categories. | 282 // categories. |
283 return category_filter_.IsCategoryGroupEnabled(category_group_name); | 283 return category_filter_.IsCategoryGroupEnabled(category_group_name); |
284 } | 284 } |
285 | 285 |
286 void TraceConfig::Merge(const TraceConfig& config) { | 286 void TraceConfig::Merge(const TraceConfig& config) { |
287 if (record_mode_ != config.record_mode_ | 287 if (record_mode_ != config.record_mode_ |
288 || enable_systrace_ != config.enable_systrace_ | 288 || enable_systrace_ != config.enable_systrace_ |
289 || enable_argument_filter_ != config.enable_argument_filter_) { | 289 || enable_argument_filter_ != config.enable_argument_filter_) { |
290 DLOG(ERROR) << "Attempting to merge trace config with a different " | 290 DLOG(ERROR) << "Attempting to merge trace config with a different " |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 } | 583 } |
584 if (enable_systrace_) | 584 if (enable_systrace_) |
585 ret = ret + "," + kEnableSystrace; | 585 ret = ret + "," + kEnableSystrace; |
586 if (enable_argument_filter_) | 586 if (enable_argument_filter_) |
587 ret = ret + "," + kEnableArgumentFilter; | 587 ret = ret + "," + kEnableArgumentFilter; |
588 return ret; | 588 return ret; |
589 } | 589 } |
590 | 590 |
591 } // namespace trace_event | 591 } // namespace trace_event |
592 } // namespace base | 592 } // namespace base |
OLD | NEW |