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

Side by Side Diff: fxjs/fxjs_v8.h

Issue 2421603002: Reland: Make the CPDFXFA_App non-global (Closed)
Patch Set: Review feedback Created 4 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 | « fpdfsdk/javascript/cjs_runtime.cpp ('k') | fxjs/fxjs_v8.cpp » ('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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 explicit CFXJS_Engine(v8::Isolate* pIsolate); 132 explicit CFXJS_Engine(v8::Isolate* pIsolate);
133 ~CFXJS_Engine(); 133 ~CFXJS_Engine();
134 134
135 using Constructor = void (*)(CFXJS_Engine* pEngine, 135 using Constructor = void (*)(CFXJS_Engine* pEngine,
136 v8::Local<v8::Object> obj); 136 v8::Local<v8::Object> obj);
137 using Destructor = void (*)(CFXJS_Engine* pEngine, v8::Local<v8::Object> obj); 137 using Destructor = void (*)(CFXJS_Engine* pEngine, v8::Local<v8::Object> obj);
138 138
139 static CFXJS_Engine* CurrentEngineFromIsolate(v8::Isolate* pIsolate); 139 static CFXJS_Engine* CurrentEngineFromIsolate(v8::Isolate* pIsolate);
140 static int GetObjDefnID(v8::Local<v8::Object> pObj); 140 static int GetObjDefnID(v8::Local<v8::Object> pObj);
141 141
142 #ifdef PDF_ENABLE_XFA
143 // Called as part of FXJS_InitializeEngine, exposed so PDF can make its
144 // own contexts compatible with XFA or vice versa.
145 static void SetForV8Context(v8::Local<v8::Context> v8Context,
146 CFXJS_Engine* pEngine);
147 #endif // PDF_ENABLE_XFA
148
149 v8::Isolate* GetIsolate() const { return m_isolate; } 142 v8::Isolate* GetIsolate() const { return m_isolate; }
150 143
151 // Always returns a valid, newly-created objDefnID. 144 // Always returns a valid, newly-created objDefnID.
152 int DefineObj(const wchar_t* sObjName, 145 int DefineObj(const wchar_t* sObjName,
153 FXJSOBJTYPE eObjType, 146 FXJSOBJTYPE eObjType,
154 Constructor pConstructor, 147 Constructor pConstructor,
155 Destructor pDestructor); 148 Destructor pDestructor);
156 149
157 void DefineObjMethod(int nObjDefnID, 150 void DefineObjMethod(int nObjDefnID,
158 const wchar_t* sMethodName, 151 const wchar_t* sMethodName,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 void SetIsolate(v8::Isolate* pIsolate) { m_isolate = pIsolate; } 246 void SetIsolate(v8::Isolate* pIsolate) { m_isolate = pIsolate; }
254 247
255 private: 248 private:
256 v8::Isolate* m_isolate; 249 v8::Isolate* m_isolate;
257 v8::Global<v8::Context> m_V8PersistentContext; 250 v8::Global<v8::Context> m_V8PersistentContext;
258 std::vector<v8::Global<v8::Object>*> m_StaticObjects; 251 std::vector<v8::Global<v8::Object>*> m_StaticObjects;
259 std::map<CFX_WideString, v8::Global<v8::Array>> m_ConstArrays; 252 std::map<CFX_WideString, v8::Global<v8::Array>> m_ConstArrays;
260 }; 253 };
261 254
262 #endif // FXJS_FXJS_V8_H_ 255 #endif // FXJS_FXJS_V8_H_
OLDNEW
« no previous file with comments | « fpdfsdk/javascript/cjs_runtime.cpp ('k') | fxjs/fxjs_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698