mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-27 20:20:52 +00:00
!6758 Change ThreadState to native during calling native method inside ArkNativeFunctionCallBack
Merge pull request !6758 from Aleksandr Emelenko/panda-add-native-scope-interfaces-for-internalnativemethod
This commit is contained in:
commit
6e3eb5f249
@ -1033,6 +1033,18 @@ private:
|
||||
bool isRevert_ = false;
|
||||
};
|
||||
|
||||
class ECMA_PUBLIC_API JsiNativeScope {
|
||||
public:
|
||||
explicit JsiNativeScope(const EcmaVM *vm);
|
||||
~JsiNativeScope();
|
||||
ECMA_DISALLOW_COPY(JsiNativeScope);
|
||||
ECMA_DISALLOW_MOVE(JsiNativeScope);
|
||||
|
||||
private:
|
||||
JSThread *thread_;
|
||||
uint16_t oldThreadState_;
|
||||
};
|
||||
|
||||
/**
|
||||
* JsiRuntimeCallInfo is used for ace_engine and napi, is same to ark EcamRuntimeCallInfo except data.
|
||||
*/
|
||||
|
@ -2728,6 +2728,20 @@ JSExecutionScope::~JSExecutionScope()
|
||||
isRevert_ = false;
|
||||
}
|
||||
|
||||
// ------------------------------------ JsiNativeScope -----------------------------------------------
|
||||
|
||||
JsiNativeScope::JsiNativeScope(const EcmaVM *vm)
|
||||
{
|
||||
thread_ = vm->GetAssociatedJSThread();
|
||||
oldThreadState_ = static_cast<uint16_t>(thread_->GetState());
|
||||
thread_->UpdateState(ecmascript::ThreadState::NATIVE);
|
||||
}
|
||||
|
||||
JsiNativeScope::~JsiNativeScope()
|
||||
{
|
||||
thread_->UpdateState(static_cast<ecmascript::ThreadState>(oldThreadState_));
|
||||
}
|
||||
|
||||
// ------------------------------------ JsiRuntimeCallInfo -----------------------------------------------
|
||||
void *JsiRuntimeCallInfo::GetData()
|
||||
{
|
||||
|
@ -69,6 +69,7 @@
|
||||
panda::Exception::*;
|
||||
panda::JSON::*;
|
||||
panda::JsiRuntimeCallInfo::*;
|
||||
panda::JsiNativeScope::*;
|
||||
panda::JSExecutionScope::*;
|
||||
|
||||
panda::ecmascript::Log::*;
|
||||
|
Loading…
Reference in New Issue
Block a user