| 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 #include "chrome/common/trace_event_args_whitelist.h" | 5 #include "chrome/common/trace_event_args_whitelist.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/pattern.h" | 8 #include "base/strings/pattern.h" |
| 9 #include "base/strings/string_tokenizer.h" | 9 #include "base/strings/string_tokenizer.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 DCHECK(arg_name_filter); | 68 DCHECK(arg_name_filter); |
| 69 base::CStringTokenizer category_group_tokens( | 69 base::CStringTokenizer category_group_tokens( |
| 70 category_group_name, category_group_name + strlen(category_group_name), | 70 category_group_name, category_group_name + strlen(category_group_name), |
| 71 ","); | 71 ","); |
| 72 while (category_group_tokens.GetNext()) { | 72 while (category_group_tokens.GetNext()) { |
| 73 const std::string& category_group_token = category_group_tokens.token(); | 73 const std::string& category_group_token = category_group_tokens.token(); |
| 74 for (int i = 0; kEventArgsWhitelist[i].category_name != nullptr; ++i) { | 74 for (int i = 0; kEventArgsWhitelist[i].category_name != nullptr; ++i) { |
| 75 const WhitelistEntry& whitelist_entry = kEventArgsWhitelist[i]; | 75 const WhitelistEntry& whitelist_entry = kEventArgsWhitelist[i]; |
| 76 DCHECK(whitelist_entry.event_name); | 76 DCHECK(whitelist_entry.event_name); |
| 77 | 77 |
| 78 if (base::MatchPattern(category_group_token.c_str(), | 78 if (base::MatchPattern(category_group_token, |
| 79 whitelist_entry.category_name) && | 79 whitelist_entry.category_name) && |
| 80 base::MatchPattern(event_name, whitelist_entry.event_name)) { | 80 base::MatchPattern(event_name, whitelist_entry.event_name)) { |
| 81 if (whitelist_entry.arg_name_filter) { | 81 if (whitelist_entry.arg_name_filter) { |
| 82 *arg_name_filter = base::Bind(&IsTraceArgumentNameWhitelisted, | 82 *arg_name_filter = base::Bind(&IsTraceArgumentNameWhitelisted, |
| 83 whitelist_entry.arg_name_filter); | 83 whitelist_entry.arg_name_filter); |
| 84 } | 84 } |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 return false; | 90 return false; |
| 91 } | 91 } |
| 92 | 92 |
| 93 bool IsMetadataWhitelisted(const std::string& metadata_name) { | 93 bool IsMetadataWhitelisted(const std::string& metadata_name) { |
| 94 for (auto* key : kMetadataWhitelist) { | 94 for (auto* key : kMetadataWhitelist) { |
| 95 if (base::MatchPattern(metadata_name, key)) { | 95 if (base::MatchPattern(metadata_name, key)) { |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 return false; | 99 return false; |
| 100 } | 100 } |
| OLD | NEW |