Skip to content

Commit

Permalink
Fix strong flag setting (flutter#4683)
Browse files Browse the repository at this point in the history
* Turn on strong mode by default when a platform file is present in the
bundle instead of using a flag passed into the engine which might not be
true when we invoke an installed app.

* - Roll dart to version fe96de2

* Update license file.
  • Loading branch information
a-siva authored Feb 15, 2018
1 parent 1cab96c commit 19e8d9b
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ vars = {
# Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS.
# You can use //tools/dart/create_updated_flutter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': '0fd6aa87a37023d9691cf50866214c1235dab2d1',
'dart_revision': 'fe96de2858f078e4ad04f8f30640184bf3d8102d',

'dart_args_tag': '0.13.7',
'dart_async_tag': '2.0.4',
Expand Down
1 change: 0 additions & 1 deletion common/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ struct Settings {
bool enable_dart_profiling = false;
bool use_test_fonts = false;
bool dart_non_checked_mode = false;
bool dart_strong_mode = false;
bool enable_software_rendering = false;
bool using_blink = true;
std::string aot_shared_library_path;
Expand Down
30 changes: 18 additions & 12 deletions runtime/dart_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -599,18 +599,6 @@ void InitDartVM(const uint8_t* vm_snapshot_data,
arraysize(kDartWriteProtectCodeArgs));
#endif

if (settings.dart_strong_mode) {
// In strong mode we enable all the strong mode options and if running
// debug product mode we also enable asserts.
PushBackAll(&args, kDartStrongModeArgs, arraysize(kDartStrongModeArgs));
if (use_checked_mode) {
PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs));
}
} else if (use_checked_mode) {
PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs));
PushBackAll(&args, kDartCheckedModeArgs, arraysize(kDartCheckedModeArgs));
}

if (settings.start_paused)
PushBackAll(&args, kDartStartPausedArgs, arraysize(kDartStartPausedArgs));

Expand Down Expand Up @@ -641,6 +629,24 @@ void InitDartVM(const uint8_t* vm_snapshot_data,
FXL_DCHECK(kernel_platform != nullptr);
}
}
if ((kernel_platform != nullptr) ||
Dart_IsDart2Snapshot(g_default_isolate_snapshot_data)) {
// The presence of the kernel platform file or a snapshot that was generated
// for Dart2 indicates we are running in preview-dart-2 mode and in this
// mode enable strong mode options by default.
// Note: When we start using core snapshots instead of the platform file
// in the engine just sniffing the snapshot file should be sufficient.
PushBackAll(&args, kDartStrongModeArgs, arraysize(kDartStrongModeArgs));
// In addition if we are running in debug mode we also enable asserts.
if (use_checked_mode) {
PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs));
}
} else if (use_checked_mode) {
// In non preview-dart-2 mode we enable checked mode and asserts if
// we are running in debug mode.
PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs));
PushBackAll(&args, kDartCheckedModeArgs, arraysize(kDartCheckedModeArgs));
}

for (size_t i = 0; i < settings.dart_flags.size(); i++)
args.push_back(settings.dart_flags[i].c_str());
Expand Down
4 changes: 0 additions & 4 deletions shell/common/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ void Shell::InitStandalone(fxl::CommandLine command_line,
settings.dart_non_checked_mode =
command_line.HasOption(FlagForSwitch(Switch::DartNonCheckedMode));

// strong mode setting.
settings.dart_strong_mode =
command_line.HasOption(FlagForSwitch(Switch::DartStrongMode));

settings.ipv6 = command_line.HasOption(FlagForSwitch(Switch::IPv6));

settings.start_paused =
Expand Down
1 change: 0 additions & 1 deletion shell/common/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ DEF_SWITCH(DartNonCheckedMode,
"precompiled and checked mode is unsupported. However, this flag "
"may be specified if the user wishes to run in the debug product "
"mode (i.e. with JIT or DBC) with checked mode off.")
DEF_SWITCH(DartStrongMode, "strong", "Enable Dart 2.0 strong mode.")
DEF_SWITCHES_END

void PrintUsage(const std::string& executable_name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,6 @@ private static String[] getArgsFromIntent(Intent intent) {
if (intent.getBooleanExtra("trace-skia", false)) {
args.add("--trace-skia");
}
if (intent.getBooleanExtra("strong", false)) {
args.add("--strong");
}
if (!args.isEmpty()) {
String[] argsArray = new String[args.size()];
return args.toArray(argsArray);
Expand Down
2 changes: 1 addition & 1 deletion travis/licenses_golden/licenses_third_party
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Signature: ecc7589805cacc5ca3aab1dad966d380
Signature: e5cf14253d584dd35dabad02ec06205b

UNUSED LICENSES:

Expand Down

0 comments on commit 19e8d9b

Please sign in to comment.