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

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

Issue 1407063012: Merge to XFA: Keep "static" objects per-context rather than per isolate. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
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') | no next file with comments »
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 extern const wchar_t kFXJSValueNameString[]; 58 extern const wchar_t kFXJSValueNameString[];
59 extern const wchar_t kFXJSValueNameNumber[]; 59 extern const wchar_t kFXJSValueNameNumber[];
60 extern const wchar_t kFXJSValueNameBoolean[]; 60 extern const wchar_t kFXJSValueNameBoolean[];
61 extern const wchar_t kFXJSValueNameDate[]; 61 extern const wchar_t kFXJSValueNameDate[];
62 extern const wchar_t kFXJSValueNameObject[]; 62 extern const wchar_t kFXJSValueNameObject[];
63 extern const wchar_t kFXJSValueNameFxobj[]; 63 extern const wchar_t kFXJSValueNameFxobj[];
64 extern const wchar_t kFXJSValueNameNull[]; 64 extern const wchar_t kFXJSValueNameNull[];
65 extern const wchar_t kFXJSValueNameUndefined[]; 65 extern const wchar_t kFXJSValueNameUndefined[];
66 66
67
68 class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 67 class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
69 void* Allocate(size_t length) override; 68 void* Allocate(size_t length) override;
70 void* AllocateUninitialized(size_t length) override; 69 void* AllocateUninitialized(size_t length) override;
71 void Free(void* data, size_t length) override; 70 void Free(void* data, size_t length) override;
72 }; 71 };
73 72
74 using FXJS_CONSTRUCTOR = void (*)(IJS_Runtime* cc, v8::Local<v8::Object> obj); 73 using FXJS_CONSTRUCTOR = void (*)(IJS_Runtime* cc, v8::Local<v8::Object> obj);
75 using FXJS_DESTRUCTOR = void (*)(v8::Local<v8::Object> obj); 74 using FXJS_DESTRUCTOR = void (*)(v8::Local<v8::Object> obj);
76 75
77 // Call before making FXJS_PrepareIsolate call. 76 // Call before making FXJS_PrepareIsolate call.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 const wchar_t* sConstName, 120 const wchar_t* sConstName,
122 v8::Local<v8::Value> pDefault); 121 v8::Local<v8::Value> pDefault);
123 void FXJS_DefineGlobalMethod(v8::Isolate* pIsolate, 122 void FXJS_DefineGlobalMethod(v8::Isolate* pIsolate,
124 const wchar_t* sMethodName, 123 const wchar_t* sMethodName,
125 v8::FunctionCallback pMethodCall); 124 v8::FunctionCallback pMethodCall);
126 void FXJS_DefineGlobalConst(v8::Isolate* pIsolate, 125 void FXJS_DefineGlobalConst(v8::Isolate* pIsolate,
127 const wchar_t* sConstName, 126 const wchar_t* sConstName,
128 v8::Local<v8::Value> pDefault); 127 v8::Local<v8::Value> pDefault);
129 128
130 // Called after FXJS_Define* calls made. 129 // Called after FXJS_Define* calls made.
131 void FXJS_InitializeRuntime(v8::Isolate* pIsolate, 130 void FXJS_InitializeRuntime(
132 IJS_Runtime* pIRuntime, 131 v8::Isolate* pIsolate,
133 v8::Global<v8::Context>& v8PersistentContext); 132 IJS_Runtime* pIRuntime,
133 v8::Global<v8::Context>* pV8PersistentContext,
134 std::vector<v8::Global<v8::Object>*>* pStaticObjects);
134 void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, 135 void FXJS_ReleaseRuntime(v8::Isolate* pIsolate,
135 v8::Global<v8::Context>& v8PersistentContext); 136 v8::Global<v8::Context>* pV8PersistentContext,
137 std::vector<v8::Global<v8::Object>*>* pStaticObjects);
136 138
137 // Called as part of FXJS_InitializeRuntime, exposed so PDF can make its 139 // Called as part of FXJS_InitializeRuntime, exposed so PDF can make its
138 // own contexts compatible with XFA or vice versa. 140 // own contexts compatible with XFA or vice versa.
139 void FXJS_SetRuntimeForV8Context(v8::Local<v8::Context> v8Context, 141 void FXJS_SetRuntimeForV8Context(v8::Local<v8::Context> v8Context,
140 IJS_Runtime* pIRuntime); 142 IJS_Runtime* pIRuntime);
141 143
142 IJS_Runtime* FXJS_GetRuntimeFromV8Context(v8::Local<v8::Context> v8Context); 144 IJS_Runtime* FXJS_GetRuntimeFromV8Context(v8::Local<v8::Context> v8Context);
143 145
144 // Called after FXJS_InitializeRuntime call made. 146 // Called after FXJS_InitializeRuntime call made.
145 int FXJS_Execute(v8::Isolate* pIsolate, 147 int FXJS_Execute(v8::Isolate* pIsolate,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); 230 double FXJS_ToNumber(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue);
229 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate, 231 v8::Local<v8::Object> FXJS_ToObject(v8::Isolate* pIsolate,
230 v8::Local<v8::Value> pValue); 232 v8::Local<v8::Value> pValue);
231 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, 233 CFX_WideString FXJS_ToString(v8::Isolate* pIsolate,
232 v8::Local<v8::Value> pValue); 234 v8::Local<v8::Value> pValue);
233 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, 235 v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate,
234 v8::Local<v8::Value> pValue); 236 v8::Local<v8::Value> pValue);
235 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); 237 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom);
236 238
237 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ 239 #endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/src/javascript/JS_Runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698