From cb22f9ad9265f40b1104ed2b09488ccc6ec9e5aa Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 11 Dec 2017 22:01:08 +0000 Subject: [xfa] Refactor CJX method signatures. This CL changes the CJX methods from void (*)(CFXJSE_Arguments*) to CJS_Return (*)(CJS_V8* runtime, const std::vector>& params) which is closer to how CJS works in practice. Change-Id: I3a3129268acfe4262dfeb04179919ed19f6c24e1 Reviewed-on: https://pdfium-review.googlesource.com/20491 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- fxjs/cfxjse_engine.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'fxjs/cfxjse_engine.h') diff --git a/fxjs/cfxjse_engine.h b/fxjs/cfxjse_engine.h index 5310a5c1a5..9541f7b26b 100644 --- a/fxjs/cfxjse_engine.h +++ b/fxjs/cfxjse_engine.h @@ -11,8 +11,8 @@ #include #include -#include "fxjs/cfxjse_arguments.h" #include "fxjs/cfxjse_formcalc_context.h" +#include "fxjs/cjs_v8.h" #include "xfa/fxfa/cxfa_eventparam.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" @@ -22,8 +22,9 @@ class CXFA_List; class CFXJSE_ResolveProcessor; -class CFXJSE_Engine { +class CFXJSE_Engine : public CJS_V8 { public: + static CXFA_Object* ToObject(const v8::FunctionCallbackInfo& info); static CXFA_Object* ToObject(CFXJSE_Value* pValue, CFXJSE_Class* pClass); static void GlobalPropertyGetter(CFXJSE_Value* pObject, const ByteStringView& szPropName, @@ -37,9 +38,9 @@ class CFXJSE_Engine { static void NormalPropertySetter(CFXJSE_Value* pObject, const ByteStringView& szPropName, CFXJSE_Value* pValue); - static void NormalMethodCall(CFXJSE_Value* hThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args); + static CJS_Return NormalMethodCall( + const v8::FunctionCallbackInfo& info, + const WideString& functionName); static int32_t NormalPropTypeGetter(CFXJSE_Value* pObject, const ByteStringView& szPropName, bool bQueryIn); @@ -48,7 +49,7 @@ class CFXJSE_Engine { bool bQueryIn); explicit CFXJSE_Engine(CXFA_Document* pDocument, v8::Isolate* pIsolate); - ~CFXJSE_Engine(); + ~CFXJSE_Engine() override; void SetEventParam(CXFA_EventParam param) { m_eventParam = param; } CXFA_EventParam* GetEventParam() { return &m_eventParam; } @@ -65,7 +66,6 @@ class CFXJSE_Engine { CFXJSE_Value* GetJSValueFromMap(CXFA_Object* pObject); void AddToCacheList(std::unique_ptr pList); CXFA_Object* GetThisObject() const { return m_pThisObject; } - v8::Isolate* GetRuntime() const { return m_pIsolate; } int32_t GetIndexByName(CXFA_Node* refNode); int32_t GetIndexByClassName(CXFA_Node* refNode); @@ -101,7 +101,6 @@ class CFXJSE_Engine { UnownedPtr const m_pDocument; std::unique_ptr m_JsContext; - v8::Isolate* m_pIsolate; CFXJSE_Class* m_pJsClass; CXFA_ScriptData::Type m_eScriptType; std::map> m_mapObjectToValue; -- cgit v1.2.3