| 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 |
| 11 // PDFium code should include this file rather than including V8 headers | 11 // PDFium code should include this file rather than including V8 headers |
| 12 // directly. | 12 // directly. |
| 13 | 13 |
| 14 #ifndef FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ | 14 #ifndef FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ |
| 15 #define FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ | 15 #define FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ |
| 16 | 16 |
| 17 #include <v8.h> | 17 #include <v8.h> |
| 18 | 18 |
| 19 #include "core/include/fxcrt/fx_basic.h" | 19 #include <vector> |
| 20 |
| 21 #include "core/include/fxcrt/fx_string.h" |
| 22 |
| 23 class CFXJS_ObjDefinition; |
| 20 | 24 |
| 21 // FXJS_V8 places no restrictions on these two classes; it merely passes them | 25 // FXJS_V8 places no restrictions on these two classes; it merely passes them |
| 22 // on to caller-provided methods. | 26 // on to caller-provided methods. |
| 23 class IJS_Context; // A description of the event that caused JS execution. | 27 class IJS_Context; // A description of the event that caused JS execution. |
| 24 class IJS_Runtime; // A native runtime, typically owns the v8::Context. | 28 class IJS_Runtime; // A native runtime, typically owns the v8::Context. |
| 25 | 29 |
| 26 // FXJS_V8 places no interpreation on this calass; it merely passes it | 30 // FXJS_V8 places no interpreation on this calass; it merely passes it |
| 27 // along to XFA. | 31 // along to XFA. |
| 28 class CFXJSE_RuntimeData; | 32 class CFXJSE_RuntimeData; |
| 29 | 33 |
| 30 enum FXJSOBJTYPE { | 34 enum FXJSOBJTYPE { |
| 31 FXJSOBJTYPE_DYNAMIC = 0, // Created by native method and returned to JS. | 35 FXJSOBJTYPE_DYNAMIC = 0, // Created by native method and returned to JS. |
| 32 FXJSOBJTYPE_STATIC, // Created by init and hung off of global object. | 36 FXJSOBJTYPE_STATIC, // Created by init and hung off of global object. |
| 33 FXJSOBJTYPE_GLOBAL, // The global object itself (may only appear once). | 37 FXJSOBJTYPE_GLOBAL, // The global object itself (may only appear once). |
| 34 }; | 38 }; |
| 35 | 39 |
| 36 struct FXJSErr { | 40 struct FXJSErr { |
| 37 const wchar_t* message; | 41 const wchar_t* message; |
| 38 const wchar_t* srcline; | 42 const wchar_t* srcline; |
| 39 unsigned linnum; | 43 unsigned linnum; |
| 40 }; | 44 }; |
| 41 | 45 |
| 42 class FXJS_PerIsolateData { | 46 class FXJS_PerIsolateData { |
| 43 public: | 47 public: |
| 44 static void SetUp(v8::Isolate* pIsolate); | 48 static void SetUp(v8::Isolate* pIsolate); |
| 45 static FXJS_PerIsolateData* Get(v8::Isolate* pIsolate); | 49 static FXJS_PerIsolateData* Get(v8::Isolate* pIsolate); |
| 46 | 50 |
| 47 CFX_PtrArray m_ObjectDefnArray; | 51 std::vector<CFXJS_ObjDefinition*> m_ObjectDefnArray; |
| 48 CFXJSE_RuntimeData* m_pFXJSERuntimeData; | 52 CFXJSE_RuntimeData* m_pFXJSERuntimeData; |
| 49 | 53 |
| 50 protected: | 54 protected: |
| 51 FXJS_PerIsolateData() : m_pFXJSERuntimeData(nullptr) {} | 55 FXJS_PerIsolateData() : m_pFXJSERuntimeData(nullptr) {} |
| 52 }; | 56 }; |
| 53 | 57 |
| 54 extern const wchar_t kFXJSValueNameString[]; | 58 extern const wchar_t kFXJSValueNameString[]; |
| 55 extern const wchar_t kFXJSValueNameNumber[]; | 59 extern const wchar_t kFXJSValueNameNumber[]; |
| 56 extern const wchar_t kFXJSValueNameBoolean[]; | 60 extern const wchar_t kFXJSValueNameBoolean[]; |
| 57 extern const wchar_t kFXJSValueNameDate[]; | 61 extern const wchar_t kFXJSValueNameDate[]; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); | 222 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); |
| 219 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, | 223 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, |
| 220 v8::Local<v8::Value> pValue); | 224 v8::Local<v8::Value> pValue); |
| 221 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, | 225 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, |
| 222 v8::Local<v8::Value> pValue); | 226 v8::Local<v8::Value> pValue); |
| 223 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, | 227 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, |
| 224 v8::Local<v8::Value> pValue); | 228 v8::Local<v8::Value> pValue); |
| 225 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); | 229 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); |
| 226 | 230 |
| 227 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ | 231 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ |
| OLD | NEW |