| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  162 void TraceConfig::EventFilterConfig::AddExcludedCategory( |  162 void TraceConfig::EventFilterConfig::AddExcludedCategory( | 
|  163     const std::string& category) { |  163     const std::string& category) { | 
|  164   excluded_categories_.push_back(category); |  164   excluded_categories_.push_back(category); | 
|  165 } |  165 } | 
|  166  |  166  | 
|  167 void TraceConfig::EventFilterConfig::SetArgs( |  167 void TraceConfig::EventFilterConfig::SetArgs( | 
|  168     std::unique_ptr<base::DictionaryValue> args) { |  168     std::unique_ptr<base::DictionaryValue> args) { | 
|  169   args_ = std::move(args); |  169   args_ = std::move(args); | 
|  170 } |  170 } | 
|  171  |  171  | 
 |  172 bool TraceConfig::EventFilterConfig::GetArgAsSet( | 
 |  173     const char* key, | 
 |  174     std::unordered_set<std::string>* out_set) const { | 
 |  175   const ListValue* list = nullptr; | 
 |  176   if (!args_->GetList(key, &list)) | 
 |  177     return false; | 
 |  178   for (size_t i = 0; i < list->GetSize(); ++i) { | 
 |  179     std::string value; | 
 |  180     if (list->GetString(i, &value)) | 
 |  181       out_set->insert(value); | 
 |  182   } | 
 |  183   return true; | 
 |  184 } | 
 |  185  | 
|  172 bool TraceConfig::EventFilterConfig::IsCategoryGroupEnabled( |  186 bool TraceConfig::EventFilterConfig::IsCategoryGroupEnabled( | 
|  173     const char* category_group_name) const { |  187     const char* category_group_name) const { | 
|  174   CStringTokenizer category_group_tokens( |  188   CStringTokenizer category_group_tokens( | 
|  175       category_group_name, category_group_name + strlen(category_group_name), |  189       category_group_name, category_group_name + strlen(category_group_name), | 
|  176       ","); |  190       ","); | 
|  177   while (category_group_tokens.GetNext()) { |  191   while (category_group_tokens.GetNext()) { | 
|  178     std::string category_group_token = category_group_tokens.token(); |  192     std::string category_group_token = category_group_tokens.token(); | 
|  179  |  193  | 
|  180     for (const auto& excluded_category : excluded_categories_) { |  194     for (const auto& excluded_category : excluded_categories_) { | 
|  181       if (base::MatchPattern(category_group_token, excluded_category)) { |  195       if (base::MatchPattern(category_group_token, excluded_category)) { | 
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  849     StringPiece str) { |  863     StringPiece str) { | 
|  850   return str.empty() || str.front() == ' ' || str.back() == ' '; |  864   return str.empty() || str.front() == ' ' || str.back() == ' '; | 
|  851 } |  865 } | 
|  852  |  866  | 
|  853 bool TraceConfig::HasIncludedPatterns() const { |  867 bool TraceConfig::HasIncludedPatterns() const { | 
|  854   return !included_categories_.empty(); |  868   return !included_categories_.empty(); | 
|  855 } |  869 } | 
|  856  |  870  | 
|  857 }  // namespace trace_event |  871 }  // namespace trace_event | 
|  858 }  // namespace base |  872 }  // namespace base | 
| OLD | NEW |