Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions shell/platform/tizen/flutter_project_bundle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ FlutterProjectBundle::FlutterProjectBundle(
aot_library_path_ = std::filesystem::path(properties.aot_library_path);
}

for (int i = 0; i < properties.dart_entrypoint_argc; i++) {
dart_entrypoint_arguments_.push_back(
std::string(properties.dart_entrypoint_argv[i]));
}

// Resolve any relative paths.
if (assets_path_.is_relative() || icu_path_.is_relative() ||
(!aot_library_path_.empty() && aot_library_path_.is_relative())) {
Expand Down
9 changes: 9 additions & 0 deletions shell/platform/tizen/flutter_project_bundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,22 @@ class FlutterProjectBundle {
// Logs and returns nullptr on failure.
UniqueAotDataPtr LoadAotData(const FlutterEngineProcTable& engine_procs);

// Returns the command line arguments to be passed through to the Dart
// entrypoint.
const std::vector<std::string>& dart_entrypoint_arguments() const {
return dart_entrypoint_arguments_;
}

private:
std::filesystem::path assets_path_;
std::filesystem::path icu_path_;
std::vector<std::string> switches_ = {};

// Path to the AOT library file, if any.
std::filesystem::path aot_library_path_;

// Dart entrypoint arguments.
std::vector<std::string> dart_entrypoint_arguments_;
};

} // namespace flutter
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/tizen/flutter_tizen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ FlutterDesktopEngineRef FlutterDesktopRunEngine(
window_properties.height, window_properties.transparent,
window_properties.focusable);
}
if (!engine->RunEngine()) {
if (!engine->RunEngine(engine_properties.entry_point)) {
FT_LOGE("Failed to run the Flutter engine.");
return nullptr;
}
Expand Down
14 changes: 13 additions & 1 deletion shell/platform/tizen/flutter_tizen_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void FlutterTizenEngine::InitializeRenderer(int32_t x,
#endif
}

bool FlutterTizenEngine::RunEngine() {
bool FlutterTizenEngine::RunEngine(const char* entrypoint) {
if (engine_ != nullptr) {
FT_LOGE("The engine has already started.");
return false;
Expand Down Expand Up @@ -149,6 +149,14 @@ bool FlutterTizenEngine::RunEngine() {
SetMinLoggingLevel(DLOG_INFO);
}

const std::vector<std::string>& entrypoint_args =
project_->dart_entrypoint_arguments();
std::vector<const char*> entrypoint_argv;
std::transform(
entrypoint_args.begin(), entrypoint_args.end(),
std::back_inserter(entrypoint_argv),
[](const std::string& arg) -> const char* { return arg.c_str(); });

// Configure task runners.
FlutterTaskRunnerDescription platform_task_runner = {};
platform_task_runner.struct_size = sizeof(FlutterTaskRunnerDescription);
Expand Down Expand Up @@ -215,6 +223,10 @@ bool FlutterTizenEngine::RunEngine() {
args.aot_data = aot_data_.get();
}

if (entrypoint) {
args.custom_dart_entrypoint = entrypoint;
}

FlutterRendererConfig renderer_config = GetRendererConfig();

auto result = embedder_api_.Run(FLUTTER_ENGINE_VERSION, &renderer_config,
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/tizen/flutter_tizen_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class FlutterTizenEngine : public TizenRenderer::Delegate {
bool focusable);

// Starts running the engine.
bool RunEngine();
bool RunEngine(const char* entrypoint);

// Stops the engine.
bool StopEngine();
Expand Down
8 changes: 8 additions & 0 deletions shell/platform/tizen/public/flutter_tizen.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ typedef struct {
const char** switches;
// The number of elements in |switches|.
size_t switches_count;
// The optional entry point in the Dart project, if the entry point is null,
// defaults to main().
const char* entry_point;
// Number of elements in the array passed in as dart_entrypoint_argv.
int dart_entrypoint_argc;
// Array of Dart entrypoint arguments. This is deep copied during the call
// to FlutterDesktopEngineCreate.
const char** dart_entrypoint_argv;
} FlutterDesktopEngineProperties;

// Runs an instance of a Flutter engine with the given properties.
Expand Down