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

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

Issue 2095593003: Revert of Move memory-infra check from background tracing and whitelist memory dump args (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@enabled_modes
Patch Set: Created 4 years, 6 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/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"
11 #include "base/trace_event/memory_dump_manager.h"
12 11
13 namespace { 12 namespace {
14 13
15 struct WhitelistEntry { 14 struct WhitelistEntry {
16 const char* category_name; 15 const char* category_name;
17 const char* event_name; 16 const char* event_name;
18 const char* const* arg_name_filter; 17 const char* const* arg_name_filter;
19 }; 18 };
20 19
21 const char* const kInputLatencyAllowedArgs[] = {"data", nullptr}; 20 const char* const kInputLatencyAllowedArgs[] = {"data", nullptr};
22 const char* const kMemoryDumpAllowedArgs[] = {"dumps", nullptr};
23 21
24 const WhitelistEntry kEventArgsWhitelist[] = { 22 const WhitelistEntry kEventArgsWhitelist[] = {
25 {"__metadata", "thread_name", nullptr}, 23 {"__metadata", "thread_name", nullptr},
26 {"ipc", "SyncChannel::Send", nullptr}, 24 {"ipc", "SyncChannel::Send", nullptr},
27 {"toplevel", "*", nullptr}, 25 {"toplevel", "*", nullptr},
28 {"latencyInfo", "*", kInputLatencyAllowedArgs}, 26 {"latencyInfo", "*", kInputLatencyAllowedArgs},
29 {base::trace_event::MemoryDumpManager::kTraceCategory, "*",
30 kMemoryDumpAllowedArgs},
31 {nullptr, nullptr, nullptr}}; 27 {nullptr, nullptr, nullptr}};
32 28
33 const char* kMetadataWhitelist[] = { 29 const char* kMetadataWhitelist[] = {
34 "clock-domain", 30 "clock-domain",
35 "command_line", 31 "command_line",
36 "config", 32 "config",
37 "cpu-*", 33 "cpu-*",
38 "field-trials", 34 "field-trials",
39 "gpu-*", 35 "gpu-*",
40 "highres-ticks", 36 "highres-ticks",
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 84 }
89 85
90 bool IsMetadataWhitelisted(const std::string& metadata_name) { 86 bool IsMetadataWhitelisted(const std::string& metadata_name) {
91 for (auto key : kMetadataWhitelist) { 87 for (auto key : kMetadataWhitelist) {
92 if (base::MatchPattern(metadata_name, key)) { 88 if (base::MatchPattern(metadata_name, key)) {
93 return true; 89 return true;
94 } 90 }
95 } 91 }
96 return false; 92 return false;
97 } 93 }
OLDNEW
« no previous file with comments | « base/trace_event/memory_dump_manager.cc ('k') | content/browser/tracing/background_tracing_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698