summaryrefslogtreecommitdiff
path: root/fxjs/cjx_object.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-12-11 22:01:08 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-11 22:01:08 +0000
commitcb22f9ad9265f40b1104ed2b09488ccc6ec9e5aa (patch)
tree4aaa14dfb0528268fb9a9a94a4cac82df1af4602 /fxjs/cjx_object.h
parent731526e3b9f32ceac1cdac600fe3ecd55a0bc9b5 (diff)
downloadpdfium-cb22f9ad9265f40b1104ed2b09488ccc6ec9e5aa.tar.xz
[xfa] Refactor CJX method signatures.
This CL changes the CJX methods from void (*)(CFXJSE_Arguments*) to CJS_Return (*)(CJS_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) which is closer to how CJS works in practice. Change-Id: I3a3129268acfe4262dfeb04179919ed19f6c24e1 Reviewed-on: https://pdfium-review.googlesource.com/20491 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cjx_object.h')
-rw-r--r--fxjs/cjx_object.h22
1 files changed, 14 insertions, 8 deletions
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 <map>
#include <memory>
+#include <vector>
#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<v8::Local<v8::Value>>& 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<v8::Local<v8::Value>>& params);
bool HasAttribute(XFA_Attribute eAttr);
bool SetAttribute(XFA_Attribute eAttr,