diff options
author | tsepez <tsepez@chromium.org> | 2016-05-26 12:39:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-26 12:39:34 -0700 |
commit | e3b2a4eca66e357df663a6f7464ef9af5e85883f (patch) | |
tree | b4d591b227e69f9652605fa941611c651e8d6fa4 | |
parent | 60607c3baaf52574cab748a97c213e447c9108c0 (diff) | |
download | pdfium-e3b2a4eca66e357df663a6f7464ef9af5e85883f.tar.xz |
Rename FXJSE_CLASS to avoid confusion with CFXJSE_CLASS
BUG=
Review-Url: https://codereview.chromium.org/2010013003
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 18 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_imp.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_imp.h | 6 | ||||
-rw-r--r-- | xfa/fxjse/class.cpp | 61 | ||||
-rw-r--r-- | xfa/fxjse/class.h | 6 | ||||
-rw-r--r-- | xfa/fxjse/context.cpp | 14 | ||||
-rw-r--r-- | xfa/fxjse/context.h | 9 | ||||
-rw-r--r-- | xfa/fxjse/dynprop.cpp | 42 | ||||
-rw-r--r-- | xfa/fxjse/include/fxjse.h | 19 |
10 files changed, 98 insertions, 83 deletions
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 7e5ddb9aec..9de77cb0b9 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -7072,7 +7072,7 @@ void CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg, FXJSE_Value_ToUTF8String(arg, szOutputString); } } -static FXJSE_FUNCTION formcalc_fm2js_functions[] = { +static FXJSE_FUNCTION_DESCRIPTOR formcalc_fm2js_functions[] = { {"Abs", CXFA_FM2JSContext::Abs}, {"Avg", CXFA_FM2JSContext::Avg}, {"Ceil", CXFA_FM2JSContext::Ceil}, @@ -7167,7 +7167,7 @@ static FXJSE_FUNCTION formcalc_fm2js_functions[] = { }; CXFA_FM2JSContext::CXFA_FM2JSContext() : m_pFMClass(nullptr), m_pDocument(nullptr) { - FXSYS_memset(&m_fmClass, 0, sizeof(FXJSE_CLASS)); + FXSYS_memset(&m_ClassDescriptor, 0, sizeof(FXJSE_CLASS_DESCRIPTOR)); } CXFA_FM2JSContext::~CXFA_FM2JSContext() { @@ -7180,14 +7180,14 @@ void CXFA_FM2JSContext::Initialize(v8::Isolate* pScriptIsolate, CXFA_Document* pDoc) { m_pDocument = pDoc; m_pIsolate = pScriptIsolate; - m_fmClass.name = "XFA_FM2JS_FormCalcClass"; - m_fmClass.constructor = NULL; - m_fmClass.properties = NULL; - m_fmClass.methods = formcalc_fm2js_functions; - m_fmClass.propNum = 0; - m_fmClass.methNum = + m_ClassDescriptor.name = "XFA_FM2JS_FormCalcClass"; + m_ClassDescriptor.constructor = NULL; + m_ClassDescriptor.properties = NULL; + m_ClassDescriptor.methods = formcalc_fm2js_functions; + m_ClassDescriptor.propNum = 0; + m_ClassDescriptor.methNum = sizeof(formcalc_fm2js_functions) / sizeof(formcalc_fm2js_functions[0]); - m_pFMClass = FXJSE_DefineClass(pScriptContext, &m_fmClass); + m_pFMClass = FXJSE_DefineClass(pScriptContext, &m_ClassDescriptor); m_pValue = FXJSE_Value_Create(pScriptIsolate); FXJSE_Value_SetNull(m_pValue); FXJSE_Value_SetObject(m_pValue, this, m_pFMClass); diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h index fc1a111a80..fa0c2c31e3 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h @@ -447,7 +447,7 @@ class CXFA_FM2JSContext { private: v8::Isolate* m_pIsolate; - FXJSE_CLASS m_fmClass; + FXJSE_CLASS_DESCRIPTOR m_ClassDescriptor; CFXJSE_Class* m_pFMClass; CFXJSE_Value* m_pValue; CXFA_Document* m_pDocument; diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index 743719ca55..7a0d6ff20f 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -33,8 +33,8 @@ CXFA_ScriptContext::CXFA_ScriptContext(CXFA_Document* pDocument) m_pThisObject(nullptr), m_dwBuiltInInFlags(0), m_eRunAtType(XFA_ATTRIBUTEENUM_Client) { - FXSYS_memset(&m_JsGlobalClass, 0, sizeof(FXJSE_CLASS)); - FXSYS_memset(&m_JsNormalClass, 0, sizeof(FXJSE_CLASS)); + FXSYS_memset(&m_JsGlobalClass, 0, sizeof(FXJSE_CLASS_DESCRIPTOR)); + FXSYS_memset(&m_JsNormalClass, 0, sizeof(FXJSE_CLASS_DESCRIPTOR)); } CXFA_ScriptContext::~CXFA_ScriptContext() { FX_POSITION ps = m_mapXFAToValue.GetStartPosition(); diff --git a/xfa/fxfa/parser/xfa_script_imp.h b/xfa/fxfa/parser/xfa_script_imp.h index 1060911e88..e69f8c1e70 100644 --- a/xfa/fxfa/parser/xfa_script_imp.h +++ b/xfa/fxfa/parser/xfa_script_imp.h @@ -105,10 +105,10 @@ class CXFA_ScriptContext { v8::Isolate* m_pIsolate; CFXJSE_Class* m_pJsClass; XFA_SCRIPTLANGTYPE m_eScriptType; - FXJSE_CLASS m_JsGlobalClass; - FXJSE_CLASS m_JsNormalClass; + FXJSE_CLASS_DESCRIPTOR m_JsGlobalClass; + FXJSE_CLASS_DESCRIPTOR m_JsNormalClass; CFX_MapPtrTemplate<CXFA_Object*, CFXJSE_Value*> m_mapXFAToValue; - FXJSE_CLASS m_JsGlobalVariablesClass; + FXJSE_CLASS_DESCRIPTOR m_JsGlobalVariablesClass; CFX_MapPtrTemplate<CXFA_Object*, CFXJSE_Context*> m_mapVariableToContext; CXFA_EventParam m_eventParam; CXFA_NodeArray m_upObjectArray; diff --git a/xfa/fxjse/class.cpp b/xfa/fxjse/class.cpp index a2f4146208..dcc370306a 100644 --- a/xfa/fxjse/class.cpp +++ b/xfa/fxjse/class.cpp @@ -25,15 +25,16 @@ static void FXJSE_V8SetterCallback_Wrapper( const v8::PropertyCallbackInfo<void>& info); CFXJSE_Class* FXJSE_DefineClass(CFXJSE_Context* pContext, - const FXJSE_CLASS* lpClass) { + const FXJSE_CLASS_DESCRIPTOR* lpClass) { ASSERT(pContext); return CFXJSE_Class::Create(pContext, lpClass, FALSE); } static void FXJSE_V8FunctionCallback_Wrapper( const v8::FunctionCallbackInfo<v8::Value>& info) { - const FXJSE_FUNCTION* lpFunctionInfo = - static_cast<FXJSE_FUNCTION*>(info.Data().As<v8::External>()->Value()); + const FXJSE_FUNCTION_DESCRIPTOR* lpFunctionInfo = + static_cast<FXJSE_FUNCTION_DESCRIPTOR*>( + info.Data().As<v8::External>()->Value()); if (!lpFunctionInfo) { return; } @@ -55,8 +56,9 @@ static void FXJSE_V8FunctionCallback_Wrapper( static void FXJSE_V8ClassGlobalConstructorCallback_Wrapper( const v8::FunctionCallbackInfo<v8::Value>& info) { - const FXJSE_CLASS* lpClassDefinition = - static_cast<FXJSE_CLASS*>(info.Data().As<v8::External>()->Value()); + const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition = + static_cast<FXJSE_CLASS_DESCRIPTOR*>( + info.Data().As<v8::External>()->Value()); if (!lpClassDefinition) { return; } @@ -79,8 +81,9 @@ static void FXJSE_V8ClassGlobalConstructorCallback_Wrapper( static void FXJSE_V8GetterCallback_Wrapper( v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) { - const FXJSE_PROPERTY* lpPropertyInfo = - static_cast<FXJSE_PROPERTY*>(info.Data().As<v8::External>()->Value()); + const FXJSE_PROPERTY_DESCRIPTOR* lpPropertyInfo = + static_cast<FXJSE_PROPERTY_DESCRIPTOR*>( + info.Data().As<v8::External>()->Value()); if (!lpPropertyInfo) { return; } @@ -100,8 +103,9 @@ static void FXJSE_V8SetterCallback_Wrapper( v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) { - const FXJSE_PROPERTY* lpPropertyInfo = - static_cast<FXJSE_PROPERTY*>(info.Data().As<v8::External>()->Value()); + const FXJSE_PROPERTY_DESCRIPTOR* lpPropertyInfo = + static_cast<FXJSE_PROPERTY_DESCRIPTOR*>( + info.Data().As<v8::External>()->Value()); if (!lpPropertyInfo) { return; } @@ -119,8 +123,9 @@ static void FXJSE_V8SetterCallback_Wrapper( static void FXJSE_V8ConstructorCallback_Wrapper( const v8::FunctionCallbackInfo<v8::Value>& info) { - const FXJSE_CLASS* lpClassDefinition = - static_cast<FXJSE_CLASS*>(info.Data().As<v8::External>()->Value()); + const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition = + static_cast<FXJSE_CLASS_DESCRIPTOR*>( + info.Data().As<v8::External>()->Value()); if (!lpClassDefinition) { return; } @@ -193,8 +198,8 @@ CFXJSE_Value* CFXJSE_Arguments::GetReturnValue() { } static void FXJSE_Context_GlobalObjToString( const v8::FunctionCallbackInfo<v8::Value>& info) { - const FXJSE_CLASS* lpClass = - static_cast<FXJSE_CLASS*>(info.Data().As<v8::External>()->Value()); + const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( + info.Data().As<v8::External>()->Value()); if (!lpClass) { return; } @@ -213,9 +218,10 @@ static void FXJSE_Context_GlobalObjToString( } } -CFXJSE_Class* CFXJSE_Class::Create(CFXJSE_Context* lpContext, - const FXJSE_CLASS* lpClassDefinition, - FX_BOOL bIsJSGlobal) { +CFXJSE_Class* CFXJSE_Class::Create( + CFXJSE_Context* lpContext, + const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition, + FX_BOOL bIsJSGlobal) { if (!lpContext || !lpClassDefinition) { return NULL; } @@ -231,7 +237,8 @@ CFXJSE_Class* CFXJSE_Class::Create(CFXJSE_Context* lpContext, CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); v8::Local<v8::FunctionTemplate> hFunctionTemplate = v8::FunctionTemplate::New( pIsolate, bIsJSGlobal ? 0 : FXJSE_V8ConstructorCallback_Wrapper, - v8::External::New(pIsolate, const_cast<FXJSE_CLASS*>(lpClassDefinition))); + v8::External::New( + pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition))); hFunctionTemplate->SetClassName( v8::String::NewFromUtf8(pIsolate, lpClassDefinition->name)); hFunctionTemplate->InstanceTemplate()->SetInternalFieldCount(1); @@ -250,7 +257,7 @@ CFXJSE_Class* CFXJSE_Class::Create(CFXJSE_Context* lpContext, lpClassDefinition->properties[i].setProc ? FXJSE_V8SetterCallback_Wrapper : NULL, - v8::External::New(pIsolate, const_cast<FXJSE_PROPERTY*>( + v8::External::New(pIsolate, const_cast<FXJSE_PROPERTY_DESCRIPTOR*>( lpClassDefinition->properties + i)), static_cast<v8::PropertyAttribute>(v8::DontDelete)); } @@ -261,8 +268,9 @@ CFXJSE_Class* CFXJSE_Class::Create(CFXJSE_Context* lpContext, v8::String::NewFromUtf8(pIsolate, lpClassDefinition->methods[i].name), v8::FunctionTemplate::New( pIsolate, FXJSE_V8FunctionCallback_Wrapper, - v8::External::New(pIsolate, const_cast<FXJSE_FUNCTION*>( - lpClassDefinition->methods + i))), + v8::External::New(pIsolate, + const_cast<FXJSE_FUNCTION_DESCRIPTOR*>( + lpClassDefinition->methods + i))), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete)); } } @@ -272,8 +280,8 @@ CFXJSE_Class* CFXJSE_Class::Create(CFXJSE_Context* lpContext, v8::String::NewFromUtf8(pIsolate, lpClassDefinition->name), v8::FunctionTemplate::New( pIsolate, FXJSE_V8ClassGlobalConstructorCallback_Wrapper, - v8::External::New(pIsolate, - const_cast<FXJSE_CLASS*>(lpClassDefinition))), + v8::External::New(pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>( + lpClassDefinition))), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete)); } else { v8::Local<v8::Context> hLocalContext = @@ -282,8 +290,9 @@ CFXJSE_Class* CFXJSE_Class::Create(CFXJSE_Context* lpContext, ->Set(v8::String::NewFromUtf8(pIsolate, lpClassDefinition->name), v8::Function::New( pIsolate, FXJSE_V8ClassGlobalConstructorCallback_Wrapper, - v8::External::New(pIsolate, const_cast<FXJSE_CLASS*>( - lpClassDefinition)))); + v8::External::New(pIsolate, + const_cast<FXJSE_CLASS_DESCRIPTOR*>( + lpClassDefinition)))); } } if (bIsJSGlobal) { @@ -291,8 +300,8 @@ CFXJSE_Class* CFXJSE_Class::Create(CFXJSE_Context* lpContext, v8::String::NewFromUtf8(pIsolate, "toString"), v8::FunctionTemplate::New( pIsolate, FXJSE_Context_GlobalObjToString, - v8::External::New(pIsolate, - const_cast<FXJSE_CLASS*>(lpClassDefinition)))); + v8::External::New(pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>( + lpClassDefinition)))); } pClass->m_hTemplate.Reset(lpContext->m_pIsolate, hFunctionTemplate); lpContext->m_rgClasses.push_back(std::unique_ptr<CFXJSE_Class>(pClass)); diff --git a/xfa/fxjse/class.h b/xfa/fxjse/class.h index db52979589..344adf4a47 100644 --- a/xfa/fxjse/class.h +++ b/xfa/fxjse/class.h @@ -25,18 +25,18 @@ class CFXJSE_Class { public: static CFXJSE_Class* Create(CFXJSE_Context* pContext, - const FXJSE_CLASS* lpClassDefintion, + const FXJSE_CLASS_DESCRIPTOR* lpClassDefintion, FX_BOOL bIsJSGlobal = FALSE); static CFXJSE_Class* GetClassFromContext(CFXJSE_Context* pContext, const CFX_ByteStringC& szName); static void SetUpNamedPropHandler( v8::Isolate* pIsolate, v8::Local<v8::ObjectTemplate>& hObjectTemplate, - const FXJSE_CLASS* lpClassDefinition); + const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition); protected: CFX_ByteString m_szClassName; - const FXJSE_CLASS* m_lpClassDefinition; + const FXJSE_CLASS_DESCRIPTOR* m_lpClassDefinition; CFXJSE_Context* m_pContext; v8::Global<v8::FunctionTemplate> m_hTemplate; friend class CFXJSE_Context; diff --git a/xfa/fxjse/context.cpp b/xfa/fxjse/context.cpp index bdc31e4594..333b2abe57 100644 --- a/xfa/fxjse/context.cpp +++ b/xfa/fxjse/context.cpp @@ -11,9 +11,10 @@ #include "xfa/fxjse/util_inline.h" #include "xfa/fxjse/value.h" -CFXJSE_Context* FXJSE_Context_Create(v8::Isolate* pIsolate, - const FXJSE_CLASS* lpGlobalClass, - void* lpGlobalObject) { +CFXJSE_Context* FXJSE_Context_Create( + v8::Isolate* pIsolate, + const FXJSE_CLASS_DESCRIPTOR* lpGlobalClass, + void* lpGlobalObject) { return CFXJSE_Context::Create(pIsolate, lpGlobalClass, lpGlobalObject); } @@ -111,9 +112,10 @@ v8::Local<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate, return hReturnValue; } -CFXJSE_Context* CFXJSE_Context::Create(v8::Isolate* pIsolate, - const FXJSE_CLASS* lpGlobalClass, - void* lpGlobalObject) { +CFXJSE_Context* CFXJSE_Context::Create( + v8::Isolate* pIsolate, + const FXJSE_CLASS_DESCRIPTOR* lpGlobalClass, + void* lpGlobalObject) { CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate); CFXJSE_Context* pContext = new CFXJSE_Context(pIsolate); CFXJSE_Class* lpGlobalClassObj = NULL; diff --git a/xfa/fxjse/context.h b/xfa/fxjse/context.h index 38338311e3..96b93faffd 100644 --- a/xfa/fxjse/context.h +++ b/xfa/fxjse/context.h @@ -16,13 +16,14 @@ class CFXJSE_Class; class CFXJSE_Value; -struct FXJSE_CLASS; +struct FXJSE_CLASS_DESCRIPTOR; class CFXJSE_Context { public: - static CFXJSE_Context* Create(v8::Isolate* pIsolate, - const FXJSE_CLASS* lpGlobalClass = nullptr, - void* lpGlobalObject = nullptr); + static CFXJSE_Context* Create( + v8::Isolate* pIsolate, + const FXJSE_CLASS_DESCRIPTOR* lpGlobalClass = nullptr, + void* lpGlobalObject = nullptr); ~CFXJSE_Context(); V8_INLINE v8::Isolate* GetRuntime(void) { return m_pIsolate; } diff --git a/xfa/fxjse/dynprop.cpp b/xfa/fxjse/dynprop.cpp index 514f1b3a9d..8a2c67126a 100644 --- a/xfa/fxjse/dynprop.cpp +++ b/xfa/fxjse/dynprop.cpp @@ -11,7 +11,7 @@ static void FXJSE_DynPropGetterAdapter_MethodCallback( const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> hCallBackInfo = info.Data().As<v8::Object>(); - FXJSE_CLASS* lpClass = static_cast<FXJSE_CLASS*>( + FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( hCallBackInfo->GetAlignedPointerFromInternalField(0)); v8::Local<v8::String> hPropName = hCallBackInfo->GetInternalField(1).As<v8::String>(); @@ -33,7 +33,7 @@ static void FXJSE_DynPropGetterAdapter_MethodCallback( lpThisValue = nullptr; } -static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS* lpClass, +static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, CFXJSE_Value* pObject, const CFX_ByteStringC& szPropName, CFXJSE_Value* pValue) { @@ -56,7 +56,7 @@ static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS* lpClass, v8::Local<v8::Object> hCallBackInfo = hCallBackInfoTemplate->NewInstance(); hCallBackInfo->SetAlignedPointerInInternalField( - 0, const_cast<FXJSE_CLASS*>(lpClass)); + 0, const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClass)); hCallBackInfo->SetInternalField( 1, v8::String::NewFromUtf8( pIsolate, reinterpret_cast<const char*>(szPropName.raw_str()), @@ -68,7 +68,7 @@ static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS* lpClass, } } -static void FXJSE_DynPropSetterAdapter(const FXJSE_CLASS* lpClass, +static void FXJSE_DynPropSetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, CFXJSE_Value* pObject, const CFX_ByteStringC& szPropName, CFXJSE_Value* pValue) { @@ -84,7 +84,7 @@ static void FXJSE_DynPropSetterAdapter(const FXJSE_CLASS* lpClass, } } -static FX_BOOL FXJSE_DynPropQueryAdapter(const FXJSE_CLASS* lpClass, +static FX_BOOL FXJSE_DynPropQueryAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, CFXJSE_Value* pObject, const CFX_ByteStringC& szPropName) { ASSERT(lpClass); @@ -95,9 +95,10 @@ static FX_BOOL FXJSE_DynPropQueryAdapter(const FXJSE_CLASS* lpClass, return nPropType != FXJSE_ClassPropType_None; } -static FX_BOOL FXJSE_DynPropDeleterAdapter(const FXJSE_CLASS* lpClass, - CFXJSE_Value* pObject, - const CFX_ByteStringC& szPropName) { +static FX_BOOL FXJSE_DynPropDeleterAdapter( + const FXJSE_CLASS_DESCRIPTOR* lpClass, + CFXJSE_Value* pObject, + const CFX_ByteStringC& szPropName) { ASSERT(lpClass); int32_t nPropType = lpClass->dynPropTypeGetter == nullptr @@ -117,8 +118,8 @@ static void FXJSE_V8_GenericNamedPropertyQueryCallback( v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Integer>& info) { v8::Local<v8::Object> thisObject = info.This(); - const FXJSE_CLASS* lpClass = - static_cast<FXJSE_CLASS*>(info.Data().As<v8::External>()->Value()); + const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( + info.Data().As<v8::External>()->Value()); v8::Isolate* pIsolate = info.GetIsolate(); v8::HandleScope scope(pIsolate); v8::String::Utf8Value szPropName(property); @@ -139,8 +140,8 @@ static void FXJSE_V8_GenericNamedPropertyDeleterCallback( v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Boolean>& info) { v8::Local<v8::Object> thisObject = info.This(); - const FXJSE_CLASS* lpClass = - static_cast<FXJSE_CLASS*>(info.Data().As<v8::External>()->Value()); + const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( + info.Data().As<v8::External>()->Value()); v8::Isolate* pIsolate = info.GetIsolate(); v8::HandleScope scope(pIsolate); v8::String::Utf8Value szPropName(property); @@ -157,8 +158,8 @@ static void FXJSE_V8_GenericNamedPropertyGetterCallback( v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> thisObject = info.This(); - const FXJSE_CLASS* lpClass = - static_cast<FXJSE_CLASS*>(info.Data().As<v8::External>()->Value()); + const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( + info.Data().As<v8::External>()->Value()); v8::String::Utf8Value szPropName(property); CFX_ByteStringC szFxPropName(*szPropName, szPropName.length()); CFXJSE_Value* lpThisValue = CFXJSE_Value::Create(info.GetIsolate()); @@ -175,8 +176,8 @@ static void FXJSE_V8_GenericNamedPropertySetterCallback( v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> thisObject = info.This(); - const FXJSE_CLASS* lpClass = - static_cast<FXJSE_CLASS*>(info.Data().As<v8::External>()->Value()); + const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( + info.Data().As<v8::External>()->Value()); v8::String::Utf8Value szPropName(property); CFX_ByteStringC szFxPropName(*szPropName, szPropName.length()); CFXJSE_Value* lpThisValue = CFXJSE_Value::Create(info.GetIsolate()); @@ -191,8 +192,8 @@ static void FXJSE_V8_GenericNamedPropertySetterCallback( static void FXJSE_V8_GenericNamedPropertyEnumeratorCallback( const v8::PropertyCallbackInfo<v8::Array>& info) { - const FXJSE_CLASS* lpClass = - static_cast<FXJSE_CLASS*>(info.Data().As<v8::External>()->Value()); + const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( + info.Data().As<v8::External>()->Value()); v8::Isolate* pIsolate = info.GetIsolate(); v8::Local<v8::Array> newArray = v8::Array::New(pIsolate, lpClass->propNum); for (int i = 0; i < lpClass->propNum; i++) { @@ -205,7 +206,7 @@ static void FXJSE_V8_GenericNamedPropertyEnumeratorCallback( void CFXJSE_Class::SetUpNamedPropHandler( v8::Isolate* pIsolate, v8::Local<v8::ObjectTemplate>& hObjectTemplate, - const FXJSE_CLASS* lpClassDefinition) { + const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition) { v8::NamedPropertyHandlerConfiguration configuration( lpClassDefinition->dynPropGetter ? FXJSE_V8_GenericNamedPropertyGetterCallback @@ -220,7 +221,8 @@ void CFXJSE_Class::SetUpNamedPropHandler( ? FXJSE_V8_GenericNamedPropertyDeleterCallback : 0, FXJSE_V8_GenericNamedPropertyEnumeratorCallback, - v8::External::New(pIsolate, const_cast<FXJSE_CLASS*>(lpClassDefinition)), + v8::External::New(pIsolate, + const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)), v8::PropertyHandlerFlags::kNonMasking); hObjectTemplate->SetHandler(configuration); } diff --git a/xfa/fxjse/include/fxjse.h b/xfa/fxjse/include/fxjse.h index 4484303046..e5d80ca245 100644 --- a/xfa/fxjse/include/fxjse.h +++ b/xfa/fxjse/include/fxjse.h @@ -39,22 +39,22 @@ enum FXJSE_CompatibleModeFlags { FXJSE_COMPATIBLEMODEFLAGCOUNT = 1, }; -struct FXJSE_FUNCTION { +struct FXJSE_FUNCTION_DESCRIPTOR { const FX_CHAR* name; FXJSE_FuncCallback callbackProc; }; -struct FXJSE_PROPERTY { +struct FXJSE_PROPERTY_DESCRIPTOR { const FX_CHAR* name; FXJSE_PropAccessor getProc; FXJSE_PropAccessor setProc; }; -struct FXJSE_CLASS { +struct FXJSE_CLASS_DESCRIPTOR { const FX_CHAR* name; FXJSE_FuncCallback constructor; - FXJSE_PROPERTY* properties; - FXJSE_FUNCTION* methods; + FXJSE_PROPERTY_DESCRIPTOR* properties; + FXJSE_FUNCTION_DESCRIPTOR* methods; int32_t propNum; int32_t methNum; FXJSE_PropTypeGetter dynPropTypeGetter; @@ -70,9 +70,10 @@ void FXJSE_Finalize(); v8::Isolate* FXJSE_Runtime_Create(); void FXJSE_Runtime_Release(v8::Isolate* pIsolate, bool bOwnedRuntime); -CFXJSE_Context* FXJSE_Context_Create(v8::Isolate* pIsolate, - const FXJSE_CLASS* lpGlobalClass = nullptr, - void* lpGlobalObject = nullptr); +CFXJSE_Context* FXJSE_Context_Create( + v8::Isolate* pIsolate, + const FXJSE_CLASS_DESCRIPTOR* lpGlobalClass = nullptr, + void* lpGlobalObject = nullptr); void FXJSE_Context_Release(CFXJSE_Context* pContext); CFXJSE_Value* FXJSE_Context_GetGlobalObject(CFXJSE_Context* pContext); @@ -80,7 +81,7 @@ void FXJSE_Context_EnableCompatibleMode(CFXJSE_Context* pContext, uint32_t dwCompatibleFlags); CFXJSE_Class* FXJSE_DefineClass(CFXJSE_Context* pContext, - const FXJSE_CLASS* lpClass); + const FXJSE_CLASS_DESCRIPTOR* lpClass); CFXJSE_Value* FXJSE_Value_Create(v8::Isolate* pIsolate); void FXJSE_Value_Release(CFXJSE_Value* pValue); |