OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ | 7 #ifndef FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ |
8 #define FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ | 8 #define FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ |
9 | 9 |
10 #include "fpdfsdk/include/jsapi/fxjs_v8.h" | 10 #include "fpdfsdk/include/jsapi/fxjs_v8.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 { const_name, pValue, L"", 0 } \ | 37 { const_name, pValue, L"", 0 } \ |
38 , | 38 , |
39 | 39 |
40 #define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) \ | 40 #define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) \ |
41 { const_name, 0, pValue, 1 } \ | 41 { const_name, 0, pValue, 1 } \ |
42 , | 42 , |
43 | 43 |
44 #define END_JS_STATIC_CONST() \ | 44 #define END_JS_STATIC_CONST() \ |
45 { 0, 0, 0, 0 } \ | 45 { 0, 0, 0, 0 } \ |
46 } \ | 46 } \ |
47 ; | 47 ; // NOLINT |
48 | 48 |
49 #define BEGIN_JS_STATIC_PROP(js_class_name) \ | 49 #define BEGIN_JS_STATIC_PROP(js_class_name) \ |
50 JSPropertySpec js_class_name::JS_Class_Properties[] = { | 50 JSPropertySpec js_class_name::JS_Class_Properties[] = { |
51 #define JS_STATIC_PROP_ENTRY(prop_name) \ | 51 #define JS_STATIC_PROP_ENTRY(prop_name) \ |
52 { \ | 52 { \ |
53 JS_WIDESTRING(prop_name), get_##prop_name##_static, \ | 53 JS_WIDESTRING(prop_name), get_##prop_name##_static, \ |
54 set_##prop_name##_static \ | 54 set_##prop_name##_static \ |
55 } \ | 55 } \ |
56 , | 56 , |
57 | 57 |
58 #define END_JS_STATIC_PROP() \ | 58 #define END_JS_STATIC_PROP() \ |
59 { 0, 0, 0 } \ | 59 { 0, 0, 0 } \ |
60 } \ | 60 } \ |
61 ; | 61 ; // NOLINT |
62 | 62 |
63 #define BEGIN_JS_STATIC_METHOD(js_class_name) \ | 63 #define BEGIN_JS_STATIC_METHOD(js_class_name) \ |
64 JSMethodSpec js_class_name::JS_Class_Methods[] = { | 64 JSMethodSpec js_class_name::JS_Class_Methods[] = { |
65 #define JS_STATIC_METHOD_ENTRY(method_name) \ | 65 #define JS_STATIC_METHOD_ENTRY(method_name) \ |
66 { JS_WIDESTRING(method_name), method_name##_static } \ | 66 { JS_WIDESTRING(method_name), method_name##_static } \ |
67 , | 67 , |
68 | 68 |
69 #define END_JS_STATIC_METHOD() \ | 69 #define END_JS_STATIC_METHOD() \ |
70 { 0, 0 } \ | 70 { 0, 0 } \ |
71 } \ | 71 } \ |
72 ; | 72 ; // NOLINT |
73 | 73 |
74 template <class C, | 74 template <class C, |
75 FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)> | 75 FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)> |
76 void JSPropGetter(const char* prop_name_string, | 76 void JSPropGetter(const char* prop_name_string, |
77 const char* class_name_string, | 77 const char* class_name_string, |
78 v8::Local<v8::String> property, | 78 v8::Local<v8::String> property, |
79 const v8::PropertyCallbackInfo<v8::Value>& info) { | 79 const v8::PropertyCallbackInfo<v8::Value>& info) { |
80 v8::Isolate* isolate = info.GetIsolate(); | 80 v8::Isolate* isolate = info.GetIsolate(); |
81 CJS_Runtime* pRuntime = | 81 CJS_Runtime* pRuntime = |
82 static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(isolate)); | 82 static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(isolate)); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 for (size_t i = 0; i < FX_ArraySize(global_methods) - 1; ++i) { \ | 482 for (size_t i = 0; i < FX_ArraySize(global_methods) - 1; ++i) { \ |
483 FXJS_DefineGlobalMethod(pIsolate, \ | 483 FXJS_DefineGlobalMethod(pIsolate, \ |
484 js_class_name::global_methods[i].pName, \ | 484 js_class_name::global_methods[i].pName, \ |
485 js_class_name::global_methods[i].pMethodCall); \ | 485 js_class_name::global_methods[i].pMethodCall); \ |
486 } \ | 486 } \ |
487 } | 487 } |
488 | 488 |
489 CJS_Value::Type GET_VALUE_TYPE(v8::Local<v8::Value> p); | 489 CJS_Value::Type GET_VALUE_TYPE(v8::Local<v8::Value> p); |
490 | 490 |
491 #endif // FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ | 491 #endif // FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ |
OLD | NEW |