Convert remoting_unittests to run exclusively on Swarming
[chromium-blink-merge.git] / chrome / common / trace_event_args_whitelist.cc
blobcf1b4a98cd679c8a30d14834f00f3493155cd16f
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/string_tokenizer.h"
8 #include "base/strings/string_util.h"
10 namespace {
12 const char* const kEventArgsWhitelist[][2] = {{"toplevel", "*"},
13 {"__metadata", "thread_name"},
14 {NULL, NULL}};
16 } // namespace
18 bool IsTraceEventArgsWhitelisted(const char* category_group_name,
19 const char* event_name) {
20 base::CStringTokenizer category_group_tokens(
21 category_group_name, category_group_name + strlen(category_group_name),
22 ",");
23 while (category_group_tokens.GetNext()) {
24 const std::string& category_group_token = category_group_tokens.token();
25 for (int i = 0; kEventArgsWhitelist[i][0] != NULL; ++i) {
26 DCHECK(kEventArgsWhitelist[i][1]);
28 if (MatchPattern(category_group_token.c_str(),
29 kEventArgsWhitelist[i][0]) &&
30 MatchPattern(event_name, kEventArgsWhitelist[i][1])) {
31 return true;
36 return false;