Skip to content

Commit 486f26f

Browse files
authored
Rename trace-whitelist to trace-allowlist (flutter#19047)
1 parent 4cd36e1 commit 486f26f

File tree

6 files changed

+27
-15
lines changed

6 files changed

+27
-15
lines changed

common/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct Settings {
9292
bool enable_checked_mode = false;
9393
bool start_paused = false;
9494
bool trace_skia = false;
95-
std::string trace_whitelist;
95+
std::string trace_allowlist;
9696
bool trace_startup = false;
9797
bool trace_systrace = false;
9898
bool dump_skp_on_shader_compilation = false;

fml/trace_event.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace tracing {
1818
#if FLUTTER_TIMELINE_ENABLED
1919

2020
namespace {
21-
AsciiTrie gWhitelist;
21+
AsciiTrie gAllowlist;
2222

2323
inline void FlutterTimelineEvent(const char* label,
2424
int64_t timestamp0,
@@ -27,15 +27,15 @@ inline void FlutterTimelineEvent(const char* label,
2727
intptr_t argument_count,
2828
const char** argument_names,
2929
const char** argument_values) {
30-
if (gWhitelist.Query(label)) {
30+
if (gAllowlist.Query(label)) {
3131
Dart_TimelineEvent(label, timestamp0, timestamp1_or_async_id, type,
3232
argument_count, argument_names, argument_values);
3333
}
3434
}
3535
} // namespace
3636

37-
void TraceSetWhitelist(const std::vector<std::string>& whitelist) {
38-
gWhitelist.Fill(whitelist);
37+
void TraceSetAllowlist(const std::vector<std::string>& allowlist) {
38+
gAllowlist.Fill(allowlist);
3939
}
4040

4141
size_t TraceNonce() {
@@ -286,7 +286,7 @@ void TraceEventFlowEnd0(TraceArg category_group, TraceArg name, TraceIDArg id) {
286286

287287
#else // FLUTTER_TIMELINE_ENABLED
288288

289-
void TraceSetWhitelist(const std::vector<std::string>& whitelist) {}
289+
void TraceSetAllowlist(const std::vector<std::string>& allowlist) {}
290290

291291
size_t TraceNonce() {
292292
return 0;

fml/trace_event.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ namespace tracing {
130130
using TraceArg = const char*;
131131
using TraceIDArg = int64_t;
132132

133-
void TraceSetWhitelist(const std::vector<std::string>& whitelist);
133+
void TraceSetAllowlist(const std::vector<std::string>& allowlist);
134134

135135
void TraceTimelineEvent(TraceArg category_group,
136136
TraceArg name,

shell/common/shell.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ static void PerformInitializationTasks(Settings& settings) {
212212
InitSkiaEventTracer(settings.trace_skia);
213213
}
214214

215-
if (!settings.trace_whitelist.empty()) {
215+
if (!settings.trace_allowlist.empty()) {
216216
std::vector<std::string> prefixes;
217-
Tokenize(settings.trace_whitelist, &prefixes, ',');
218-
fml::tracing::TraceSetWhitelist(prefixes);
217+
Tokenize(settings.trace_allowlist, &prefixes, ',');
218+
fml::tracing::TraceSetAllowlist(prefixes);
219219
}
220220

221221
if (!settings.skia_deterministic_rendering_on_cpu) {

shell/common/switches.cc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,17 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
275275
settings.trace_skia =
276276
command_line.HasOption(FlagForSwitch(Switch::TraceSkia));
277277

278-
command_line.GetOptionValue(FlagForSwitch(Switch::TraceWhitelist),
279-
&settings.trace_whitelist);
278+
command_line.GetOptionValue(FlagForSwitch(Switch::TraceAllowlist),
279+
&settings.trace_allowlist);
280+
281+
if (settings.trace_allowlist.empty()) {
282+
command_line.GetOptionValue(FlagForSwitch(Switch::TraceWhitelist),
283+
&settings.trace_allowlist);
284+
if (!settings.trace_allowlist.empty()) {
285+
FML_LOG(INFO)
286+
<< "--trace-whitelist is deprecated. Use --trace-allowlist instead.";
287+
}
288+
}
280289

281290
settings.trace_systrace =
282291
command_line.HasOption(FlagForSwitch(Switch::TraceSystrace));

shell/common/switches.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,14 @@ DEF_SWITCH(TraceSkia,
129129
"Trace Skia calls. This is useful when debugging the GPU threed."
130130
"By default, Skia tracing is not enabled to reduce the number of "
131131
"traced events")
132+
DEF_SWITCH(TraceWhitelist,
133+
"trace-whitelist",
134+
"(deprecated) Use --trace-allowlist instead.")
132135
DEF_SWITCH(
133-
TraceWhitelist,
134-
"trace-whitelist",
136+
TraceAllowlist,
137+
"trace-allowlist",
135138
"Filters out all trace events except those that are specified in this "
136-
"comma separated list of whitelisted prefixes.")
139+
"comma separated list of allowed prefixes.")
137140
DEF_SWITCH(DumpSkpOnShaderCompilation,
138141
"dump-skp-on-shader-compilation",
139142
"Automatically dump the skp that triggers new shader compilations. "

0 commit comments

Comments
 (0)