jsruntime Use Case Supplement

Issue:https://gitcode.com/openharmony/ability_ability_runtime/issues/15874?ref=&did=4225421#tid-4225421

Signed-off-by: rentangyu <rentangyu@huawei.com>

AI[0%] Human Fixed[0%] Human[100%] AI Adopted[0%]
This commit is contained in:
rentangyu
2026-08-06 16:03:00 +08:00
parent 4aaaa57c56
commit 2900a1cf42
3 changed files with 106 additions and 8 deletions
+5 -5
View File
@@ -483,7 +483,7 @@ bool JsRuntime::LoadRepairPatch(const std::string& hqfFile, const std::string& h
auto vm = GetEcmaVm();
CHECK_POINTER_AND_RETURN(vm, false);
InitSourceMap(hqfFile);
HqfInitSourceMap(hqfFile);
std::string patchFile;
auto hqfSafeData = GetSafeData(hqfFile, patchFile);
@@ -788,7 +788,7 @@ bool JsRuntime::Initialize(const Options& options)
}
if (!options.preload) {
SourceMapInit(options.bundleName);
InitSourceMap(options.bundleName);
if (options.isUnique) {
TAG_LOGD(AAFwkTag::JSRUNTIME, "Not supported TimerModule when form render");
@@ -1004,7 +1004,7 @@ void JsRuntime::CreatePluginDefaultNamespace(const std::string &lddictionaries)
moduleManager->InheritNamespaceEachOther(currentNamespace, pluginDefaultNamespace);
}
void JsRuntime::SourceMapInit(const std::string bundleName)
void JsRuntime::InitSourceMap(const std::string bundleName)
{
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
CHECK_POINTER(jsEnv_);
@@ -1026,7 +1026,7 @@ void JsRuntime::SourceMapInit(const std::string bundleName)
ffrt::submit(init, {}, {}, ffrt::task_attr().qos(ffrt::qos_user_initiated));
}
void JsRuntime::InitSourceMap(const std::string hqfFilePath)
void JsRuntime::HqfInitSourceMap(const std::string hqfFilePath)
{
std::string patchSoureMapFile;
std::vector<uint8_t> soureMapBuffer;
@@ -1686,7 +1686,7 @@ void JsRuntime::RegisterQuickFixQueryFunc(const std::map<std::string, std::strin
CHECK_POINTER(vm);
for (auto it = moduleAndPath.begin(); it != moduleAndPath.end(); it++) {
std::string hqfFile(AbilityBase::GetLoadPath(it->second));
InitSourceMap(hqfFile);
HqfInitSourceMap(hqfFile);
}
panda::JSNApi::RegisterQuickFixQueryFunc(vm, JsQuickfixCallback(moduleAndPath));
}