Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(728)

Side by Side Diff: fpdfsdk/include/jsapi/fxjs_v8.h

Issue 948083002: Merge to XFA: Replace second set of #defines with templates in JS_Define.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/include/javascript/JS_Define.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 FXJSAPI_H 7 #ifndef FXJSAPI_H
8 #define FXJSAPI_H 8 #define FXJSAPI_H
9 9
10 #include <v8.h> 10 #include <v8.h>
11 11
12 enum FXJSOBJTYPE 12 enum FXJSOBJTYPE
13 { 13 {
14 JS_DYNAMIC = 0, 14 JS_DYNAMIC = 0,
15 JS_STATIC = 1, 15 JS_STATIC = 1,
16 }; 16 };
17 17
18 enum FXJSVALUETYPE 18 enum FXJSVALUETYPE
19 { 19 {
20 VT_unknown, 20 VT_unknown,
21 VT_string, 21 VT_string,
22 VT_number, 22 VT_number,
23 VT_boolean, 23 VT_boolean,
24 VT_date, 24 VT_date,
25 VT_object, 25 VT_object,
26 VT_fxobject, 26 VT_fxobject,
27 VT_null, 27 VT_null,
28 VT_undefined 28 VT_undefined
29 }; 29 };
30 30
31 struct FXJSErr 31 struct FXJSErr
32 { 32 {
33 » const wchar_t* message;» 33 » const wchar_t* message;
34 const wchar_t* srcline;» 34 const wchar_t* srcline;
35 unsigned linnum; 35 unsigned linnum;
36 }; 36 };
37 37
38 /* --------------------------------------------- API --------------------------- ------------------ */ 38 /* --------------------------------------------- API --------------------------- ------------------ */
39 39
40 typedef v8::Isolate IJS_Runtime; 40 typedef v8::Isolate IJS_Runtime;
41 class IFXJS_Context; 41 class IFXJS_Context;
42 class IFXJS_Runtime; 42 class IFXJS_Runtime;
43 43
44 typedef unsigned (*LP_CONSTRUCTOR)(IFXJS_Context* cc, v8::Handle<v8::Object> obj , v8::Handle<v8::Object> global);
45 typedef unsigned (*LP_DESTRUCTOR)(v8::Handle<v8::Object> obj);
44 46
45 #ifndef JSCRIPT_ARGS
46 #define JSCRIPT_ARGS
47
48 #define JS_CONSTRUCTOR_ARGS IFXJS_Context* cc, v8::Handle<v8::Object > obj, v8::Handle<v8::Object> global
49 #define JS_DESTRUCTOR_ARGS v8::Handle<v8::Object> obj
50
51 #define JS_PROPQUERY_ARGS v8::Local<v8::String> property,const v8: :PropertyCallbackInfo<v8::Integer>& info
52 #define JS_NAMED_PROPGET_ARGS v8::Local<v8::String> property, const v8 ::PropertyCallbackInfo<v8::Value>& info
53
54 #define JS_NAMED_PROPPUT_ARGS v8::Local<v8::String> property,v8::Local<v8::Val ue> value,const v8::PropertyCallbackInfo<v8::Value>& info
55 #define JS_PROPDEL_ARGS v8::Local<v8::String> property,const v8: :PropertyCallbackInfo<v8::Boolean>& info
56
57 typedef unsigned (*LP_CONSTRUCTOR)(JS_CONSTRUCTOR_ARGS);
58 typedef unsigned (*LP_DESTRUCTOR)(JS_DESTRUCTOR_ARGS);
59
60 #endif
61 47
62 int JS_DefineObj(IJS _Runtime* pJSRuntime, const wchar_t* sObjName, FXJSOBJTYPE eObjType, LP_CONSTRUC TOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned bApplyNew); 48 int JS_DefineObj(IJS _Runtime* pJSRuntime, const wchar_t* sObjName, FXJSOBJTYPE eObjType, LP_CONSTRUC TOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned bApplyNew);
63 int JS_DefineObjMeth od(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sMethodName, v8::Func tionCallback pMethodCall, unsigned nParamNum); 49 int JS_DefineObjMeth od(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sMethodName, v8::Func tionCallback pMethodCall, unsigned nParamNum);
64 int JS_DefineObjProp erty(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sPropName, v8::Acce ssorGetterCallback pPropGet, v8::AccessorSetterCallback pPropPut); 50 int JS_DefineObjProp erty(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sPropName, v8::Acce ssorGetterCallback pPropGet, v8::AccessorSetterCallback pPropPut);
65 int JS_DefineObjAllP roperties(IJS_Runtime* pJSRuntime, int nObjDefnID, v8::NamedPropertyQueryCallbac k pPropQurey, v8::NamedPropertyGetterCallback pPropGet, v8::NamedPropertySetterC allback pPropPut, v8::NamedPropertyDeleterCallback pPropDel); 51 int JS_DefineObjAllP roperties(IJS_Runtime* pJSRuntime, int nObjDefnID, v8::NamedPropertyQueryCallbac k pPropQurey, v8::NamedPropertyGetterCallback pPropGet, v8::NamedPropertySetterC allback pPropPut, v8::NamedPropertyDeleterCallback pPropDel);
66 int JS_DefineObjCons t(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sConstName, v8::Handle <v8::Value> pDefault); 52 int JS_DefineObjCons t(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sConstName, v8::Handle <v8::Value> pDefault);
67 int JS_DefineGlobalM ethod(IJS_Runtime* pJSRuntime, const wchar_t* sMethodName, v8::FunctionCallback pMethodCall, unsigned nParamNum); 53 int JS_DefineGlobalM ethod(IJS_Runtime* pJSRuntime, const wchar_t* sMethodName, v8::FunctionCallback pMethodCall, unsigned nParamNum);
68 int JS_DefineGlobalC onst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8::Handle<v8::Value> p Default); 54 int JS_DefineGlobalC onst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8::Handle<v8::Value> p Default);
69 55
70 void JS_InitialRuntime(IJS_Ru ntime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_Context* context, v8::Persist ent<v8::Context>& v8PersistentContext); 56 void JS_InitialRuntime(IJS_Ru ntime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_Context* context, v8::Persist ent<v8::Context>& v8PersistentContext);
71 void JS_ReleaseRuntime(IJS_Ru ntime* pJSRuntime, v8::Persistent<v8::Context>& v8PersistentContext); 57 void JS_ReleaseRuntime(IJS_Ru ntime* pJSRuntime, v8::Persistent<v8::Context>& v8PersistentContext);
72 void» » » » » » » JS_Initial(); 58 void» » » » » » » JS_Initial();
73 void JS_Release(); 59 void JS_Release();
74 int JS_Parse(IJS_Run time* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t* script, long length, FXJSErr* perror); 60 int JS_Parse(IJS_Run time* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t* script, long length, FXJSErr* perror);
75 int JS_Execute(IJS_R untime* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t* script, long lengt h, FXJSErr* perror); 61 int JS_Execute(IJS_R untime* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t* script, long lengt h, FXJSErr* perror);
76 v8::Handle<v8::Object> JS_NewFxDynamicObj(IJS_Runtime* pJSRunti me, IFXJS_Context* pJSContext, int nObjDefnID); 62 v8::Handle<v8::Object> JS_NewFxDynamicObj(IJS_Runtime* pJSRunti me, IFXJS_Context* pJSContext, int nObjDefnID);
77 v8::Handle<v8::Object> JS_GetStaticObj(IJS_Runtime* pJSRuntime, int nObjDefnID); 63 v8::Handle<v8::Object> JS_GetStaticObj(IJS_Runtime* pJSRuntime, int nObjDefnID);
78 void JS_SetThisObj(IJS_Runtim e* pJSRuntime, int nThisObjID); 64 void JS_SetThisObj(IJS_Runtim e* pJSRuntime, int nThisObjID);
79 v8::Handle<v8::Object> JS_GetThisObj(IJS_Runtime * pJSRuntime); 65 v8::Handle<v8::Object> JS_GetThisObj(IJS_Runtime * pJSRuntime);
80 int JS_GetObjDefnID( v8::Handle<v8::Object> pObj); 66 int JS_GetObjDefnID( v8::Handle<v8::Object> pObj);
81 IJS_Runtime* JS_GetRuntime(v8::Handle<v8::Obj ect> pObj); 67 IJS_Runtime* JS_GetRuntime(v8::Handle<v8::Obj ect> pObj);
82 int JS_GetObjDefnID( IJS_Runtime * pJSRuntime, const wchar_t* pObjName); 68 int JS_GetObjDefnID( IJS_Runtime * pJSRuntime, const wchar_t* pObjName);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 int JS_GetMinFromTim e(double dt); 122 int JS_GetMinFromTim e(double dt);
137 int JS_GetSecFromTim e(double dt); 123 int JS_GetSecFromTim e(double dt);
138 double JS_DateParse(const wchar _t* string); 124 double JS_DateParse(const wchar _t* string);
139 double JS_MakeDay(int nYear, in t nMonth, int nDay); 125 double JS_MakeDay(int nYear, in t nMonth, int nDay);
140 double JS_MakeTime(int nHour, i nt nMin, int nSec, int nMs); 126 double JS_MakeTime(int nHour, i nt nMin, int nSec, int nMs);
141 double JS_MakeDate(double day, double time); 127 double JS_MakeDate(double day, double time);
142 bool JS_PortIsNan(double d); 128 bool JS_PortIsNan(double d);
143 double JS_LocalTime(double d); 129 double JS_LocalTime(double d);
144 130
145 #endif //FXJSAPI_H 131 #endif //FXJSAPI_H
OLDNEW
« no previous file with comments | « fpdfsdk/include/javascript/JS_Define.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698