OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/common/trace_event_args_whitelist.h" |
| 6 |
| 7 #include "base/strings/string_tokenizer.h" |
| 8 #include "base/strings/string_util.h" |
| 9 |
| 10 namespace chrome { |
| 11 |
| 12 namespace { |
| 13 |
| 14 const char* const kEventArgsWhitelist[][2] = {{"toplevel", "*"}, |
| 15 {"__metadata", "thread_name"}, |
| 16 {NULL, NULL}}; |
| 17 |
| 18 } // namespace |
| 19 |
| 20 bool IsTraceEventArgsWhitelisted(const char* category_group_name, |
| 21 const char* event_name) { |
| 22 base::CStringTokenizer category_group_tokens( |
| 23 category_group_name, category_group_name + strlen(category_group_name), |
| 24 ","); |
| 25 while (category_group_tokens.GetNext()) { |
| 26 const std::string& category_group_token = category_group_tokens.token(); |
| 27 for (int i = 0; kEventArgsWhitelist[i][0] != NULL; ++i) { |
| 28 DCHECK(kEventArgsWhitelist[i][1]); |
| 29 |
| 30 if (MatchPattern(category_group_token.c_str(), |
| 31 kEventArgsWhitelist[i][0]) && |
| 32 MatchPattern(event_name, kEventArgsWhitelist[i][1])) { |
| 33 return true; |
| 34 } |
| 35 } |
| 36 } |
| 37 |
| 38 return false; |
| 39 } |
| 40 |
| 41 } // namespace chrome |
OLD | NEW |