From 4df528ce0cb6ab066899870359fa72df9e174fc4 Mon Sep 17 00:00:00 2001 From: zhuzhengjun Date: Wed, 10 Jan 2024 17:42:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhengjun --- shell/platform/ohos/ohos_image_generator.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/shell/platform/ohos/ohos_image_generator.cpp b/shell/platform/ohos/ohos_image_generator.cpp index 33d419af41..46211d3d75 100755 --- a/shell/platform/ohos/ohos_image_generator.cpp +++ b/shell/platform/ohos/ohos_image_generator.cpp @@ -157,14 +157,10 @@ napi_value OHOSImageGenerator::NativeImageDecodeCallback( napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); if (status != napi_ok) { LOGE("NativeImageDecodeCallback napi_get_cb_info error"); - generator->native_callback_latch_.Signal(); - return nullptr; } if (argc != 4) { FML_LOG(ERROR) << "argc is error"; - generator->native_callback_latch_.Signal(); - return nullptr; } // unwarp object -- Gitee From 2c43acbf3894d238b5f3dbadaf4202e80551327d Mon Sep 17 00:00:00 2001 From: zhuzhengjun Date: Wed, 10 Jan 2024 17:50:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9spawn=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhengjun --- .../flutter/src/main/cpp/types/libflutter/index.d.ets | 5 +++-- .../flutter/src/main/cpp/types/libflutter/index_actual.d.ets | 3 ++- .../flutter/src/main/ets/embedding/engine/FlutterNapi.ets | 2 +- shell/platform/ohos/napi/platform_view_ohos_napi.cpp | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/cpp/types/libflutter/index.d.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/cpp/types/libflutter/index.d.ets index 4453a518b0..c53957c7aa 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/cpp/types/libflutter/index.d.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/cpp/types/libflutter/index.d.ets @@ -52,7 +52,8 @@ export const nativeSpawn: ( entrypointFunctionName: string, pathToEntrypointFunction: string, initialRoute: string, - entrypointArgs: Array + entrypointArgs: Array, + napi: FlutterNapi ) => number; export const nativeRunBundleAndSnapshotFromLibrary: ( @@ -98,4 +99,4 @@ export const nativeXComponentDetachFlutterEngine: (xcomponentId: number, nativeS */ export const nativeDestroy: ( nativeShellHolderId: number -) => void; +) => void; \ No newline at end of file diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/cpp/types/libflutter/index_actual.d.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/cpp/types/libflutter/index_actual.d.ets index afab18030d..d3f5c0a65d 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/cpp/types/libflutter/index_actual.d.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/cpp/types/libflutter/index_actual.d.ets @@ -73,7 +73,8 @@ export const nativeSpawn: ( entrypointFunctionName: string, pathToEntrypointFunction: string, initialRoute: string, - entrypointArgs: Array + entrypointArgs: Array, + napi: FlutterNapi ) => number; /** diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets index d1fbaa8039..4b8d9a3a54 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets @@ -219,8 +219,8 @@ export default class FlutterNapi { } spawn(entrypointFunctionName: string, pathToEntrypointFunction: string, initialRoute: string, entrypointArgs: Array): FlutterNapi { - let shellHolderId: number = flutter.nativeSpawn(this.nativeShellHolderId, entrypointFunctionName, pathToEntrypointFunction, initialRoute, entrypointArgs) let flutterNapi = new FlutterNapi() + let shellHolderId: number = flutter.nativeSpawn(this.nativeShellHolderId, entrypointFunctionName, pathToEntrypointFunction, initialRoute, entrypointArgs, flutterNapi) flutterNapi.nativeShellHolderId = shellHolderId return flutterNapi; } diff --git a/shell/platform/ohos/napi/platform_view_ohos_napi.cpp b/shell/platform/ohos/napi/platform_view_ohos_napi.cpp index f6cea7a976..3572bee972 100644 --- a/shell/platform/ohos/napi/platform_view_ohos_napi.cpp +++ b/shell/platform/ohos/napi/platform_view_ohos_napi.cpp @@ -616,6 +616,8 @@ napi_value PlatformViewOHOSNapi::nativeSpawn(napi_env env, napi_callback_info in } std::shared_ptr napi_facade = std::make_shared(env); + napi_create_reference(env, args[5], 1, &(napi_facade->ref_napi_obj_)); + auto spawned_shell_holder = OHOS_SHELL_HOLDER->Spawn( napi_facade, entrypoint, libraryUrl, initial_route, entrypoint_args); @@ -1519,4 +1521,4 @@ napi_value PlatformViewOHOSNapi::nativeXComponentDetachFlutterEngine( return nullptr; } -} // namespace flutter +} // namespace flutter \ No newline at end of file -- Gitee