Chromium Code Reviews| 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 | 12 |
| 12 namespace { | 13 namespace { |
| 13 | 14 |
| 14 struct WhitelistEntry { | 15 struct WhitelistEntry { |
| 15 const char* category_name; | 16 const char* category_name; |
| 16 const char* event_name; | 17 const char* event_name; |
| 17 const char* const* arg_name_filter; | 18 const char* const* arg_name_filter; |
| 18 }; | 19 }; |
| 19 | 20 |
| 20 const char* const kInputLatencyAllowedArgs[] = {"data", nullptr}; | 21 const char* const kInputLatencyAllowedArgs[] = {"data", nullptr}; |
| 22 const char* const kMemoryDumpAllowedArgs[] = {"dumps", nullptr}; | |
| 21 | 23 |
| 22 const WhitelistEntry kEventArgsWhitelist[] = { | 24 const WhitelistEntry kEventArgsWhitelist[] = { |
| 23 {"__metadata", "thread_name", nullptr}, | 25 {"__metadata", "thread_name", nullptr}, |
| 24 {"ipc", "SyncChannel::Send", nullptr}, | 26 {"ipc", "SyncChannel::Send", nullptr}, |
| 25 {"toplevel", "*", nullptr}, | 27 {"toplevel", "*", nullptr}, |
| 26 {"latencyInfo", "*", kInputLatencyAllowedArgs}, | 28 {"latencyInfo", "*", kInputLatencyAllowedArgs}, |
| 29 // Redefined the string since MemoryDumpManager::kTraceCategory causes | |
| 30 // static initialization of this struct. | |
|
Primiano Tucci (use gerrit)
2016/06/23 22:41:18
^__^ Wow. Definitely didn't expect that.
Whaatever
| |
| 31 {TRACE_DISABLED_BY_DEFAULT("memory-infra"), "*", kMemoryDumpAllowedArgs}, | |
| 27 {nullptr, nullptr, nullptr}}; | 32 {nullptr, nullptr, nullptr}}; |
| 28 | 33 |
| 29 const char* kMetadataWhitelist[] = { | 34 const char* kMetadataWhitelist[] = { |
| 30 "clock-domain", | 35 "clock-domain", |
| 31 "command_line", | 36 "command_line", |
| 32 "config", | 37 "config", |
| 33 "cpu-*", | 38 "cpu-*", |
| 34 "field-trials", | 39 "field-trials", |
| 35 "gpu-*", | 40 "gpu-*", |
| 36 "highres-ticks", | 41 "highres-ticks", |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 } | 89 } |
| 85 | 90 |
| 86 bool IsMetadataWhitelisted(const std::string& metadata_name) { | 91 bool IsMetadataWhitelisted(const std::string& metadata_name) { |
| 87 for (auto key : kMetadataWhitelist) { | 92 for (auto key : kMetadataWhitelist) { |
| 88 if (base::MatchPattern(metadata_name, key)) { | 93 if (base::MatchPattern(metadata_name, key)) { |
| 89 return true; | 94 return true; |
| 90 } | 95 } |
| 91 } | 96 } |
| 92 return false; | 97 return false; |
| 93 } | 98 } |
| OLD | NEW |