From d8c37353d8f39d479863207304d8964321d09542 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Fri, 17 Nov 2023 14:40:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E9=80=82=E9=85=8Dohos=E7=9A=84profile?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- attachment/scripts/{__init__ .py => __init__.py} | 0 build/dart/rules.gni | 12 ++++++++++++ lib/ui/platform_dispatcher.dart | 2 +- shell/platform/ohos/BUILD.gn | 5 ++++- shell/platform/ohos/library_loader.cpp | 2 +- shell/platform/ohos/ohos_main.cpp | 2 +- 6 files changed, 19 insertions(+), 4 deletions(-) rename attachment/scripts/{__init__ .py => __init__.py} (100%) diff --git a/attachment/scripts/__init__ .py b/attachment/scripts/__init__.py similarity index 100% rename from attachment/scripts/__init__ .py rename to attachment/scripts/__init__.py diff --git a/build/dart/rules.gni b/build/dart/rules.gni index 00b801b2c2..ca7ea3519b 100644 --- a/build/dart/rules.gni +++ b/build/dart/rules.gni @@ -149,6 +149,18 @@ template("flutter_snapshot") { "--snapshot_kind=app-aot-elf", "--elf=" + rebase_path(libapp), ] + } else if (is_ohos) { + if (defined(invoker.output_aot_lib)) { + output_aot_lib = invoker.output_aot_lib + } else { + output_aot_lib = "libapp.so" + } + libapp = "$root_build_dir/$output_aot_lib" + outputs += [ libapp ] + args += [ + "--snapshot_kind=app-aot-elf", + "--elf=" + rebase_path(libapp), + ] } else { assert(false) } diff --git a/lib/ui/platform_dispatcher.dart b/lib/ui/platform_dispatcher.dart index 03bcc662c3..392062ebde 100644 --- a/lib/ui/platform_dispatcher.dart +++ b/lib/ui/platform_dispatcher.dart @@ -335,7 +335,7 @@ class PlatformDispatcher { // Called from the engine, via hooks.dart void _drawFrame() { - print("platform_dispatcher::drawFrame..${_onDrawFrame}") ; + // print("platform_dispatcher::drawFrame..${_onDrawFrame}") ; _invoke(onDrawFrame, _onDrawFrameZone); } diff --git a/shell/platform/ohos/BUILD.gn b/shell/platform/ohos/BUILD.gn index 025ddff432..8d18085468 100644 --- a/shell/platform/ohos/BUILD.gn +++ b/shell/platform/ohos/BUILD.gn @@ -195,6 +195,10 @@ executable("flutter_ohos_unittests") { shared_library("flutter") { deps = [ ":flutter_ohos_src" ] + if (flutter_runtime_mode == "profile") { + deps += [ "//flutter/shell/vmservice:vmservice_snapshot" ] + } + ldflags = ["--rtlib=compiler-rt", "-fuse-ld=lld", "-static-libstdc++", @@ -222,7 +226,6 @@ shared_library("flutter") { ldflags += ["-lpthread"] ldflags += ["-lpixelmap_ndk.z"] - public_configs = [ "//flutter:config" ] } diff --git a/shell/platform/ohos/library_loader.cpp b/shell/platform/ohos/library_loader.cpp index 6eddfb8e80..09cf2e9675 100644 --- a/shell/platform/ohos/library_loader.cpp +++ b/shell/platform/ohos/library_loader.cpp @@ -106,7 +106,7 @@ static napi_value Init(napi_env env, napi_value exports) { napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); bool ret = flutter::XComponentAdapter::GetInstance()->Export(env, exports); if (!ret) { - FML_DLOG(INFO) << "Flutter Init Failed"; + LOGE("Flutter Init NAPI Failed"); } return exports; } diff --git a/shell/platform/ohos/ohos_main.cpp b/shell/platform/ohos/ohos_main.cpp index a367e1114d..ddc429e0b4 100644 --- a/shell/platform/ohos/ohos_main.cpp +++ b/shell/platform/ohos/ohos_main.cpp @@ -137,7 +137,7 @@ void OhosMain::Init(napi_env env, napi_callback_info info) { }; settings.log_message_callback = [](const std::string& tag, const std::string& message) { - FML_DLOG(INFO) << tag << " " << message; + LOGI("%{public}s %{public}s", tag.c_str(), message.c_str()); }; g_flutter_main.reset(new OhosMain(settings)); -- Gitee From 8ca6479e6f1925c4e3e1918b5f9fb6e4460fa125 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Wed, 22 Nov 2023 21:16:17 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- shell/platform/ohos/library_loader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/platform/ohos/library_loader.cpp b/shell/platform/ohos/library_loader.cpp index 09cf2e9675..7f88815b7b 100644 --- a/shell/platform/ohos/library_loader.cpp +++ b/shell/platform/ohos/library_loader.cpp @@ -23,7 +23,7 @@ EXTERN_C_START static napi_value Init(napi_env env, napi_value exports) { - FML_DLOG(INFO) << "Flutter Init NAPI"; + FML_DLOG(INFO) << "Init NAPI Start."; napi_property_descriptor desc[] = { DECLARE_NAPI_FUNCTION("nativeInit", flutter::OhosMain::NativeInit), DECLARE_NAPI_FUNCTION( @@ -106,7 +106,9 @@ static napi_value Init(napi_env env, napi_value exports) { napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); bool ret = flutter::XComponentAdapter::GetInstance()->Export(env, exports); if (!ret) { - LOGE("Flutter Init NAPI Failed"); + LOGE("Init NAPI Failed."); + } else { + FML_DLOG(INFO) << "Init NAPI Succeed."; } return exports; } -- Gitee From 4eb0a95265bc4d28976ee5b0c01da6da40593f96 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Thu, 23 Nov 2023 21:07:47 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20libvmservice=5Fsnapsho?= =?UTF-8?q?t.so=20=E7=9B=B8=E5=85=B3=E7=9A=84=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- build/dart/rules.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/dart/rules.gni b/build/dart/rules.gni index ca7ea3519b..0de6690017 100644 --- a/build/dart/rules.gni +++ b/build/dart/rules.gni @@ -155,7 +155,7 @@ template("flutter_snapshot") { } else { output_aot_lib = "libapp.so" } - libapp = "$root_build_dir/$output_aot_lib" + libapp = "$target_gen_dir/ohos/libs/$target_cpu/$output_aot_lib" outputs += [ libapp ] args += [ "--snapshot_kind=app-aot-elf", -- Gitee From d983f065ede0ccd3662a1a37c2392a123309fb31 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Tue, 5 Dec 2023 15:42:19 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9vmservice=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- build/dart/rules.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/dart/rules.gni b/build/dart/rules.gni index 0de6690017..c239d536c1 100644 --- a/build/dart/rules.gni +++ b/build/dart/rules.gni @@ -155,7 +155,7 @@ template("flutter_snapshot") { } else { output_aot_lib = "libapp.so" } - libapp = "$target_gen_dir/ohos/libs/$target_cpu/$output_aot_lib" + libapp = "$target_gen_dir/ohos/libs/$output_aot_lib" outputs += [ libapp ] args += [ "--snapshot_kind=app-aot-elf", -- Gitee