diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-12-11 22:01:08 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-12-11 22:01:08 +0000 |
commit | cb22f9ad9265f40b1104ed2b09488ccc6ec9e5aa (patch) | |
tree | 4aaa14dfb0528268fb9a9a94a4cac82df1af4602 /fxjs/CJX_Define.h | |
parent | 731526e3b9f32ceac1cdac600fe3ecd55a0bc9b5 (diff) | |
download | pdfium-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_Define.h')
-rw-r--r-- | fxjs/CJX_Define.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/fxjs/CJX_Define.h b/fxjs/CJX_Define.h index 3d8a84b7ac..070e7d7557 100644 --- a/fxjs/CJX_Define.h +++ b/fxjs/CJX_Define.h @@ -7,18 +7,28 @@ #ifndef FXJS_CJX_DEFINE_H_ #define FXJS_CJX_DEFINE_H_ -#include "fxjs/cfxjse_arguments.h" +#include <vector> -template <class C, void (C::*M)(CFXJSE_Arguments* args)> -void JSMethod(C* node, CFXJSE_Arguments* args) { - (node->*M)(args); +#include "fxjs/cjs_return.h" +#include "fxjs/cjs_v8.h" + +template <class C, + CJS_Return (C::*M)(CJS_V8* runtime, + const std::vector<v8::Local<v8::Value>>& params)> +CJS_Return JSMethod(C* node, + CJS_V8* runtime, + const std::vector<v8::Local<v8::Value>>& params) { + return (node->*M)(runtime, params); } -#define JS_METHOD(method_name, class_name) \ - static void method_name##_static(CJX_Object* node, CFXJSE_Arguments* args) { \ - JSMethod<class_name, &class_name::method_name>( \ - static_cast<class_name*>(node), args); \ - } \ - void method_name(CFXJSE_Arguments* pArguments) +#define JS_METHOD(method_name, class_name) \ + static CJS_Return method_name##_static( \ + CJX_Object* node, CJS_V8* runtime, \ + const std::vector<v8::Local<v8::Value>>& params) { \ + return JSMethod<class_name, &class_name::method_name>( \ + static_cast<class_name*>(node), runtime, params); \ + } \ + CJS_Return method_name(CJS_V8* runtime, \ + const std::vector<v8::Local<v8::Value>>& params) #endif // FXJS_CJX_DEFINE_H_ |