From 9c6bd7e27bf465f27050adfa2919458bd85995f8 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 15 Jun 2020 11:35:51 -0700 Subject: [PATCH 1/3] Rename trace-whitelist to trace-allowlist --- common/settings.h | 2 +- fml/trace_event.cc | 10 +++++----- fml/trace_event.h | 2 +- shell/common/shell.cc | 6 +++--- shell/common/switches.cc | 13 +++++++++++-- shell/common/switches.h | 7 ++++++- 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/common/settings.h b/common/settings.h index 78d5693ae31d9..52abe1994bd60 100644 --- a/common/settings.h +++ b/common/settings.h @@ -92,7 +92,7 @@ struct Settings { bool enable_checked_mode = false; bool start_paused = false; bool trace_skia = false; - std::string trace_whitelist; + std::string trace_allowlist; bool trace_startup = false; bool trace_systrace = false; bool dump_skp_on_shader_compilation = false; diff --git a/fml/trace_event.cc b/fml/trace_event.cc index b9d045232d190..bb2becbd03651 100644 --- a/fml/trace_event.cc +++ b/fml/trace_event.cc @@ -18,7 +18,7 @@ namespace tracing { #if FLUTTER_TIMELINE_ENABLED namespace { -AsciiTrie gWhitelist; +AsciiTrie gAllowlist; inline void FlutterTimelineEvent(const char* label, int64_t timestamp0, @@ -27,15 +27,15 @@ inline void FlutterTimelineEvent(const char* label, intptr_t argument_count, const char** argument_names, const char** argument_values) { - if (gWhitelist.Query(label)) { + if (gAllowlist.Query(label)) { Dart_TimelineEvent(label, timestamp0, timestamp1_or_async_id, type, argument_count, argument_names, argument_values); } } } // namespace -void TraceSetWhitelist(const std::vector& whitelist) { - gWhitelist.Fill(whitelist); +void TraceSetAllowlist(const std::vector& allowlist) { + gAllowlist.Fill(allowlist); } size_t TraceNonce() { @@ -286,7 +286,7 @@ void TraceEventFlowEnd0(TraceArg category_group, TraceArg name, TraceIDArg id) { #else // FLUTTER_TIMELINE_ENABLED -void TraceSetWhitelist(const std::vector& whitelist) {} +void TraceSetAllowlist(const std::vector& allowlist) {} size_t TraceNonce() { return 0; diff --git a/fml/trace_event.h b/fml/trace_event.h index 54ca3b9a823dd..ae80298cfd699 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -130,7 +130,7 @@ namespace tracing { using TraceArg = const char*; using TraceIDArg = int64_t; -void TraceSetWhitelist(const std::vector& whitelist); +void TraceSetAllowlist(const std::vector& allowlist); void TraceTimelineEvent(TraceArg category_group, TraceArg name, diff --git a/shell/common/shell.cc b/shell/common/shell.cc index bdf78fc7c2756..2becbe493dd64 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -212,10 +212,10 @@ static void PerformInitializationTasks(Settings& settings) { InitSkiaEventTracer(settings.trace_skia); } - if (!settings.trace_whitelist.empty()) { + if (!settings.trace_allowlist.empty()) { std::vector prefixes; - Tokenize(settings.trace_whitelist, &prefixes, ','); - fml::tracing::TraceSetWhitelist(prefixes); + Tokenize(settings.trace_allowlist, &prefixes, ','); + fml::tracing::TraceSetAllowlist(prefixes); } if (!settings.skia_deterministic_rendering_on_cpu) { diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 0f0c7fc145a78..b4c3da5fd263b 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -275,8 +275,17 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { settings.trace_skia = command_line.HasOption(FlagForSwitch(Switch::TraceSkia)); - command_line.GetOptionValue(FlagForSwitch(Switch::TraceWhitelist), - &settings.trace_whitelist); + command_line.GetOptionValue(FlagForSwitch(Switch::TraceAllowlist), + &settings.trace_allowlist); + + if (settings.trace_allowlist.empty()) { + command_line.GetOptionValue(FlagForSwitch(Switch::TraceWhitelist), + &settings.trace_allowlist); + if (!settings.trace_allowlist.empty()) { + FML_LOG(INFO) + << "--trace-whitelist is deprecated. Use --trace-allowlist instead."; + } + } settings.trace_systrace = command_line.HasOption(FlagForSwitch(Switch::TraceSystrace)); diff --git a/shell/common/switches.h b/shell/common/switches.h index f261a76e141e1..1cf10ec14a686 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -132,8 +132,13 @@ DEF_SWITCH(TraceSkia, DEF_SWITCH( TraceWhitelist, "trace-whitelist", - "Filters out all trace events except those that are specified in this " + "(deprecated) Use --trace-allowlist instead. " "comma separated list of whitelisted prefixes.") +DEF_SWITCH( + TraceAllowlist, + "trace-allowlist", + "Filters out all trace events except those that are specified in this " + "comma separated list of allowed prefixes.") DEF_SWITCH(DumpSkpOnShaderCompilation, "dump-skp-on-shader-compilation", "Automatically dump the skp that triggers new shader compilations. " From ec1da44e85b81a5029f9a3c99075299515f0a669 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 15 Jun 2020 11:36:59 -0700 Subject: [PATCH 2/3] ++ --- shell/common/switches.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/shell/common/switches.h b/shell/common/switches.h index 1cf10ec14a686..871d11488d412 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -132,8 +132,7 @@ DEF_SWITCH(TraceSkia, DEF_SWITCH( TraceWhitelist, "trace-whitelist", - "(deprecated) Use --trace-allowlist instead. " - "comma separated list of whitelisted prefixes.") + "(deprecated) Use --trace-allowlist instead.") DEF_SWITCH( TraceAllowlist, "trace-allowlist", From 20998eff14b302c0566955e0aa14c7ca4e05753a Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 15 Jun 2020 12:24:17 -0700 Subject: [PATCH 3/3] format --- shell/common/switches.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/shell/common/switches.h b/shell/common/switches.h index 871d11488d412..3bef7d645dde9 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -129,10 +129,9 @@ DEF_SWITCH(TraceSkia, "Trace Skia calls. This is useful when debugging the GPU threed." "By default, Skia tracing is not enabled to reduce the number of " "traced events") -DEF_SWITCH( - TraceWhitelist, - "trace-whitelist", - "(deprecated) Use --trace-allowlist instead.") +DEF_SWITCH(TraceWhitelist, + "trace-whitelist", + "(deprecated) Use --trace-allowlist instead.") DEF_SWITCH( TraceAllowlist, "trace-allowlist",