Skip to content

Commit

Permalink
Remove build flags for dynamic patching (flutter#9394)
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons authored Jun 20, 2019
1 parent 3b52992 commit 7a5ec8d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 30 deletions.
8 changes: 1 addition & 7 deletions common/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (target_cpu == "arm" || target_cpu == "arm64") {
}

declare_args() {
# The runtime mode ("debug", "profile", "release", "dynamic_profile", or "dynamic_release")
# The runtime mode ("debug", "profile", or "release")
flutter_runtime_mode = "debug"
}

Expand All @@ -25,8 +25,6 @@ feature_defines_list = [
"FLUTTER_RUNTIME_MODE_DEBUG=1",
"FLUTTER_RUNTIME_MODE_PROFILE=2",
"FLUTTER_RUNTIME_MODE_RELEASE=3",
"FLUTTER_RUNTIME_MODE_DYNAMIC_PROFILE=4",
"FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE=5",
]

if (flutter_runtime_mode == "debug") {
Expand All @@ -35,10 +33,6 @@ if (flutter_runtime_mode == "debug") {
feature_defines_list += [ "FLUTTER_RUNTIME_MODE=2" ]
} else if (flutter_runtime_mode == "release") {
feature_defines_list += [ "FLUTTER_RUNTIME_MODE=3" ]
} else if (flutter_runtime_mode == "dynamic_profile") {
feature_defines_list += [ "FLUTTER_RUNTIME_MODE=4" ]
} else if (flutter_runtime_mode == "dynamic_release") {
feature_defines_list += [ "FLUTTER_RUNTIME_MODE=5" ]
} else {
feature_defines_list += [ "FLUTTER_RUNTIME_MODE=0" ]
}
Expand Down
3 changes: 1 addition & 2 deletions runtime/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ source_set("runtime") {

public_configs = [ "$flutter_root:config" ]

if (flutter_runtime_mode != "release" &&
flutter_runtime_mode != "dynamic_release" && !is_fuchsia) {
if (flutter_runtime_mode != "release" && !is_fuchsia) {
# Only link in Observatory in non-release modes on non-Fuchsia. Fuchsia
# instead puts Observatory into the runner's package.
deps += [
Expand Down
14 changes: 3 additions & 11 deletions runtime/dart_vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
namespace dart {
namespace observatory {

#if !OS_FUCHSIA && (FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE) && \
(FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE)
#if !OS_FUCHSIA && (FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE)

// These two symbols are defined in |observatory_archive.cc| which is generated
// by the |//third_party/dart/runtime/observatory:archive_observatory| rule.
Expand All @@ -48,8 +47,7 @@ extern unsigned int observatory_assets_archive_len;
extern const uint8_t* observatory_assets_archive;

#endif // !OS_FUCHSIA && (FLUTTER_RUNTIME_MODE !=
// FLUTTER_RUNTIME_MODE_RELEASE) && (FLUTTER_RUNTIME_MODE !=
// FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE)
// FLUTTER_RUNTIME_MODE_RELEASE)

} // namespace observatory
} // namespace dart
Expand Down Expand Up @@ -143,8 +141,7 @@ bool DartFileModifiedCallback(const char* source_url, int64_t since_ms) {
void ThreadExitCallback() {}

Dart_Handle GetVMServiceAssetsArchiveCallback() {
#if (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_RELEASE) || \
(FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE)
#if (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_RELEASE)
return nullptr;
#elif OS_FUCHSIA
fml::UniqueFD fd = fml::OpenFile("pkg/data/observatory.tar", false,
Expand Down Expand Up @@ -303,11 +300,6 @@ DartVM::DartVM(std::shared_ptr<const DartVMData> vm_data,
// precompiled code only in the debug product mode.
bool enable_asserts = !settings_.disable_dart_asserts;

#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_PROFILE || \
FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE
enable_asserts = false;
#endif

#if !OS_FUCHSIA
if (IsRunningPrecompiledCode()) {
enable_asserts = false;
Expand Down
6 changes: 2 additions & 4 deletions shell/common/shell_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ TEST_F(ShellTest, BlacklistedDartVMFlag) {
fml::CommandLine::Option("dart-flags", "--verify_after_gc")};
fml::CommandLine command_line("", options, std::vector<std::string>());

#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE && \
FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE
#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE
// Upon encountering a non-whitelisted Dart flag the process terminates.
const char* expected =
"Encountered blacklisted Dart VM flag: --verify_after_gc";
Expand All @@ -241,8 +240,7 @@ TEST_F(ShellTest, WhitelistedDartVMFlag) {
fml::CommandLine command_line("", options, std::vector<std::string>());
flutter::Settings settings = flutter::SettingsFromCommandLine(command_line);

#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE && \
FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE
#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE
EXPECT_EQ(settings.dart_flags.size(), 2u);
EXPECT_EQ(settings.dart_flags[0], "--max_profile_depth 1");
EXPECT_EQ(settings.dart_flags[1], "--random_seed 42");
Expand Down
9 changes: 3 additions & 6 deletions shell/common/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ struct SwitchDesc {
#define DEF_SWITCHES_END };
// clang-format on

#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE && \
FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE
#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE

// List of common and safe VM flags to allow to be passed directly to the VM.
// clang-format off
Expand Down Expand Up @@ -118,8 +117,7 @@ const fml::StringView FlagForSwitch(Switch swtch) {
return fml::StringView();
}

#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE && \
FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE
#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE

static bool IsWhitelistedDartVMFlag(const std::string& flag) {
for (uint32_t i = 0; i < fml::size(gDartFlagsWhitelist); ++i) {
Expand Down Expand Up @@ -294,8 +292,7 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
settings.use_test_fonts =
command_line.HasOption(FlagForSwitch(Switch::UseTestFonts));

#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE && \
FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE
#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE
command_line.GetOptionValue(FlagForSwitch(Switch::LogTag), &settings.log_tag);
std::string all_dart_flags;
if (command_line.GetOptionValue(FlagForSwitch(Switch::DartFlags),
Expand Down

0 comments on commit 7a5ec8d

Please sign in to comment.