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

Unified Diff: chrome/common/trace_event_args_whitelist.cc

Issue 1115343002: Added a whitelist for trace events that are known to be PII-less. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fixes Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/trace_event_args_whitelist.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/trace_event_args_whitelist.cc
diff --git a/chrome/common/trace_event_args_whitelist.cc b/chrome/common/trace_event_args_whitelist.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cf1b4a98cd679c8a30d14834f00f3493155cd16f
--- /dev/null
+++ b/chrome/common/trace_event_args_whitelist.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/trace_event_args_whitelist.h"
+
+#include "base/strings/string_tokenizer.h"
+#include "base/strings/string_util.h"
+
+namespace {
+
+const char* const kEventArgsWhitelist[][2] = {{"toplevel", "*"},
dsinclair 2015/06/01 14:56:09 Do these get matched as exact matches or just cont
+ {"__metadata", "thread_name"},
+ {NULL, NULL}};
+
+} // namespace
+
+bool IsTraceEventArgsWhitelisted(const char* category_group_name,
+ const char* event_name) {
+ base::CStringTokenizer category_group_tokens(
+ category_group_name, category_group_name + strlen(category_group_name),
+ ",");
+ while (category_group_tokens.GetNext()) {
+ const std::string& category_group_token = category_group_tokens.token();
+ for (int i = 0; kEventArgsWhitelist[i][0] != NULL; ++i) {
+ DCHECK(kEventArgsWhitelist[i][1]);
+
+ if (MatchPattern(category_group_token.c_str(),
+ kEventArgsWhitelist[i][0]) &&
+ MatchPattern(event_name, kEventArgsWhitelist[i][1])) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
« no previous file with comments | « chrome/common/trace_event_args_whitelist.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698