Remove the dart entry point args from the Settings struct (flutter/engine#29831)
This commit is contained in:
@@ -126,11 +126,6 @@ struct Settings {
|
||||
|
||||
std::string temp_directory_path;
|
||||
std::vector<std::string> dart_flags;
|
||||
// Arguments passed as a List<String> to Dart's entrypoint function.
|
||||
// TODO(93459): Remove it when it is no longer used.
|
||||
// https://github.com/flutter/flutter/issues/93459
|
||||
std::vector<std::string> dart_entrypoint_args;
|
||||
|
||||
// Isolate settings
|
||||
bool enable_checked_mode = false;
|
||||
bool start_paused = false;
|
||||
|
||||
@@ -198,14 +198,9 @@ std::weak_ptr<DartIsolate> DartIsolate::CreateRunningRootIsolate(
|
||||
root_isolate_create_callback();
|
||||
}
|
||||
|
||||
FML_DCHECK(dart_entrypoint_args.empty() ||
|
||||
settings.dart_entrypoint_args.empty());
|
||||
const std::vector<std::string>& args = !dart_entrypoint_args.empty()
|
||||
? dart_entrypoint_args
|
||||
: settings.dart_entrypoint_args;
|
||||
if (!isolate->RunFromLibrary(dart_entrypoint_library, //
|
||||
dart_entrypoint, //
|
||||
args)) {
|
||||
dart_entrypoint_args)) {
|
||||
FML_LOG(ERROR) << "Could not run the run main Dart entrypoint.";
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ void RunConfiguration::SetEntrypointAndLibrary(std::string entrypoint,
|
||||
}
|
||||
|
||||
void RunConfiguration::SetEntrypointArgs(
|
||||
const std::vector<std::string>& entrypoint_args) {
|
||||
entrypoint_args_ = entrypoint_args;
|
||||
std::vector<std::string> entrypoint_args) {
|
||||
entrypoint_args_ = std::move(entrypoint_args);
|
||||
}
|
||||
|
||||
std::shared_ptr<AssetManager> RunConfiguration::GetAssetManager() const {
|
||||
|
||||
@@ -155,7 +155,7 @@ class RunConfiguration {
|
||||
/// @brief Updates the main application entrypoint arguments.
|
||||
///
|
||||
/// @param[in] entrypoint_args The entrypoint arguments to use.
|
||||
void SetEntrypointArgs(const std::vector<std::string>& entrypoint_args);
|
||||
void SetEntrypointArgs(std::vector<std::string> entrypoint_args);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// @return The asset manager referencing all previously registered asset
|
||||
|
||||
@@ -311,7 +311,7 @@ std::optional<RunConfiguration> AndroidShellHolder::BuildRunConfiguration(
|
||||
config.SetEntrypoint(std::move(entrypoint));
|
||||
}
|
||||
if (entrypoint_args.size() > 0) {
|
||||
config.SetEntrypointArgs(entrypoint_args);
|
||||
config.SetEntrypointArgs(std::move(entrypoint_args));
|
||||
}
|
||||
}
|
||||
return config;
|
||||
|
||||
@@ -263,7 +263,7 @@ flutter::Settings FLTDefaultSettingsForBundle(NSBundle* bundle) {
|
||||
for (NSString* arg in entrypointArgs) {
|
||||
cppEntrypointArgs.push_back(std::string([arg UTF8String]));
|
||||
}
|
||||
config.SetEntrypointArgs(cppEntrypointArgs);
|
||||
config.SetEntrypointArgs(std::move(cppEntrypointArgs));
|
||||
}
|
||||
|
||||
return config;
|
||||
|
||||
@@ -1317,7 +1317,7 @@ FlutterEngineResult FlutterEngineInitialize(size_t version,
|
||||
for (int i = 0; i < args->dart_entrypoint_argc; ++i) {
|
||||
arguments[i] = std::string{args->dart_entrypoint_argv[i]};
|
||||
}
|
||||
settings.dart_entrypoint_args = std::move(arguments);
|
||||
run_configuration.SetEntrypointArgs(std::move(arguments));
|
||||
}
|
||||
|
||||
if (!run_configuration.IsValid()) {
|
||||
|
||||
@@ -125,7 +125,7 @@ ComponentV1::ComponentV1(
|
||||
|
||||
// LaunchInfo::arguments optional.
|
||||
if (auto& arguments = launch_info.arguments) {
|
||||
settings_.dart_entrypoint_args = arguments.value();
|
||||
dart_entrypoint_args_ = arguments.value();
|
||||
}
|
||||
|
||||
// Determine where data and assets are stored within /pkg.
|
||||
@@ -549,6 +549,7 @@ void ComponentV1::CreateViewWithViewRef(
|
||||
std::move(fdio_ns_), // FDIO namespace
|
||||
std::move(directory_request_), // outgoing request
|
||||
product_config_, // product configuration
|
||||
dart_entrypoint_args_, // dart entrypoint args
|
||||
true // v1 component
|
||||
));
|
||||
}
|
||||
@@ -573,6 +574,7 @@ void ComponentV1::CreateView2(fuchsia::ui::app::CreateView2Args view_args) {
|
||||
std::move(fdio_ns_), // FDIO namespace
|
||||
std::move(directory_request_), // outgoing request
|
||||
product_config_, // product configuration
|
||||
dart_entrypoint_args_, // dart entrypoint args
|
||||
true // v1 component
|
||||
));
|
||||
}
|
||||
|
||||
@@ -131,6 +131,7 @@ class ComponentV1 final : public Engine::Delegate,
|
||||
fml::RefPtr<flutter::DartSnapshot> isolate_snapshot_;
|
||||
std::set<std::unique_ptr<Engine>> shell_holders_;
|
||||
std::pair<bool, uint32_t> last_return_code_;
|
||||
std::vector<std::string> dart_entrypoint_args_;
|
||||
fml::WeakPtrFactory<ComponentV1> weak_factory_; // Must be the last member.
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(ComponentV1);
|
||||
};
|
||||
|
||||
@@ -599,6 +599,7 @@ void ComponentV2::CreateViewWithViewRef(
|
||||
std::move(fdio_ns_), // FDIO namespace
|
||||
std::move(directory_request_), // outgoing request
|
||||
product_config_, // product configuration
|
||||
std::vector<std::string>(), // dart entrypoint args
|
||||
false // not a v1 component
|
||||
));
|
||||
}
|
||||
@@ -623,6 +624,7 @@ void ComponentV2::CreateView2(fuchsia::ui::app::CreateView2Args view_args) {
|
||||
std::move(fdio_ns_), // FDIO namespace
|
||||
std::move(directory_request_), // outgoing request
|
||||
product_config_, // product configuration
|
||||
std::vector<std::string>(), // dart entrypoint args
|
||||
false // not a v1 component
|
||||
));
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ Engine::Engine(Delegate& delegate,
|
||||
UniqueFDIONS fdio_ns,
|
||||
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request,
|
||||
FlutterRunnerProductConfiguration product_config,
|
||||
const std::vector<std::string>& dart_entrypoint_args,
|
||||
bool for_v1_component)
|
||||
: delegate_(delegate),
|
||||
thread_label_(std::move(thread_label)),
|
||||
@@ -83,7 +84,7 @@ Engine::Engine(Delegate& delegate,
|
||||
Initialize(/*=use_flatland*/ false, std::move(view_ref_pair), std::move(svc),
|
||||
std::move(runner_services), std::move(settings),
|
||||
std::move(fdio_ns), std::move(directory_request),
|
||||
std::move(product_config), for_v1_component);
|
||||
std::move(product_config), dart_entrypoint_args, for_v1_component);
|
||||
}
|
||||
|
||||
Engine::Engine(Delegate& delegate,
|
||||
@@ -96,6 +97,7 @@ Engine::Engine(Delegate& delegate,
|
||||
UniqueFDIONS fdio_ns,
|
||||
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request,
|
||||
FlutterRunnerProductConfiguration product_config,
|
||||
const std::vector<std::string>& dart_entrypoint_args,
|
||||
bool for_v1_component)
|
||||
: delegate_(delegate),
|
||||
thread_label_(std::move(thread_label)),
|
||||
@@ -108,7 +110,7 @@ Engine::Engine(Delegate& delegate,
|
||||
Initialize(/*=use_flatland*/ true, std::move(view_ref_pair), std::move(svc),
|
||||
std::move(runner_services), std::move(settings),
|
||||
std::move(fdio_ns), std::move(directory_request),
|
||||
std::move(product_config), for_v1_component);
|
||||
std::move(product_config), dart_entrypoint_args, for_v1_component);
|
||||
}
|
||||
|
||||
void Engine::Initialize(
|
||||
@@ -120,6 +122,7 @@ void Engine::Initialize(
|
||||
UniqueFDIONS fdio_ns,
|
||||
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request,
|
||||
FlutterRunnerProductConfiguration product_config,
|
||||
const std::vector<std::string>& dart_entrypoint_args,
|
||||
bool for_v1_component) {
|
||||
// Flatland uses |view_creation_token_| for linking. Gfx uses |view_token_|.
|
||||
FML_CHECK((use_flatland && view_creation_token_.value.is_valid()) ||
|
||||
@@ -356,6 +359,7 @@ void Engine::Initialize(
|
||||
// so it must be called before WarmupSkps() is called below.
|
||||
auto run_configuration = flutter::RunConfiguration::InferFromSettings(
|
||||
settings, task_runners.GetIOTaskRunner());
|
||||
run_configuration.SetEntrypointArgs(std::move(dart_entrypoint_args));
|
||||
|
||||
OnSemanticsNodeUpdate on_semantics_node_update_callback =
|
||||
[this](flutter::SemanticsNodeUpdates updates, float pixel_ratio) {
|
||||
|
||||
@@ -61,6 +61,7 @@ class Engine final : public fuchsia::memorypressure::Watcher {
|
||||
UniqueFDIONS fdio_ns,
|
||||
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request,
|
||||
FlutterRunnerProductConfiguration product_config,
|
||||
const std::vector<std::string>& dart_entrypoint_args,
|
||||
bool for_v1_component);
|
||||
|
||||
// Flatland connection ctor.
|
||||
@@ -74,6 +75,7 @@ class Engine final : public fuchsia::memorypressure::Watcher {
|
||||
UniqueFDIONS fdio_ns,
|
||||
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request,
|
||||
FlutterRunnerProductConfiguration product_config,
|
||||
const std::vector<std::string>& dart_entrypoint_args,
|
||||
bool for_v1_component);
|
||||
|
||||
~Engine();
|
||||
@@ -96,6 +98,7 @@ class Engine final : public fuchsia::memorypressure::Watcher {
|
||||
UniqueFDIONS fdio_ns,
|
||||
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request,
|
||||
FlutterRunnerProductConfiguration product_config,
|
||||
const std::vector<std::string>& dart_entrypoint_args,
|
||||
bool for_v1_component);
|
||||
|
||||
static void WarmupSkps(
|
||||
|
||||
@@ -85,8 +85,6 @@ std::unique_ptr<AutoIsolateShutdown> RunDartCodeInIsolateOnUITaskRunner(
|
||||
|
||||
auto settings = p_settings;
|
||||
|
||||
settings.dart_entrypoint_args = args;
|
||||
|
||||
if (!DartVM::IsRunningPrecompiledCode()) {
|
||||
if (!fml::IsFile(kernel_file_path)) {
|
||||
FML_LOG(ERROR) << "Could not locate kernel file.";
|
||||
@@ -135,7 +133,7 @@ std::unique_ptr<AutoIsolateShutdown> RunDartCodeInIsolateOnUITaskRunner(
|
||||
settings.isolate_shutdown_callback, // isolate shutdown callback
|
||||
entrypoint, // entrypoint
|
||||
std::nullopt, // library
|
||||
{}, // args
|
||||
args, // args
|
||||
std::move(isolate_configuration), // isolate configuration
|
||||
context // engine context
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user