mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 17:21:11 +00:00
Add workload when oom
Issue: https://e.gitee.com/openharmony/issues/table?issue=IAU2J2 Signed-off-by: quiet-thought <chenjingxiang1@huawei.com> Change-Id: I9fb50d508766a16f4239dc7535940eff8974c2e3
This commit is contained in:
parent
e4e8fa2cb6
commit
ad510b912e
@ -355,8 +355,16 @@ void ArkJSRuntime::ThrowError(const std::string& msg, int32_t code)
|
|||||||
void ArkJSRuntime::RegisterUncaughtExceptionHandler(UncaughtExceptionCallback callback)
|
void ArkJSRuntime::RegisterUncaughtExceptionHandler(UncaughtExceptionCallback callback)
|
||||||
{
|
{
|
||||||
JSNApi::EnableUserUncaughtErrorHandler(vm_);
|
JSNApi::EnableUserUncaughtErrorHandler(vm_);
|
||||||
|
std::weak_ptr<ArkJSRuntime> weakThis = shared_from_this();
|
||||||
JSNApi::RegisterUncatchableErrorHandler(vm_,
|
JSNApi::RegisterUncatchableErrorHandler(vm_,
|
||||||
std::bind(&ArkJSRuntime::HandleUncaughtExceptionWithoutNativeEngine, this, std::placeholders::_1, nullptr));
|
[weakThis](auto& tryCatch) {
|
||||||
|
auto sharedThis = weakThis.lock();
|
||||||
|
if (sharedThis) {
|
||||||
|
sharedThis->HandleUncaughtExceptionWithoutNativeEngine(tryCatch, nullptr);
|
||||||
|
} else {
|
||||||
|
LOGE("ArkJSRuntime has been destructed.");
|
||||||
|
}
|
||||||
|
});
|
||||||
uncaughtErrorHandler_ = callback;
|
uncaughtErrorHandler_ = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user