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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 if(!pArray) | 83 if(!pArray) |
84 { | 84 { |
85 pArray = FX_NEW CFX_PtrArray(); | 85 pArray = FX_NEW CFX_PtrArray(); |
86 isolate->SetData(1, pArray); | 86 isolate->SetData(1, pArray); |
87 } | 87 } |
88 CJS_ObjDefintion* pObjDef = FX_NEW CJS_ObjDefintion(isolate, sObjName, e
ObjType, pConstructor, pDestructor, bApplyNew); | 88 CJS_ObjDefintion* pObjDef = FX_NEW CJS_ObjDefintion(isolate, sObjName, e
ObjType, pConstructor, pDestructor, bApplyNew); |
89 pArray->Add(pObjDef); | 89 pArray->Add(pObjDef); |
90 return pArray->GetSize()-1; | 90 return pArray->GetSize()-1; |
91 } | 91 } |
92 | 92 |
93 int JS_DefineObjMethod(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* s
MethodName, v8::FunctionCallback pMethodCall, unsigned nParamNum) | 93 int JS_DefineObjMethod(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* s
MethodName, v8::FunctionCallback pMethodCall) |
94 { | 94 { |
95 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; | 95 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; |
96 v8::Isolate::Scope isolate_scope(isolate); | 96 v8::Isolate::Scope isolate_scope(isolate); |
97 v8::HandleScope handle_scope(isolate); | 97 v8::HandleScope handle_scope(isolate); |
98 | 98 |
99 CFX_WideString ws = CFX_WideString(sMethodName); | 99 CFX_WideString ws = CFX_WideString(sMethodName); |
100 CFX_ByteString bsMethodName = ws.UTF8Encode(); | 100 CFX_ByteString bsMethodName = ws.UTF8Encode(); |
101 | 101 |
102 CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(1); | 102 CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(1); |
103 if(!pArray) return 0; | 103 if(!pArray) return 0; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 for(int i=0; i<pArray->GetSize(); i++) | 178 for(int i=0; i<pArray->GetSize(); i++) |
179 { | 179 { |
180 CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(i); | 180 CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(i); |
181 if(pObjDef->m_bSetAsGlobalObject) | 181 if(pObjDef->m_bSetAsGlobalObject) |
182 return pObjDef->m_objTemplate; | 182 return pObjDef->m_objTemplate; |
183 } | 183 } |
184 static v8::Persistent<v8::ObjectTemplate> gloabalObjectTemplate; | 184 static v8::Persistent<v8::ObjectTemplate> gloabalObjectTemplate; |
185 return gloabalObjectTemplate; | 185 return gloabalObjectTemplate; |
186 } | 186 } |
187 | 187 |
188 int JS_DefineGlobalMethod(IJS_Runtime* pJSRuntime, const wchar_t* sMethodName, v
8::FunctionCallback pMethodCall, unsigned nParamNum) | 188 int JS_DefineGlobalMethod(IJS_Runtime* pJSRuntime, const wchar_t* sMethodName, v
8::FunctionCallback pMethodCall) |
189 { | 189 { |
190 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; | 190 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; |
191 v8::Isolate::Scope isolate_scope(isolate); | 191 v8::Isolate::Scope isolate_scope(isolate); |
192 v8::HandleScope handle_scope(isolate); | 192 v8::HandleScope handle_scope(isolate); |
193 | 193 |
194 CFX_WideString ws = CFX_WideString(sMethodName); | 194 CFX_WideString ws = CFX_WideString(sMethodName); |
195 CFX_ByteString bsMethodName = ws.UTF8Encode(); | 195 CFX_ByteString bsMethodName = ws.UTF8Encode(); |
196 | 196 |
197 v8::Local<v8::FunctionTemplate> funTempl = v8::FunctionTemplate::New(iso
late, pMethodCall); | 197 v8::Local<v8::FunctionTemplate> funTempl = v8::FunctionTemplate::New(iso
late, pMethodCall); |
198 v8::Local<v8::ObjectTemplate> objTemp; | 198 v8::Local<v8::ObjectTemplate> objTemp; |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 { | 1044 { |
1045 return d != d; | 1045 return d != d; |
1046 } | 1046 } |
1047 | 1047 |
1048 double JS_LocalTime(double d) | 1048 double JS_LocalTime(double d) |
1049 { | 1049 { |
1050 return JS_GetDateTime() + _getDaylightSavingTA(d); | 1050 return JS_GetDateTime() + _getDaylightSavingTA(d); |
1051 } | 1051 } |
1052 | 1052 |
1053 //JavaScript time implement End. | 1053 //JavaScript time implement End. |
OLD | NEW |