Chromium Code Reviews| Index: base/trace_event/memory_infra_background_whitelist.cc |
| diff --git a/base/trace_event/memory_infra_background_whitelist.cc b/base/trace_event/memory_infra_background_whitelist.cc |
| index 746068a7b1edf227af4153b16b6783b98378658e..d5783d062c8b032e2958b0a2e4b4e2477573a13b 100644 |
| --- a/base/trace_event/memory_infra_background_whitelist.cc |
| +++ b/base/trace_event/memory_infra_background_whitelist.cc |
| @@ -40,6 +40,12 @@ const char* const kDumpProviderWhitelist[] = { |
| nullptr // End of list marker. |
| }; |
| +// The names of dump providers whitelisted for summary tracing. |
|
Primiano Tucci (use gerrit)
2017/05/10 16:18:58
/summary tracing/SUMMARY_ONLY dump type modes/
ssid
2017/05/10 17:43:08
Maybe a comment here similar to the description of
|
| +const char* const kDumpProviderSummaryWhitelist[] = { |
| + "Malloc", "PartitionAlloc", "ProcessMemoryMetrics", "V8Isolate", |
|
Primiano Tucci (use gerrit)
2017/05/10 16:18:58
is this git cl format-ed? (if so I have no objecti
hjd
2017/05/15 12:02:27
yep :)
|
| + nullptr // End of list marker. |
| +}; |
| + |
| // A list of string names that are allowed for the memory allocator dumps in |
| // background mode. |
| const char* const kAllocatorDumpNameWhitelist[] = { |
| @@ -205,19 +211,30 @@ const char* const kAllocatorDumpNameWhitelist[] = { |
| }; |
| const char* const* g_dump_provider_whitelist = kDumpProviderWhitelist; |
| +const char* const* g_dump_provider_whitelist_for_summary = |
| + kDumpProviderSummaryWhitelist; |
| const char* const* g_allocator_dump_name_whitelist = |
| kAllocatorDumpNameWhitelist; |
| -} // namespace |
| - |
| -bool IsMemoryDumpProviderWhitelisted(const char* mdp_name) { |
| - for (size_t i = 0; g_dump_provider_whitelist[i] != nullptr; ++i) { |
| - if (strcmp(mdp_name, g_dump_provider_whitelist[i]) == 0) |
| +bool IsMemoryDumpProviderInList(const char* mdp_name, const char* const* list) { |
| + for (size_t i = 0; list[i] != nullptr; ++i) { |
| + if (strcmp(mdp_name, list[i]) == 0) |
| return true; |
| } |
| return false; |
| } |
| +} // namespace |
| + |
| +bool IsMemoryDumpProviderWhitelisted(const char* mdp_name) { |
| + return IsMemoryDumpProviderInList(mdp_name, g_dump_provider_whitelist); |
| +} |
| + |
| +bool IsMemoryDumpProviderWhitelistedForSummary(const char* mdp_name) { |
| + return IsMemoryDumpProviderInList(mdp_name, |
| + g_dump_provider_whitelist_for_summary); |
| +} |
| + |
| bool IsMemoryAllocatorDumpNameWhitelisted(const std::string& name) { |
| // Remove special characters, numbers (including hexadecimal which are marked |
| // by '0x') from the given string. |
| @@ -250,6 +267,10 @@ void SetDumpProviderWhitelistForTesting(const char* const* list) { |
| g_dump_provider_whitelist = list; |
| } |
| +void SetDumpProviderSummaryWhitelistForTesting(const char* const* list) { |
| + g_dump_provider_whitelist_for_summary = list; |
| +} |
| + |
| void SetAllocatorDumpNameWhitelistForTesting(const char* const* list) { |
| g_allocator_dump_name_whitelist = list; |
| } |