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 // PDFium wrapper around V8 APIs. PDFium code should include this file rather | 7 // PDFium wrapper around V8 APIs. PDFium code should include this file rather |
8 // than including V8 headers directly. | 8 // than including V8 headers directly. |
9 | 9 |
10 #ifndef FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ | 10 #ifndef FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 void* AllocateUninitialized(size_t length) override; | 55 void* AllocateUninitialized(size_t length) override; |
56 void Free(void* data, size_t length) override; | 56 void Free(void* data, size_t length) override; |
57 }; | 57 }; |
58 | 58 |
59 using FXJS_CONSTRUCTOR = void (*)(IFXJS_Context* cc, | 59 using FXJS_CONSTRUCTOR = void (*)(IFXJS_Context* cc, |
60 v8::Local<v8::Object> obj, | 60 v8::Local<v8::Object> obj, |
61 v8::Local<v8::Object> global); | 61 v8::Local<v8::Object> global); |
62 using FXJS_DESTRUCTOR = void (*)(v8::Local<v8::Object> obj); | 62 using FXJS_DESTRUCTOR = void (*)(v8::Local<v8::Object> obj); |
63 | 63 |
64 // Call before making FXJS_PrepareIsolate call. | 64 // Call before making FXJS_PrepareIsolate call. |
65 void FXJS_Initialize(unsigned int embedderDataSlot); | 65 void FXJS_Initialize(unsigned int embedderDataSlot, v8::Isolate* pIsolate); |
66 void FXJS_Release(); | 66 void FXJS_Release(); |
67 | 67 |
| 68 // Gets the global isolate set by FXJS_Initialize(), or makes a new one each |
| 69 // time if there is no such isolate. Returns true if a new isolate had to be |
| 70 // created. |
| 71 bool FXJS_GetIsolate(v8::Isolate** pResultIsolate); |
| 72 |
68 // Call before making FXJS_Define* calls. Resources allocated here are cleared | 73 // Call before making FXJS_Define* calls. Resources allocated here are cleared |
69 // as part of FXJS_ReleaseRuntime(). | 74 // as part of FXJS_ReleaseRuntime(). |
70 void FXJS_PrepareIsolate(v8::Isolate* pIsolate); | 75 void FXJS_PrepareIsolate(v8::Isolate* pIsolate); |
71 | 76 |
72 // Call before making JS_Define* calls. Resources allocated here are cleared | 77 // Call before making JS_Define* calls. Resources allocated here are cleared |
73 // as part of JS_ReleaseRuntime(). | 78 // as part of JS_ReleaseRuntime(). |
74 void JS_PrepareIsolate(v8::Isolate* pIsolate); | 79 void JS_PrepareIsolate(v8::Isolate* pIsolate); |
75 | 80 |
76 // Always returns a valid, newly-created objDefnID. | 81 // Always returns a valid, newly-created objDefnID. |
77 int FXJS_DefineObj(v8::Isolate* pIsolate, | 82 int FXJS_DefineObj(v8::Isolate* pIsolate, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); | 210 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); |
206 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, | 211 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, |
207 v8::Local<v8::Value> pValue); | 212 v8::Local<v8::Value> pValue); |
208 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, | 213 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, |
209 v8::Local<v8::Value> pValue); | 214 v8::Local<v8::Value> pValue); |
210 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, | 215 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, |
211 v8::Local<v8::Value> pValue); | 216 v8::Local<v8::Value> pValue); |
212 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); | 217 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); |
213 | 218 |
214 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ | 219 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ |
OLD | NEW |