diff options
Diffstat (limited to 'fxjs/js_define.h')
-rw-r--r-- | fxjs/js_define.h | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/fxjs/js_define.h b/fxjs/js_define.h index 325642d8ce..93dfd49099 100644 --- a/fxjs/js_define.h +++ b/fxjs/js_define.h @@ -63,13 +63,12 @@ void JSPropGetter(const char* prop_name_string, const char* class_name_string, v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) { - CJS_Runtime* pRuntime = - CJS_Runtime::RuntimeFromIsolateCurrentContext(info.GetIsolate()); - if (!pRuntime) + CJS_Object* pJSObj = CFXJS_Engine::GetObjectPrivate(info.Holder()); + if (!pJSObj) return; - CJS_Object* pJSObj = pRuntime->GetObjectPrivate(info.Holder()); - if (!pJSObj) + CJS_Runtime* pRuntime = pJSObj->GetRuntime(); + if (!pRuntime) return; C* pObj = static_cast<C*>(pJSObj); @@ -90,13 +89,12 @@ void JSPropSetter(const char* prop_name_string, v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) { - CJS_Runtime* pRuntime = - CJS_Runtime::RuntimeFromIsolateCurrentContext(info.GetIsolate()); - if (!pRuntime) + CJS_Object* pJSObj = CFXJS_Engine::GetObjectPrivate(info.Holder()); + if (!pJSObj) return; - CJS_Object* pJSObj = pRuntime->GetObjectPrivate(info.Holder()); - if (!pJSObj) + CJS_Runtime* pRuntime = pJSObj->GetRuntime(); + if (!pRuntime) return; C* pObj = static_cast<C*>(pJSObj); @@ -113,13 +111,12 @@ template <class C, void JSMethod(const char* method_name_string, const char* class_name_string, const v8::FunctionCallbackInfo<v8::Value>& info) { - CJS_Runtime* pRuntime = - CJS_Runtime::RuntimeFromIsolateCurrentContext(info.GetIsolate()); - if (!pRuntime) + CJS_Object* pJSObj = CFXJS_Engine::GetObjectPrivate(info.Holder()); + if (!pJSObj) return; - CJS_Object* pJSObj = pRuntime->GetObjectPrivate(info.Holder()); - if (!pJSObj) + CJS_Runtime* pRuntime = pJSObj->GetRuntime(); + if (!pRuntime) return; std::vector<v8::Local<v8::Value>> parameters; |