Skip to content

Implement merged UI and platform thread #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions flutter/shell/platform/tizen/flutter_project_bundle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ FlutterProjectBundle::FlutterProjectBundle(
std::string(properties.dart_entrypoint_argv[i]));
}

merged_platform_ui_thread_ = properties.merged_platform_ui_thread;

// Resolve any relative paths.
if (assets_path_.is_relative() || icu_path_.is_relative() ||
(!aot_library_path_.empty() && aot_library_path_.is_relative())) {
Expand Down
6 changes: 6 additions & 0 deletions flutter/shell/platform/tizen/flutter_project_bundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class FlutterProjectBundle {
return dart_entrypoint_arguments_;
}

// Whether the UI isolate should be running on the platform thread.
bool merged_platform_ui_thread() const { return merged_platform_ui_thread_; }

private:
std::filesystem::path assets_path_;
std::filesystem::path icu_path_;
Expand All @@ -80,6 +83,9 @@ class FlutterProjectBundle {

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

// Whether the UI isolate should be running on the platform thread.
bool merged_platform_ui_thread_;
};

} // namespace flutter
Expand Down
5 changes: 5 additions & 0 deletions flutter/shell/platform/tizen/flutter_tizen_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ bool FlutterTizenEngine::RunEngine() {
custom_task_runners.render_task_runner = &render_task_runner;
}

if (project_->merged_platform_ui_thread()) {
FT_LOG(Info) << "Running with merged platform and UI thread. Experimental.";
custom_task_runners.ui_task_runner = &platform_task_runner;
}

FlutterProjectArgs args = {};
args.struct_size = sizeof(FlutterProjectArgs);
args.assets_path = assets_path_string.c_str();
Expand Down
3 changes: 3 additions & 0 deletions flutter/shell/platform/tizen/flutter_tizen_engine_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class FlutterTizenEngineTest : public ::testing::Test {
engine_prop.assets_path = "/foo/flutter_assets";
engine_prop.icu_data_path = "/foo/icudtl.dat";
engine_prop.aot_library_path = "/foo/libapp.so";
engine_prop.merged_platform_ui_thread = true;

FlutterProjectBundle project(engine_prop);
auto engine = std::make_unique<FlutterTizenEngine>(project);
Expand Down Expand Up @@ -64,6 +65,8 @@ TEST_F(FlutterTizenEngineTest, RunDoesExpectedInitialization) {
EXPECT_EQ(args->dart_entrypoint_argc, 0);
EXPECT_NE(args->platform_message_callback, nullptr);
EXPECT_NE(args->custom_task_runners, nullptr);
EXPECT_EQ(args->custom_task_runners->platform_task_runner,
args->custom_task_runners->ui_task_runner);
EXPECT_EQ(args->custom_dart_entrypoint, nullptr);

return kSuccess;
Expand Down
2 changes: 2 additions & 0 deletions flutter/shell/platform/tizen/public/flutter_tizen.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ typedef struct {
// Array of Dart entrypoint arguments. This is deep copied during the call
// to FlutterDesktopRunEngine.
const char** dart_entrypoint_argv;
// Whether the UI isolate should run on the platform thread.
bool merged_platform_ui_thread;
} FlutterDesktopEngineProperties;

// ========== Engine ==========
Expand Down