From 120c20d5c63fae54a45d4275e0e45b7c4b4c3fb1 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 10 Dec 2018 09:12:10 -0800 Subject: [PATCH] Eliminate main_dart_file_path, package_file_path (flutter/engine#6973) These settings were specific to Dart 1 and are no longer used in the engine. This eliminates them from the Settings class. --- engine/src/flutter/common/settings.cc | 2 -- engine/src/flutter/common/settings.h | 3 --- engine/src/flutter/shell/common/switches.cc | 6 ------ engine/src/flutter/shell/common/switches.h | 2 -- .../ios/framework/Source/FlutterDartProject.mm | 9 --------- .../flutter/shell/platform/embedder/embedder.cc | 16 +++++----------- 6 files changed, 5 insertions(+), 33 deletions(-) diff --git a/engine/src/flutter/common/settings.cc b/engine/src/flutter/common/settings.cc index a85d69fc85..f495bac77f 100644 --- a/engine/src/flutter/common/settings.cc +++ b/engine/src/flutter/common/settings.cc @@ -25,8 +25,6 @@ std::string Settings::ToString() const { << std::endl; stream << "application_library_path: " << application_library_path << std::endl; - stream << "main_dart_file_path: " << main_dart_file_path << std::endl; - stream << "packages_file_path: " << packages_file_path << std::endl; stream << "temp_directory_path: " << temp_directory_path << std::endl; stream << "dart_flags:" << std::endl; for (const auto& dart_flag : dart_flags) { diff --git a/engine/src/flutter/common/settings.h b/engine/src/flutter/common/settings.h index 92a8e37109..7d9e4e0173 100644 --- a/engine/src/flutter/common/settings.h +++ b/engine/src/flutter/common/settings.h @@ -38,9 +38,6 @@ struct Settings { std::string application_kernel_asset; std::string application_kernel_list_asset; - std::string main_dart_file_path; - std::string packages_file_path; - std::string temp_directory_path; std::vector dart_flags; diff --git a/engine/src/flutter/shell/common/switches.cc b/engine/src/flutter/shell/common/switches.cc index d2b4d56eb2..8472f27a38 100644 --- a/engine/src/flutter/shell/common/switches.cc +++ b/engine/src/flutter/shell/common/switches.cc @@ -170,12 +170,6 @@ blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { command_line.GetOptionValue(FlagForSwitch(Switch::FlutterAssetsDir), &settings.assets_path); - command_line.GetOptionValue(FlagForSwitch(Switch::MainDartFile), - &settings.main_dart_file_path); - - command_line.GetOptionValue(FlagForSwitch(Switch::Packages), - &settings.packages_file_path); - std::string aot_shared_library_path; command_line.GetOptionValue(FlagForSwitch(Switch::AotSharedLibraryPath), &aot_shared_library_path); diff --git a/engine/src/flutter/shell/common/switches.h b/engine/src/flutter/shell/common/switches.h index bbaa5b4760..9abaf7951a 100644 --- a/engine/src/flutter/shell/common/switches.h +++ b/engine/src/flutter/shell/common/switches.h @@ -92,8 +92,6 @@ DEF_SWITCH(FlutterAssetsDir, "Path to the Flutter assets directory.") DEF_SWITCH(Help, "help", "Display this help text.") DEF_SWITCH(LogTag, "log-tag", "Tag associated with log messages.") -DEF_SWITCH(MainDartFile, "dart-main", "The path to the main Dart file.") -DEF_SWITCH(Packages, "packages", "Specify the path to the packages.") DEF_SWITCH(StartPaused, "start-paused", "Start the application paused in the Dart debugger.") diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 0e5bf4fdcb..20e1c0d2ca 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -157,15 +157,6 @@ static blink::Settings DefaultSettingsForProcess(NSBundle* bundle = nil) { if (self) { _settings = DefaultSettingsForProcess(); - - if (dartMainURL != nil && [[NSFileManager defaultManager] fileExistsAtPath:dartMainURL.path]) { - _settings.main_dart_file_path = dartMainURL.path.UTF8String; - } - - if (dartPackages.path != nil && - [[NSFileManager defaultManager] fileExistsAtPath:dartPackages.path]) { - _settings.packages_file_path = dartPackages.path.UTF8String; - } } return self; diff --git a/engine/src/flutter/shell/platform/embedder/embedder.cc b/engine/src/flutter/shell/platform/embedder/embedder.cc index d7acb7d4db..d5d5ea51d9 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder.cc +++ b/engine/src/flutter/shell/platform/embedder/embedder.cc @@ -266,9 +266,7 @@ FlutterResult FlutterEngineRun(size_t version, return kInvalidArguments; } - if (SAFE_ACCESS(args, assets_path, nullptr) == nullptr || - SAFE_ACCESS(args, main_path, nullptr) == nullptr || - SAFE_ACCESS(args, packages_path, nullptr) == nullptr) { + if (SAFE_ACCESS(args, assets_path, nullptr) == nullptr) { return kInvalidArguments; } @@ -293,18 +291,14 @@ FlutterResult FlutterEngineRun(size_t version, settings.icu_data_path = icu_data_path; settings.assets_path = args->assets_path; - // Check whether the assets path contains Dart 2 kernel assets. + // Verify the assets path contains Dart 2 kernel assets. const std::string kApplicationKernelSnapshotFileName = "kernel_blob.bin"; std::string application_kernel_path = fml::paths::JoinPaths( {settings.assets_path, kApplicationKernelSnapshotFileName}); - if (fml::IsFile(application_kernel_path)) { - // Run from a kernel snapshot. - settings.application_kernel_asset = kApplicationKernelSnapshotFileName; - } else { - // Run from a main Dart file. - settings.main_dart_file_path = args->main_path; - settings.packages_file_path = args->packages_path; + if (!fml::IsFile(application_kernel_path)) { + return kInvalidArguments; } + settings.application_kernel_asset = kApplicationKernelSnapshotFileName; settings.task_observer_add = [](intptr_t key, fml::closure callback) { fml::MessageLoop::GetCurrent().AddTaskObserver(key, std::move(callback));