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 // FXJS_V8 is a layer that makes it easier to define native objects in V8, but | 7 // FXJS_V8 is a layer that makes it easier to define native objects in V8, but |
8 // has no knowledge of PDF-specific native objects. It could in theory be used | 8 // has no knowledge of PDF-specific native objects. It could in theory be used |
9 // to implement other sets of native objects. | 9 // to implement other sets of native objects. |
10 | 10 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 std::vector<CFXJS_ObjDefinition*> m_ObjectDefnArray; | 111 std::vector<CFXJS_ObjDefinition*> m_ObjectDefnArray; |
112 #ifdef PDF_ENABLE_XFA | 112 #ifdef PDF_ENABLE_XFA |
113 CFXJSE_RuntimeData* m_pFXJSERuntimeData; | 113 CFXJSE_RuntimeData* m_pFXJSERuntimeData; |
114 #endif // PDF_ENABLE_XFA | 114 #endif // PDF_ENABLE_XFA |
115 V8TemplateMap* m_pDynamicObjsMap; | 115 V8TemplateMap* m_pDynamicObjsMap; |
116 | 116 |
117 protected: | 117 protected: |
118 FXJS_PerIsolateData(); | 118 FXJS_PerIsolateData(); |
119 }; | 119 }; |
120 | 120 |
121 extern const wchar_t kFXJSValueNameString[]; | |
122 extern const wchar_t kFXJSValueNameNumber[]; | |
123 extern const wchar_t kFXJSValueNameBoolean[]; | |
124 extern const wchar_t kFXJSValueNameDate[]; | |
125 extern const wchar_t kFXJSValueNameObject[]; | |
126 extern const wchar_t kFXJSValueNameFxobj[]; | |
127 extern const wchar_t kFXJSValueNameNull[]; | |
128 extern const wchar_t kFXJSValueNameUndefined[]; | |
129 | |
130 class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | 121 class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
131 void* Allocate(size_t length) override; | 122 void* Allocate(size_t length) override; |
132 void* AllocateUninitialized(size_t length) override; | 123 void* AllocateUninitialized(size_t length) override; |
133 void Free(void* data, size_t length) override; | 124 void Free(void* data, size_t length) override; |
134 }; | 125 }; |
135 | 126 |
136 using FXJS_CONSTRUCTOR = void (*)(IJS_Runtime* cc, v8::Local<v8::Object> obj); | 127 using FXJS_CONSTRUCTOR = void (*)(IJS_Runtime* cc, v8::Local<v8::Object> obj); |
137 using FXJS_DESTRUCTOR = void (*)(v8::Local<v8::Object> obj); | 128 using FXJS_DESTRUCTOR = void (*)(v8::Local<v8::Object> obj); |
138 | 129 |
139 void FXJS_Initialize(unsigned int embedderDataSlot, v8::Isolate* pIsolate); | 130 void FXJS_Initialize(unsigned int embedderDataSlot, v8::Isolate* pIsolate); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 int FXJS_Execute(v8::Isolate* pIsolate, | 193 int FXJS_Execute(v8::Isolate* pIsolate, |
203 const CFX_WideString& script, | 194 const CFX_WideString& script, |
204 FXJSErr* perror); | 195 FXJSErr* perror); |
205 | 196 |
206 v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate, | 197 v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate, |
207 IJS_Runtime* pJSContext, | 198 IJS_Runtime* pJSContext, |
208 int nObjDefnID, | 199 int nObjDefnID, |
209 bool bStatic = false); | 200 bool bStatic = false); |
210 v8::Local<v8::Object> FXJS_GetThisObj(v8::Isolate* pIsolate); | 201 v8::Local<v8::Object> FXJS_GetThisObj(v8::Isolate* pIsolate); |
211 int FXJS_GetObjDefnID(v8::Local<v8::Object> pObj); | 202 int FXJS_GetObjDefnID(v8::Local<v8::Object> pObj); |
212 const wchar_t* FXJS_GetTypeof(v8::Local<v8::Value> pObj); | |
213 | 203 |
214 void FXJS_SetPrivate(v8::Isolate* pIsolate, | 204 void FXJS_SetPrivate(v8::Isolate* pIsolate, |
215 v8::Local<v8::Object> pObj, | 205 v8::Local<v8::Object> pObj, |
216 void* p); | 206 void* p); |
217 void* FXJS_GetPrivate(v8::Isolate* pIsolate, v8::Local<v8::Object> pObj); | 207 void* FXJS_GetPrivate(v8::Isolate* pIsolate, v8::Local<v8::Object> pObj); |
218 void FXJS_FreePrivate(void* p); | 208 void FXJS_FreePrivate(void* p); |
219 void FXJS_FreePrivate(v8::Local<v8::Object> pObj); | 209 void FXJS_FreePrivate(v8::Local<v8::Object> pObj); |
220 void FXJS_Error(v8::Isolate* isolate, const CFX_WideString& message); | 210 void FXJS_Error(v8::Isolate* isolate, const CFX_WideString& message); |
221 | 211 |
222 v8::Local<v8::String> FXJS_WSToJSString(v8::Isolate* pIsolate, | 212 v8::Local<v8::String> FXJS_WSToJSString(v8::Isolate* pIsolate, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); | 267 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); |
278 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, | 268 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, |
279 v8::Local<v8::Value> pValue); | 269 v8::Local<v8::Value> pValue); |
280 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, | 270 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, |
281 v8::Local<v8::Value> pValue); | 271 v8::Local<v8::Value> pValue); |
282 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, | 272 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, |
283 v8::Local<v8::Value> pValue); | 273 v8::Local<v8::Value> pValue); |
284 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); | 274 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); |
285 | 275 |
286 #endif // FXJS_INCLUDE_FXJS_V8_H_ | 276 #endif // FXJS_INCLUDE_FXJS_V8_H_ |
OLD | NEW |