| 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): | 44 CJS_ObjDefintion(v8::Isolate* isolate, const wchar_t* sObjName, FXJSOBJT
YPE eObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor): |
| 45 » objName(sObjName), objType(eObjType), m_pConstructor(pConstructor), m_
pDestructor(pDestructor),m_bSetAsGlobalObject(FALSE) | 45 » objName(sObjName), objType(eObjType), m_pConstructor(pConstructor), m_
pDestructor(pDestructor),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 » FX_BOOL»m_bSetAsGlobalObject; | 71 » bool» m_bSetAsGlobalObject; |
| 72 | 72 |
| 73 v8::Global<v8::ObjectTemplate> m_objTemplate; | 73 v8::Global<v8::ObjectTemplate> m_objTemplate; |
| 74 v8::Global<v8::Object> m_StaticObj; | 74 v8::Global<v8::Object> m_StaticObj; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 int JS_DefineObj(IJS_Runtime* pJSRuntime, const wchar_t* sObjName, FXJSOBJTYPE e
ObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor) | 77 int JS_DefineObj(IJS_Runtime* pJSRuntime, const wchar_t* sObjName, FXJSOBJTYPE e
ObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor) |
| 78 { | 78 { |
| 79 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; | 79 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; |
| 80 v8::Isolate::Scope isolate_scope(isolate); | 80 v8::Isolate::Scope isolate_scope(isolate); |
| 81 v8::HandleScope handle_scope(isolate); | 81 v8::HandleScope handle_scope(isolate); |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 { | 1061 { |
| 1062 return d != d; | 1062 return d != d; |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 double JS_LocalTime(double d) | 1065 double JS_LocalTime(double d) |
| 1066 { | 1066 { |
| 1067 return JS_GetDateTime() + _getDaylightSavingTA(d); | 1067 return JS_GetDateTime() + _getDaylightSavingTA(d); |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 //JavaScript time implement End. | 1070 //JavaScript time implement End. |
| OLD | NEW |