Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Side by Side Diff: fpdfsdk/include/jsapi/fxjs_v8.h

Issue 1424933013: Keep "static" objects per-context rather than per isolate. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | fpdfsdk/src/javascript/JS_Runtime.h » ('j') | fpdfsdk/src/javascript/JS_Runtime.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 extern const wchar_t kFXJSValueNameString[]; 48 extern const wchar_t kFXJSValueNameString[];
49 extern const wchar_t kFXJSValueNameNumber[]; 49 extern const wchar_t kFXJSValueNameNumber[];
50 extern const wchar_t kFXJSValueNameBoolean[]; 50 extern const wchar_t kFXJSValueNameBoolean[];
51 extern const wchar_t kFXJSValueNameDate[]; 51 extern const wchar_t kFXJSValueNameDate[];
52 extern const wchar_t kFXJSValueNameObject[]; 52 extern const wchar_t kFXJSValueNameObject[];
53 extern const wchar_t kFXJSValueNameFxobj[]; 53 extern const wchar_t kFXJSValueNameFxobj[];
54 extern const wchar_t kFXJSValueNameNull[]; 54 extern const wchar_t kFXJSValueNameNull[];
55 extern const wchar_t kFXJSValueNameUndefined[]; 55 extern const wchar_t kFXJSValueNameUndefined[];
56 56
57
58 class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 57 class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
59 void* Allocate(size_t length) override; 58 void* Allocate(size_t length) override;
60 void* AllocateUninitialized(size_t length) override; 59 void* AllocateUninitialized(size_t length) override;
61 void Free(void* data, size_t length) override; 60 void Free(void* data, size_t length) override;
62 }; 61 };
63 62
64 using FXJS_CONSTRUCTOR = void (*)(IJS_Runtime* cc, v8::Local<v8::Object> obj); 63 using FXJS_CONSTRUCTOR = void (*)(IJS_Runtime* cc, v8::Local<v8::Object> obj);
65 using FXJS_DESTRUCTOR = void (*)(v8::Local<v8::Object> obj); 64 using FXJS_DESTRUCTOR = void (*)(v8::Local<v8::Object> obj);
66 65
67 // Call before making FXJS_PrepareIsolate call. 66 // Call before making FXJS_PrepareIsolate call.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 const wchar_t* sConstName, 110 const wchar_t* sConstName,
112 v8::Local<v8::Value> pDefault); 111 v8::Local<v8::Value> pDefault);
113 void FXJS_DefineGlobalMethod(v8::Isolate* pIsolate, 112 void FXJS_DefineGlobalMethod(v8::Isolate* pIsolate,
114 const wchar_t* sMethodName, 113 const wchar_t* sMethodName,
115 v8::FunctionCallback pMethodCall); 114 v8::FunctionCallback pMethodCall);
116 void FXJS_DefineGlobalConst(v8::Isolate* pIsolate, 115 void FXJS_DefineGlobalConst(v8::Isolate* pIsolate,
117 const wchar_t* sConstName, 116 const wchar_t* sConstName,
118 v8::Local<v8::Value> pDefault); 117 v8::Local<v8::Value> pDefault);
119 118
120 // Called after FXJS_Define* calls made. 119 // Called after FXJS_Define* calls made.
121 void FXJS_InitializeRuntime(v8::Isolate* pIsolate, 120 void FXJS_InitializeRuntime(
122 IJS_Runtime* pIRuntime, 121 v8::Isolate* pIsolate,
123 v8::Global<v8::Context>& v8PersistentContext); 122 IJS_Runtime* pIRuntime,
123 v8::Global<v8::Context>* pV8PersistentContext,
124 std::vector<v8::Global<v8::Object>*>* pStaticObjects);
124 void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, 125 void FXJS_ReleaseRuntime(v8::Isolate* pIsolate,
125 v8::Global<v8::Context>& v8PersistentContext); 126 v8::Global<v8::Context>* pV8PersistentContext,
127 std::vector<v8::Global<v8::Object>*>* pStaticObjects);
126 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate); 128 IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate);
127 129
128 // Called after FXJS_InitializeRuntime call made. 130 // Called after FXJS_InitializeRuntime call made.
129 int FXJS_Execute(v8::Isolate* pIsolate, 131 int FXJS_Execute(v8::Isolate* pIsolate,
130 IJS_Context* pJSContext, 132 IJS_Context* pJSContext,
131 const wchar_t* script, 133 const wchar_t* script,
132 FXJSErr* perror); 134 FXJSErr* perror);
133 135
134 v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate, 136 v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate,
135 IJS_Runtime* pJSContext, 137 IJS_Runtime* pJSContext,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); 214 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue);
213 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, 215 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate,
214 v8::Local<v8::Value> pValue); 216 v8::Local<v8::Value> pValue);
215 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, 217 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate,
216 v8::Local<v8::Value> pValue); 218 v8::Local<v8::Value> pValue);
217 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, 219 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate,
218 v8::Local<v8::Value> pValue); 220 v8::Local<v8::Value> pValue);
219 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); 221 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom);
220 222
221 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ 223 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/src/javascript/JS_Runtime.h » ('j') | fpdfsdk/src/javascript/JS_Runtime.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698