Skip to content

Commit

Permalink
feat(ohos): jsi clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
zealotchen0 committed Dec 11, 2024
1 parent 808e7a6 commit f83d1df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 1 addition & 3 deletions driver/js/src/napi/jsh/jsh_ctx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ JSVM_Value InvokeJsCallbackOnConstruct(JSVM_Env env, JSVM_CallbackInfo info) {
for (size_t i = 0; i < argc; i++) {
cb_info.AddValue(std::make_shared<JSHCtxValue>(env, argv[i]));
}

void *wrap_result = nullptr;
status = OH_JSVM_RemoveWrap(env, thisArg, &wrap_result);

status = OH_JSVM_Wrap(env, thisArg, cb_info.GetData(), nullptr, nullptr, nullptr);
FOOTSTONE_DCHECK(status == JSVM_OK);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void GetTurboModule(CallbackInfo& info, void* data) {
auto module = turboManager.Call("get", args);
auto module_object_ref = arkTs.CreateReference(module);
auto module_object = std::make_shared<Turbo>(module_object_ref);

// 3. constructor c++ JavaTurboModule
auto arkTs_turbo_module = std::make_shared<ArkTsTurboModule>(u8_name, module_object, ctx, env);

Expand All @@ -116,11 +116,11 @@ void GetTurboModule(CallbackInfo& info, void* data) {
scope->SetTurboHostObject(u8_name, arkTs_turbo_module);

FOOTSTONE_DLOG(INFO) << "return module = " << name;
info.GetReturnValue()->Set(result);
info.GetReturnValue()->Set(result);
});
} else {
result = scope->GetTurboInstance(u8_name);
info.GetReturnValue()->Set(result);
info.GetReturnValue()->Set(result);
FOOTSTONE_DLOG(INFO) << "return cached module = " << name;
}
FOOTSTONE_DLOG(INFO) << "[turbo-perf] exit getTurboModule";
Expand All @@ -144,8 +144,7 @@ int Install(napi_env env, napi_callback_info info) {
auto turbo = std::make_shared<Turbo>(object_ref);
scope->SetTurbo(turbo);
InitTurbo(env);

// v8的操作放到js线程

auto runner = scope->GetTaskRunner();
if (!runner) {
FOOTSTONE_LOG(WARNING) << "TurboModuleManager install, runner invalid";
Expand Down

0 comments on commit f83d1df

Please sign in to comment.