Don't compile save_password_infobar_delegate.cc everywhere but Mac and Android
[chromium-blink-merge.git] / chrome / common / trace_event_args_whitelist.cc
blob77bb5ccec4ad136531281c661b2637c1572650e8
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.
5 #include "chrome/common/trace_event_args_whitelist.h"
7 #include "base/strings/pattern.h"
8 #include "base/strings/string_tokenizer.h"
9 #include "base/strings/string_util.h"
11 namespace {
13 const char* const kEventArgsWhitelist[][2] = {{"toplevel", "*"},
14 {"__metadata", "thread_name"},
15 {NULL, NULL}};
17 } // namespace
19 bool IsTraceEventArgsWhitelisted(const char* category_group_name,
20 const char* event_name) {
21 base::CStringTokenizer category_group_tokens(
22 category_group_name, category_group_name + strlen(category_group_name),
23 ",");
24 while (category_group_tokens.GetNext()) {
25 const std::string& category_group_token = category_group_tokens.token();
26 for (int i = 0; kEventArgsWhitelist[i][0] != NULL; ++i) {
27 DCHECK(kEventArgsWhitelist[i][1]);
29 if (base::MatchPattern(category_group_token.c_str(),
30 kEventArgsWhitelist[i][0]) &&
31 base::MatchPattern(event_name, kEventArgsWhitelist[i][1])) {
32 return true;
37 return false;