OLD | NEW |
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/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 struct WhitelistEntry { | 15 struct WhitelistEntry { |
16 const char* category_name; | 16 const char* category_name; |
17 const char* event_name; | 17 const char* event_name; |
18 const char* const* arg_name_filter; | 18 const char* const* arg_name_filter; |
19 }; | 19 }; |
20 | 20 |
21 const char* const kInputLatencyAllowedArgs[] = {"data", nullptr}; | 21 const char* const kInputLatencyAllowedArgs[] = {"data", nullptr}; |
22 const char* const kMemoryDumpAllowedArgs[] = {"dumps", nullptr}; | 22 const char* const kMemoryDumpAllowedArgs[] = {"dumps", nullptr}; |
23 | 23 |
24 const WhitelistEntry kEventArgsWhitelist[] = { | 24 const WhitelistEntry kEventArgsWhitelist[] = { |
25 {"__metadata", "thread_name", nullptr}, | 25 {"__metadata", "thread_name", nullptr}, |
26 {"__metadata", "process_name", nullptr}, | 26 {"__metadata", "process_name", nullptr}, |
| 27 {"__metadata", "process_runtime_sec", nullptr}, |
27 {"ipc", "SyncChannel::Send", nullptr}, | 28 {"ipc", "SyncChannel::Send", nullptr}, |
28 {"toplevel", "*", nullptr}, | 29 {"toplevel", "*", nullptr}, |
29 {"latencyInfo", "*", kInputLatencyAllowedArgs}, | 30 {"latencyInfo", "*", kInputLatencyAllowedArgs}, |
30 // Redefined the string since MemoryDumpManager::kTraceCategory causes | 31 // Redefined the string since MemoryDumpManager::kTraceCategory causes |
31 // static initialization of this struct. | 32 // static initialization of this struct. |
32 {TRACE_DISABLED_BY_DEFAULT("memory-infra"), "*", kMemoryDumpAllowedArgs}, | 33 {TRACE_DISABLED_BY_DEFAULT("memory-infra"), "*", kMemoryDumpAllowedArgs}, |
33 {nullptr, nullptr, nullptr}}; | 34 {nullptr, nullptr, nullptr}}; |
34 | 35 |
35 const char* kMetadataWhitelist[] = { | 36 const char* kMetadataWhitelist[] = { |
36 "clock-domain", | 37 "clock-domain", |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 91 } |
91 | 92 |
92 bool IsMetadataWhitelisted(const std::string& metadata_name) { | 93 bool IsMetadataWhitelisted(const std::string& metadata_name) { |
93 for (auto* key : kMetadataWhitelist) { | 94 for (auto* key : kMetadataWhitelist) { |
94 if (base::MatchPattern(metadata_name, key)) { | 95 if (base::MatchPattern(metadata_name, key)) { |
95 return true; | 96 return true; |
96 } | 97 } |
97 } | 98 } |
98 return false; | 99 return false; |
99 } | 100 } |
OLD | NEW |