Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 41 extern const wchar_t kFXJSValueNameBoolean[]; | 41 extern const wchar_t kFXJSValueNameBoolean[]; |
| 42 extern const wchar_t kFXJSValueNameDate[]; | 42 extern const wchar_t kFXJSValueNameDate[]; |
| 43 extern const wchar_t kFXJSValueNameObject[]; | 43 extern const wchar_t kFXJSValueNameObject[]; |
| 44 extern const wchar_t kFXJSValueNameFxobj[]; | 44 extern const wchar_t kFXJSValueNameFxobj[]; |
| 45 extern const wchar_t kFXJSValueNameNull[]; | 45 extern const wchar_t kFXJSValueNameNull[]; |
| 46 extern const wchar_t kFXJSValueNameUndefined[]; | 46 extern const wchar_t kFXJSValueNameUndefined[]; |
| 47 | 47 |
| 48 class IFXJS_Context; | 48 class IFXJS_Context; |
| 49 class IFXJS_Runtime; | 49 class IFXJS_Runtime; |
| 50 | 50 |
| 51 class JS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | |
| 52 void* Allocate(size_t length) override; | |
| 53 void* AllocateUninitialized(size_t length) override; | |
| 54 void Free(void* data, size_t length) override; | |
| 55 }; | |
| 56 | |
| 51 typedef void (*LP_CONSTRUCTOR)(IFXJS_Context* cc, | 57 typedef void (*LP_CONSTRUCTOR)(IFXJS_Context* cc, |
| 52 v8::Local<v8::Object> obj, | 58 v8::Local<v8::Object> obj, |
| 53 v8::Local<v8::Object> global); | 59 v8::Local<v8::Object> global); |
| 54 typedef void (*LP_DESTRUCTOR)(v8::Local<v8::Object> obj); | 60 typedef void (*LP_DESTRUCTOR)(v8::Local<v8::Object> obj); |
| 55 | 61 |
| 62 // Call before making JS_PrepareIsolate call. | |
| 63 void JS_Initialize(unsigned int embedderDataSlot); | |
| 64 void JS_Release(); | |
| 65 | |
| 66 // Call before making JS_Define* calls. Resources allocated here are cleared | |
| 67 // as part of JS_ReleaseRunime(). | |
| 68 void JS_PrepareIsolate(v8::Isolate* pIsolate); | |
| 69 | |
| 56 // Always returns a valid, newly-created objDefnID. | 70 // Always returns a valid, newly-created objDefnID. |
| 57 int JS_DefineObj(v8::Isolate* pIsolate, | 71 int JS_DefineObj(v8::Isolate* pIsolate, |
| 58 const wchar_t* sObjName, | 72 const wchar_t* sObjName, |
| 59 FXJSOBJTYPE eObjType, | 73 FXJSOBJTYPE eObjType, |
| 60 LP_CONSTRUCTOR pConstructor, | 74 LP_CONSTRUCTOR pConstructor, |
| 61 LP_DESTRUCTOR pDestructor); | 75 LP_DESTRUCTOR pDestructor); |
| 62 | 76 |
| 63 void JS_DefineObjMethod(v8::Isolate* pIsolate, | 77 void JS_DefineObjMethod(v8::Isolate* pIsolate, |
| 64 int nObjDefnID, | 78 int nObjDefnID, |
| 65 const wchar_t* sMethodName, | 79 const wchar_t* sMethodName, |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 79 int nObjDefnID, | 93 int nObjDefnID, |
| 80 const wchar_t* sConstName, | 94 const wchar_t* sConstName, |
| 81 v8::Local<v8::Value> pDefault); | 95 v8::Local<v8::Value> pDefault); |
| 82 void JS_DefineGlobalMethod(v8::Isolate* pIsolate, | 96 void JS_DefineGlobalMethod(v8::Isolate* pIsolate, |
| 83 const wchar_t* sMethodName, | 97 const wchar_t* sMethodName, |
| 84 v8::FunctionCallback pMethodCall); | 98 v8::FunctionCallback pMethodCall); |
| 85 void JS_DefineGlobalConst(v8::Isolate* pIsolate, | 99 void JS_DefineGlobalConst(v8::Isolate* pIsolate, |
| 86 const wchar_t* sConstName, | 100 const wchar_t* sConstName, |
| 87 v8::Local<v8::Value> pDefault); | 101 v8::Local<v8::Value> pDefault); |
| 88 | 102 |
| 103 // Called after JS_Define* calls made. | |
| 89 void JS_InitialRuntime(v8::Isolate* pIsolate, | 104 void JS_InitialRuntime(v8::Isolate* pIsolate, |
|
Tom Sepez
2015/09/15 15:57:44
I suppose you want this named "initialize", too ..
| |
| 90 IFXJS_Runtime* pFXRuntime, | 105 IFXJS_Runtime* pFXRuntime, |
| 91 IFXJS_Context* context, | 106 IFXJS_Context* context, |
| 92 v8::Global<v8::Context>& v8PersistentContext); | 107 v8::Global<v8::Context>& v8PersistentContext); |
| 93 void JS_ReleaseRuntime(v8::Isolate* pIsolate, | 108 void JS_ReleaseRuntime(v8::Isolate* pIsolate, |
| 94 v8::Global<v8::Context>& v8PersistentContext); | 109 v8::Global<v8::Context>& v8PersistentContext); |
| 95 void JS_Initial(unsigned int embedderDataSlot); | 110 |
| 96 void JS_Release(); | 111 // Called after JS_InitialRuntime call made. |
| 97 int JS_Execute(v8::Isolate* pIsolate, | 112 int JS_Execute(v8::Isolate* pIsolate, |
| 98 IFXJS_Context* pJSContext, | 113 IFXJS_Context* pJSContext, |
| 99 const wchar_t* script, | 114 const wchar_t* script, |
| 100 long length, | 115 long length, |
| 101 FXJSErr* perror); | 116 FXJSErr* perror); |
| 117 | |
| 102 v8::Local<v8::Object> JS_NewFxDynamicObj(v8::Isolate* pIsolate, | 118 v8::Local<v8::Object> JS_NewFxDynamicObj(v8::Isolate* pIsolate, |
| 103 IFXJS_Context* pJSContext, | 119 IFXJS_Context* pJSContext, |
| 104 int nObjDefnID); | 120 int nObjDefnID); |
| 105 v8::Local<v8::Object> JS_GetStaticObj(v8::Isolate* pIsolate, int nObjDefnID); | 121 v8::Local<v8::Object> JS_GetStaticObj(v8::Isolate* pIsolate, int nObjDefnID); |
| 106 v8::Local<v8::Object> JS_GetThisObj(v8::Isolate* pIsolate); | 122 v8::Local<v8::Object> JS_GetThisObj(v8::Isolate* pIsolate); |
| 107 int JS_GetObjDefnID(v8::Local<v8::Object> pObj); | 123 int JS_GetObjDefnID(v8::Local<v8::Object> pObj); |
| 108 v8::Isolate* JS_GetRuntime(v8::Local<v8::Object> pObj); | 124 v8::Isolate* JS_GetRuntime(v8::Local<v8::Object> pObj); |
| 109 int JS_GetObjDefnID(v8::Isolate* pIsolate, const wchar_t* pObjName); | 125 int JS_GetObjDefnID(v8::Isolate* pIsolate, const wchar_t* pObjName); |
| 110 void JS_Error(v8::Isolate* isolate, const CFX_WideString& message); | 126 void JS_Error(v8::Isolate* isolate, const CFX_WideString& message); |
| 111 unsigned JS_CalcHash(const wchar_t* main, unsigned nLen); | 127 unsigned JS_CalcHash(const wchar_t* main, unsigned nLen); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 int JS_GetMinFromTime(double dt); | 214 int JS_GetMinFromTime(double dt); |
| 199 int JS_GetSecFromTime(double dt); | 215 int JS_GetSecFromTime(double dt); |
| 200 double JS_DateParse(const wchar_t* string); | 216 double JS_DateParse(const wchar_t* string); |
| 201 double JS_MakeDay(int nYear, int nMonth, int nDay); | 217 double JS_MakeDay(int nYear, int nMonth, int nDay); |
| 202 double JS_MakeTime(int nHour, int nMin, int nSec, int nMs); | 218 double JS_MakeTime(int nHour, int nMin, int nSec, int nMs); |
| 203 double JS_MakeDate(double day, double time); | 219 double JS_MakeDate(double day, double time); |
| 204 bool JS_PortIsNan(double d); | 220 bool JS_PortIsNan(double d); |
| 205 double JS_LocalTime(double d); | 221 double JS_LocalTime(double d); |
| 206 | 222 |
| 207 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ | 223 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ |
| OLD | NEW |