From e6d7ccaf0faeec9bc4fb1759030995c96d8af331 Mon Sep 17 00:00:00 2001 From: yanzhiqi1 Date: Tue, 3 Jun 2025 20:22:19 +0800 Subject: [PATCH] wssocket Issue: #ICBQLL Signed-off-by: yanzhiqi1 Change-Id: Ib8ac8f74a514b4be9fbf52065208d458a625a807 --- frameworks/native/runtime/js_runtime.cpp | 9 +++++++++ frameworks/native/runtime/sts_runtime.cpp | 9 +++++++-- interfaces/inner_api/runtime/include/js_runtime.h | 1 + interfaces/inner_api/runtime/include/sts_runtime.h | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/frameworks/native/runtime/js_runtime.cpp b/frameworks/native/runtime/js_runtime.cpp index dff76364e4d..262fe864529 100644 --- a/frameworks/native/runtime/js_runtime.cpp +++ b/frameworks/native/runtime/js_runtime.cpp @@ -1716,5 +1716,14 @@ void JsRuntime::RegisterUncaughtExceptionHandler(void* uncaughtExceptionInfo) CHECK_POINTER(jsEnv_); jsEnv_->RegisterUncaughtExceptionHandler(*static_cast(uncaughtExceptionInfo)); } + +DebuggerPostTask JsRuntime::GetDebuggerPostTask() +{ + if (!jsEnv_) { + TAG_LOGE(AAFwkTag::JSRUNTIME, "jsEnv_ is nullptr"); + return nullptr; + } + return jsEnv_->GetDebuggerPostTask(); +} } // namespace AbilityRuntime } // namespace OHOS diff --git a/frameworks/native/runtime/sts_runtime.cpp b/frameworks/native/runtime/sts_runtime.cpp index d84c6d2eb41..390936991d4 100644 --- a/frameworks/native/runtime/sts_runtime.cpp +++ b/frameworks/native/runtime/sts_runtime.cpp @@ -210,6 +210,8 @@ private: AppLibPathVec STSRuntime::appLibPaths_; +AbilityRuntime::JsRuntime* STSRuntime::jsRuntime_ = nullptr; + std::unique_ptr STSRuntime::PreFork(const Options& options) { TAG_LOGD(AAFwkTag::STSRUNTIME, "PreFork begin"); @@ -254,6 +256,7 @@ void STSRuntime::PostFork(const Options &options, std::vector& aniOp std::unique_ptr STSRuntime::Create(const Options& options, JsRuntime* jsRuntime) { + STSRuntime::jsRuntime_ = static_cast(jsRuntime); TAG_LOGD(AAFwkTag::STSRUNTIME, "create ets runtime"); std::unique_ptr instance; auto preloadedInstance = Runtime::GetPreloaded(options.lang); @@ -391,7 +394,9 @@ void STSRuntime::DebuggerConnectionHandler(bool isDebugApp, bool isStartWithDebu TAG_LOGE(AAFwkTag::STSRUNTIME, "null stsEnv"); return; } - ark::ArkDebugNativeAPI::NotifyDebugMode(getproctid(), instanceId_, isStartWithDebug); + ark::ArkDebugNativeAPI::NotifyDebugMode(getproctid(), instanceId_, isStartWithDebug, + STSRuntime::jsRuntime_->GetEcmaVm(), + STSRuntime::jsRuntime_->GetDebuggerPostTask()); } void STSRuntime::UnLoadSTSAppLibrary() @@ -721,7 +726,7 @@ void STSRuntime::StopDebugMode() CHECK_POINTER(stsEnv_); if (stsEnv_->debugMode_) { ConnectServerManager::Get().RemoveInstance(instanceId_); - ark::ArkDebugNativeAPI::StopDebugger(); + ark::ArkDebugNativeAPI::StopDebugger(STSRuntime::jsRuntime_->GetEcmaVm()); } } diff --git a/interfaces/inner_api/runtime/include/js_runtime.h b/interfaces/inner_api/runtime/include/js_runtime.h index fbf74d0440f..04f8cbca832 100644 --- a/interfaces/inner_api/runtime/include/js_runtime.h +++ b/interfaces/inner_api/runtime/include/js_runtime.h @@ -159,6 +159,7 @@ public: void UpdatePkgContextInfoJson(const std::string& moduleName, const std::string& hapPath, const std::string& packageName); void RegisterUncaughtExceptionHandler(void* uncaughtExceptionInfo) override; + DebuggerPostTask GetDebuggerPostTask(); private: void FinishPreload() override; diff --git a/interfaces/inner_api/runtime/include/sts_runtime.h b/interfaces/inner_api/runtime/include/sts_runtime.h index 020b34d627b..ca5a74bb208 100644 --- a/interfaces/inner_api/runtime/include/sts_runtime.h +++ b/interfaces/inner_api/runtime/include/sts_runtime.h @@ -137,6 +137,7 @@ private: void StopDebugMode(); public: + static AbilityRuntime::JsRuntime* jsRuntime_; bool debugMode_ = false; // std::mutex mutex_; }; -- Gitee