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 #include "../../../core/include/fxcrt/fx_basic.h" | 7 #include "../../../core/include/fxcrt/fx_basic.h" |
8 #include "../../../core/include/fxcrt/fx_ext.h" | 8 #include "../../../core/include/fxcrt/fx_ext.h" |
9 #include "../../include/jsapi/fxjs_v8.h" | 9 #include "../../include/jsapi/fxjs_v8.h" |
10 #include "../../include/fsdk_define.h" | 10 #include "../../include/fsdk_define.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 CJS_PrivateData():ObjDefID(-1), pPrivate(NULL) {} | 35 CJS_PrivateData():ObjDefID(-1), pPrivate(NULL) {} |
36 int ObjDefID; | 36 int ObjDefID; |
37 void* pPrivate; | 37 void* pPrivate; |
38 }; | 38 }; |
39 | 39 |
40 | 40 |
41 class CJS_ObjDefintion | 41 class CJS_ObjDefintion |
42 { | 42 { |
43 public: | 43 public: |
44 CJS_ObjDefintion(v8::Isolate* isolate, const wchar_t* sObjName, FXJSOBJT
YPE eObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned b
ApplyNew): | 44 CJS_ObjDefintion(v8::Isolate* isolate, const wchar_t* sObjName, FXJSOBJT
YPE eObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned b
ApplyNew): |
45 » objName(sObjName), objType(eObjType), m_pConstructor(pConstructor), m_
pDestructor(pDestructor),m_bApplyNew(bApplyNew),m_bSetAsGlobalObject(FALSE) | 45 » objName(sObjName), objType(eObjType), m_pConstructor(pConstructor), m_
pDestructor(pDestructor),m_bApplyNew(bApplyNew),m_bSetAsGlobalObject(false) |
46 { | 46 { |
47 v8::Isolate::Scope isolate_scope(isolate); | 47 v8::Isolate::Scope isolate_scope(isolate); |
48 v8::HandleScope handle_scope(isolate); | 48 v8::HandleScope handle_scope(isolate); |
49 | 49 |
50 v8::Local<v8::ObjectTemplate> objTemplate = v8::ObjectTemplate
::New(isolate); | 50 v8::Local<v8::ObjectTemplate> objTemplate = v8::ObjectTemplate
::New(isolate); |
51 objTemplate->SetInternalFieldCount(2); | 51 objTemplate->SetInternalFieldCount(2); |
52 m_objTemplate.Reset(isolate, objTemplate); | 52 m_objTemplate.Reset(isolate, objTemplate); |
53 | 53 |
54 //Document as the global object. | 54 //Document as the global object. |
55 if(FXSYS_wcscmp(sObjName, L"Document") == 0) | 55 if(FXSYS_wcscmp(sObjName, L"Document") == 0) |
56 { | 56 { |
57 » » » m_bSetAsGlobalObject = TRUE; | 57 » » » m_bSetAsGlobalObject = true; |
58 } | 58 } |
59 | 59 |
60 } | 60 } |
61 ~CJS_ObjDefintion() | 61 ~CJS_ObjDefintion() |
62 { | 62 { |
63 m_objTemplate.Reset(); | 63 m_objTemplate.Reset(); |
64 m_StaticObj.Reset(); | 64 m_StaticObj.Reset(); |
65 } | 65 } |
66 public: | 66 public: |
67 const wchar_t* objName; | 67 const wchar_t* objName; |
68 FXJSOBJTYPE objType; | 68 FXJSOBJTYPE objType; |
69 LP_CONSTRUCTOR m_pConstructor; | 69 LP_CONSTRUCTOR m_pConstructor; |
70 LP_DESTRUCTOR m_pDestructor; | 70 LP_DESTRUCTOR m_pDestructor; |
71 unsigned m_bApplyNew; | 71 unsigned m_bApplyNew; |
72 » FX_BOOL»m_bSetAsGlobalObject; | 72 » bool» m_bSetAsGlobalObject; |
73 | 73 |
74 v8::Global<v8::ObjectTemplate> m_objTemplate; | 74 v8::Global<v8::ObjectTemplate> m_objTemplate; |
75 v8::Global<v8::Object> m_StaticObj; | 75 v8::Global<v8::Object> m_StaticObj; |
76 }; | 76 }; |
77 | 77 |
78 int JS_DefineObj(IJS_Runtime* pJSRuntime, const wchar_t* sObjName, FXJSOBJTYPE e
ObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned bApply
New) | 78 int JS_DefineObj(IJS_Runtime* pJSRuntime, const wchar_t* sObjName, FXJSOBJTYPE e
ObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned bApply
New) |
79 { | 79 { |
80 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; | 80 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; |
81 v8::Isolate::Scope isolate_scope(isolate); | 81 v8::Isolate::Scope isolate_scope(isolate); |
82 v8::HandleScope handle_scope(isolate); | 82 v8::HandleScope handle_scope(isolate); |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 { | 1062 { |
1063 return d != d; | 1063 return d != d; |
1064 } | 1064 } |
1065 | 1065 |
1066 double JS_LocalTime(double d) | 1066 double JS_LocalTime(double d) |
1067 { | 1067 { |
1068 return JS_GetDateTime() + _getDaylightSavingTA(d); | 1068 return JS_GetDateTime() + _getDaylightSavingTA(d); |
1069 } | 1069 } |
1070 | 1070 |
1071 //JavaScript time implement End. | 1071 //JavaScript time implement End. |
OLD | NEW |