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/cjx_object.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'fxjs/cjx_object.h') diff --git a/fxjs/cjx_object.h b/fxjs/cjx_object.h index c945c1e832..fb6251e224 100644 --- a/fxjs/cjx_object.h +++ b/fxjs/cjx_object.h @@ -9,14 +9,25 @@ #include #include +#include #include "core/fxcrt/unowned_ptr.h" #include "core/fxcrt/widestring.h" #include "core/fxcrt/xml/cfx_xmlelement.h" +#include "third_party/base/optional.h" #include "xfa/fxfa/fxfa_basic.h" -typedef void (*CJX_MethodCall)(CJX_Object* obj, CFXJSE_Arguments* args); +class CFXJSE_Value; +class CJS_V8; +class CXFA_CalcData; +class CXFA_Document; +class CXFA_Object; +struct XFA_MAPMODULEDATA; +typedef CJS_Return (*CJX_MethodCall)( + CJX_Object* obj, + CJS_V8* runtime, + const std::vector>& params); struct CJX_MethodSpec { const char* pName; CJX_MethodCall pMethodCall; @@ -30,12 +41,6 @@ struct XFA_MAPDATABLOCKCALLBACKINFO { PD_CALLBACK_DUPLICATEDATA pCopy; }; -class CFXJSE_Value; -class CXFA_CalcData; -class CXFA_Document; -class CXFA_Object; -struct XFA_MAPMODULEDATA; - class CJX_Object { public: virtual ~CJX_Object(); @@ -46,7 +51,8 @@ class CJX_Object { CXFA_Document* GetDocument() const; bool HasMethod(const WideString& func) const; - void RunMethod(const WideString& func, CFXJSE_Arguments* args); + CJS_Return RunMethod(const WideString& func, + const std::vector>& params); bool HasAttribute(XFA_Attribute eAttr); bool SetAttribute(XFA_Attribute eAttr, -- cgit v1.2.3