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 // PDFium wrapper around V8 APIs. PDFium code should include this file rather | 7 // PDFium wrapper around V8 APIs. PDFium code should include this file rather |
8 // than including V8 headers directly. | 8 // than including V8 headers directly. |
9 | 9 |
10 #ifndef FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ | 10 #ifndef FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ |
(...skipping 18 matching lines...) Expand all Loading... |
29 VT_null, | 29 VT_null, |
30 VT_undefined | 30 VT_undefined |
31 }; | 31 }; |
32 | 32 |
33 struct FXJSErr { | 33 struct FXJSErr { |
34 const wchar_t* message; | 34 const wchar_t* message; |
35 const wchar_t* srcline; | 35 const wchar_t* srcline; |
36 unsigned linnum; | 36 unsigned linnum; |
37 }; | 37 }; |
38 | 38 |
39 /* --------------------------------------------- API | 39 extern const wchar_t kFXJSValueNameString[]; |
40 * --------------------------------------------- */ | 40 extern const wchar_t kFXJSValueNameNumber[]; |
| 41 extern const wchar_t kFXJSValueNameBoolean[]; |
| 42 extern const wchar_t kFXJSValueNameDate[]; |
| 43 extern const wchar_t kFXJSValueNameObject[]; |
| 44 extern const wchar_t kFXJSValueNameFxobj[]; |
| 45 extern const wchar_t kFXJSValueNameNull[]; |
| 46 extern const wchar_t kFXJSValueNameUndefined[]; |
41 | 47 |
42 class IFXJS_Context; | 48 class IFXJS_Context; |
43 class IFXJS_Runtime; | 49 class IFXJS_Runtime; |
44 | 50 |
45 typedef void (*LP_CONSTRUCTOR)(IFXJS_Context* cc, | 51 typedef void (*LP_CONSTRUCTOR)(IFXJS_Context* cc, |
46 v8::Local<v8::Object> obj, | 52 v8::Local<v8::Object> obj, |
47 v8::Local<v8::Object> global); | 53 v8::Local<v8::Object> global); |
48 typedef void (*LP_DESTRUCTOR)(v8::Local<v8::Object> obj); | 54 typedef void (*LP_DESTRUCTOR)(v8::Local<v8::Object> obj); |
49 | 55 |
| 56 // Always returns a valid, newly-created objDefnID. |
50 int JS_DefineObj(v8::Isolate* pIsolate, | 57 int JS_DefineObj(v8::Isolate* pIsolate, |
51 const wchar_t* sObjName, | 58 const wchar_t* sObjName, |
52 FXJSOBJTYPE eObjType, | 59 FXJSOBJTYPE eObjType, |
53 LP_CONSTRUCTOR pConstructor, | 60 LP_CONSTRUCTOR pConstructor, |
54 LP_DESTRUCTOR pDestructor); | 61 LP_DESTRUCTOR pDestructor); |
55 int JS_DefineObjMethod(v8::Isolate* pIsolate, | 62 |
| 63 void JS_DefineObjMethod(v8::Isolate* pIsolate, |
| 64 int nObjDefnID, |
| 65 const wchar_t* sMethodName, |
| 66 v8::FunctionCallback pMethodCall); |
| 67 void JS_DefineObjProperty(v8::Isolate* pIsolate, |
| 68 int nObjDefnID, |
| 69 const wchar_t* sPropName, |
| 70 v8::AccessorGetterCallback pPropGet, |
| 71 v8::AccessorSetterCallback pPropPut); |
| 72 void JS_DefineObjAllProperties(v8::Isolate* pIsolate, |
| 73 int nObjDefnID, |
| 74 v8::NamedPropertyQueryCallback pPropQurey, |
| 75 v8::NamedPropertyGetterCallback pPropGet, |
| 76 v8::NamedPropertySetterCallback pPropPut, |
| 77 v8::NamedPropertyDeleterCallback pPropDel); |
| 78 void JS_DefineObjConst(v8::Isolate* pIsolate, |
56 int nObjDefnID, | 79 int nObjDefnID, |
57 const wchar_t* sMethodName, | 80 const wchar_t* sConstName, |
58 v8::FunctionCallback pMethodCall); | 81 v8::Local<v8::Value> pDefault); |
59 int JS_DefineObjProperty(v8::Isolate* pIsolate, | 82 void JS_DefineGlobalMethod(v8::Isolate* pIsolate, |
60 int nObjDefnID, | 83 const wchar_t* sMethodName, |
61 const wchar_t* sPropName, | 84 v8::FunctionCallback pMethodCall); |
62 v8::AccessorGetterCallback pPropGet, | 85 void JS_DefineGlobalConst(v8::Isolate* pIsolate, |
63 v8::AccessorSetterCallback pPropPut); | 86 const wchar_t* sConstName, |
64 int JS_DefineObjAllProperties(v8::Isolate* pIsolate, | 87 v8::Local<v8::Value> pDefault); |
65 int nObjDefnID, | |
66 v8::NamedPropertyQueryCallback pPropQurey, | |
67 v8::NamedPropertyGetterCallback pPropGet, | |
68 v8::NamedPropertySetterCallback pPropPut, | |
69 v8::NamedPropertyDeleterCallback pPropDel); | |
70 int JS_DefineObjConst(v8::Isolate* pIsolate, | |
71 int nObjDefnID, | |
72 const wchar_t* sConstName, | |
73 v8::Local<v8::Value> pDefault); | |
74 int JS_DefineGlobalMethod(v8::Isolate* pIsolate, | |
75 const wchar_t* sMethodName, | |
76 v8::FunctionCallback pMethodCall); | |
77 int JS_DefineGlobalConst(v8::Isolate* pIsolate, | |
78 const wchar_t* sConstName, | |
79 v8::Local<v8::Value> pDefault); | |
80 | 88 |
81 void JS_InitialRuntime(v8::Isolate* pIsolate, | 89 void JS_InitialRuntime(v8::Isolate* pIsolate, |
82 IFXJS_Runtime* pFXRuntime, | 90 IFXJS_Runtime* pFXRuntime, |
83 IFXJS_Context* context, | 91 IFXJS_Context* context, |
84 v8::Global<v8::Context>& v8PersistentContext); | 92 v8::Global<v8::Context>& v8PersistentContext); |
85 void JS_ReleaseRuntime(v8::Isolate* pIsolate, | 93 void JS_ReleaseRuntime(v8::Isolate* pIsolate, |
86 v8::Global<v8::Context>& v8PersistentContext); | 94 v8::Global<v8::Context>& v8PersistentContext); |
87 void JS_Initial(unsigned int embedderDataSlot); | 95 void JS_Initial(unsigned int embedderDataSlot); |
88 void JS_Release(); | 96 void JS_Release(); |
89 int JS_Execute(v8::Isolate* pIsolate, | 97 int JS_Execute(v8::Isolate* pIsolate, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 int JS_GetMinFromTime(double dt); | 198 int JS_GetMinFromTime(double dt); |
191 int JS_GetSecFromTime(double dt); | 199 int JS_GetSecFromTime(double dt); |
192 double JS_DateParse(const wchar_t* string); | 200 double JS_DateParse(const wchar_t* string); |
193 double JS_MakeDay(int nYear, int nMonth, int nDay); | 201 double JS_MakeDay(int nYear, int nMonth, int nDay); |
194 double JS_MakeTime(int nHour, int nMin, int nSec, int nMs); | 202 double JS_MakeTime(int nHour, int nMin, int nSec, int nMs); |
195 double JS_MakeDate(double day, double time); | 203 double JS_MakeDate(double day, double time); |
196 bool JS_PortIsNan(double d); | 204 bool JS_PortIsNan(double d); |
197 double JS_LocalTime(double d); | 205 double JS_LocalTime(double d); |
198 | 206 |
199 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ | 207 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ |
OLD | NEW |