| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 extern const wchar_t kFXJSValueNameString[]; | 49 extern const wchar_t kFXJSValueNameString[]; |
| 50 extern const wchar_t kFXJSValueNameNumber[]; | 50 extern const wchar_t kFXJSValueNameNumber[]; |
| 51 extern const wchar_t kFXJSValueNameBoolean[]; | 51 extern const wchar_t kFXJSValueNameBoolean[]; |
| 52 extern const wchar_t kFXJSValueNameDate[]; | 52 extern const wchar_t kFXJSValueNameDate[]; |
| 53 extern const wchar_t kFXJSValueNameObject[]; | 53 extern const wchar_t kFXJSValueNameObject[]; |
| 54 extern const wchar_t kFXJSValueNameFxobj[]; | 54 extern const wchar_t kFXJSValueNameFxobj[]; |
| 55 extern const wchar_t kFXJSValueNameNull[]; | 55 extern const wchar_t kFXJSValueNameNull[]; |
| 56 extern const wchar_t kFXJSValueNameUndefined[]; | 56 extern const wchar_t kFXJSValueNameUndefined[]; |
| 57 | 57 |
| 58 | |
| 59 class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | 58 class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
| 60 void* Allocate(size_t length) override; | 59 void* Allocate(size_t length) override; |
| 61 void* AllocateUninitialized(size_t length) override; | 60 void* AllocateUninitialized(size_t length) override; |
| 62 void Free(void* data, size_t length) override; | 61 void Free(void* data, size_t length) override; |
| 63 }; | 62 }; |
| 64 | 63 |
| 65 using FXJS_CONSTRUCTOR = void (*)(IJS_Runtime* cc, v8::Local<v8::Object> obj); | 64 using FXJS_CONSTRUCTOR = void (*)(IJS_Runtime* cc, v8::Local<v8::Object> obj); |
| 66 using FXJS_DESTRUCTOR = void (*)(v8::Local<v8::Object> obj); | 65 using FXJS_DESTRUCTOR = void (*)(v8::Local<v8::Object> obj); |
| 67 | 66 |
| 68 // Call before making FXJS_PrepareIsolate call. | 67 // Call before making FXJS_PrepareIsolate call. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 const wchar_t* sConstName, | 111 const wchar_t* sConstName, |
| 113 v8::Local<v8::Value> pDefault); | 112 v8::Local<v8::Value> pDefault); |
| 114 void FXJS_DefineGlobalMethod(v8::Isolate* pIsolate, | 113 void FXJS_DefineGlobalMethod(v8::Isolate* pIsolate, |
| 115 const wchar_t* sMethodName, | 114 const wchar_t* sMethodName, |
| 116 v8::FunctionCallback pMethodCall); | 115 v8::FunctionCallback pMethodCall); |
| 117 void FXJS_DefineGlobalConst(v8::Isolate* pIsolate, | 116 void FXJS_DefineGlobalConst(v8::Isolate* pIsolate, |
| 118 const wchar_t* sConstName, | 117 const wchar_t* sConstName, |
| 119 v8::Local<v8::Value> pDefault); | 118 v8::Local<v8::Value> pDefault); |
| 120 | 119 |
| 121 // Called after FXJS_Define* calls made. | 120 // Called after FXJS_Define* calls made. |
| 122 void FXJS_InitializeRuntime(v8::Isolate* pIsolate, | 121 void FXJS_InitializeRuntime( |
| 123 IJS_Runtime* pIRuntime, | 122 v8::Isolate* pIsolate, |
| 124 v8::Global<v8::Context>& v8PersistentContext); | 123 IJS_Runtime* pIRuntime, |
| 124 v8::Global<v8::Context>* pV8PersistentContext, |
| 125 std::vector<v8::Global<v8::Object>*>* pStaticObjects); |
| 125 void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, | 126 void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, |
| 126 v8::Global<v8::Context>& v8PersistentContext); | 127 v8::Global<v8::Context>* pV8PersistentContext, |
| 128 std::vector<v8::Global<v8::Object>*>* pStaticObjects); |
| 127 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate); | 129 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate); |
| 128 | 130 |
| 129 // Called after FXJS_InitializeRuntime call made. | 131 // Called after FXJS_InitializeRuntime call made. |
| 130 int FXJS_Execute(v8::Isolate* pIsolate, | 132 int FXJS_Execute(v8::Isolate* pIsolate, |
| 131 IJS_Context* pJSContext, | 133 IJS_Context* pJSContext, |
| 132 const wchar_t* script, | 134 const wchar_t* script, |
| 133 FXJSErr* perror); | 135 FXJSErr* perror); |
| 134 | 136 |
| 135 v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate, | 137 v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate, |
| 136 IJS_Runtime* pJSContext, | 138 IJS_Runtime* pJSContext, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); | 215 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); |
| 214 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, | 216 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, |
| 215 v8::Local<v8::Value> pValue); | 217 v8::Local<v8::Value> pValue); |
| 216 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, | 218 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, |
| 217 v8::Local<v8::Value> pValue); | 219 v8::Local<v8::Value> pValue); |
| 218 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, | 220 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, |
| 219 v8::Local<v8::Value> pValue); | 221 v8::Local<v8::Value> pValue); |
| 220 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); | 222 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); |
| 221 | 223 |
| 222 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ | 224 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ |
| OLD | NEW |