Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/common/trace_event_args_whitelist.cc

Issue 1226673003: Move MatchPattern to its own header and the base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/strings/pattern.h"
7 #include "base/strings/string_tokenizer.h" 8 #include "base/strings/string_tokenizer.h"
8 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
9 10
10 namespace { 11 namespace {
11 12
12 const char* const kEventArgsWhitelist[][2] = {{"toplevel", "*"}, 13 const char* const kEventArgsWhitelist[][2] = {{"toplevel", "*"},
13 {"__metadata", "thread_name"}, 14 {"__metadata", "thread_name"},
14 {NULL, NULL}}; 15 {NULL, NULL}};
15 16
16 } // namespace 17 } // namespace
17 18
18 bool IsTraceEventArgsWhitelisted(const char* category_group_name, 19 bool IsTraceEventArgsWhitelisted(const char* category_group_name,
19 const char* event_name) { 20 const char* event_name) {
20 base::CStringTokenizer category_group_tokens( 21 base::CStringTokenizer category_group_tokens(
21 category_group_name, category_group_name + strlen(category_group_name), 22 category_group_name, category_group_name + strlen(category_group_name),
22 ","); 23 ",");
23 while (category_group_tokens.GetNext()) { 24 while (category_group_tokens.GetNext()) {
24 const std::string& category_group_token = category_group_tokens.token(); 25 const std::string& category_group_token = category_group_tokens.token();
25 for (int i = 0; kEventArgsWhitelist[i][0] != NULL; ++i) { 26 for (int i = 0; kEventArgsWhitelist[i][0] != NULL; ++i) {
26 DCHECK(kEventArgsWhitelist[i][1]); 27 DCHECK(kEventArgsWhitelist[i][1]);
27 28
28 if (MatchPattern(category_group_token.c_str(), 29 if (base::MatchPattern(category_group_token.c_str(),
29 kEventArgsWhitelist[i][0]) && 30 kEventArgsWhitelist[i][0]) &&
30 MatchPattern(event_name, kEventArgsWhitelist[i][1])) { 31 base::MatchPattern(event_name, kEventArgsWhitelist[i][1])) {
31 return true; 32 return true;
32 } 33 }
33 } 34 }
34 } 35 }
35 36
36 return false; 37 return false;
37 } 38 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc ('k') | chrome_elf/elf_imports_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698