Allow embedders to disable causal async stacks in the Dart VM (flutter/engine#13004)

Fixes https://github.com/flutter/flutter/issues/39511
This commit is contained in:
Jason Simmons 2019-10-10 10:09:03 -07:00 committed by GitHub
parent 524af5638b
commit 1759de2b98

View File

@ -37,9 +37,17 @@ struct SwitchDesc {
#define DEF_SWITCHES_END };
// clang-format on
#if !FLUTTER_RELEASE
// List of common and safe VM flags to allow to be passed directly to the VM.
#if FLUTTER_RELEASE
// clang-format off
static const std::string gDartFlagsWhitelist[] = {
"--no-causal_async_stacks",
};
// clang-format on
#else
// clang-format off
static const std::string gDartFlagsWhitelist[] = {
"--max_profile_depth",
@ -48,10 +56,11 @@ static const std::string gDartFlagsWhitelist[] = {
"--enable_mirrors",
"--write-service-info",
"--sample-buffer-duration",
"--no-causal_async_stacks",
};
// clang-format on
#endif
#endif // FLUTTER_RELEASE
// Include again for struct definition.
#include "flutter/shell/common/switches.h"
@ -135,8 +144,6 @@ const std::string_view FlagForSwitch(Switch swtch) {
return std::string_view();
}
#if !FLUTTER_RELEASE
static bool IsWhitelistedDartVMFlag(const std::string& flag) {
for (uint32_t i = 0; i < fml::size(gDartFlagsWhitelist); ++i) {
const std::string& allowed = gDartFlagsWhitelist[i];
@ -150,8 +157,6 @@ static bool IsWhitelistedDartVMFlag(const std::string& flag) {
return false;
}
#endif
template <typename T>
static bool GetSwitchValue(const fml::CommandLine& command_line,
Switch sw,
@ -329,8 +334,6 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
settings.use_test_fonts =
command_line.HasOption(FlagForSwitch(Switch::UseTestFonts));
#if !FLUTTER_RELEASE
command_line.GetOptionValue(FlagForSwitch(Switch::LogTag), &settings.log_tag);
std::string all_dart_flags;
if (command_line.GetOptionValue(FlagForSwitch(Switch::DartFlags),
&all_dart_flags)) {
@ -346,6 +349,9 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
}
}
#if !FLUTTER_RELEASE
command_line.GetOptionValue(FlagForSwitch(Switch::LogTag), &settings.log_tag);
settings.trace_skia =
command_line.HasOption(FlagForSwitch(Switch::TraceSkia));
settings.trace_systrace =