OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef XFA_SRC_FXJSE_CONTEXT_H_ | |
8 #define XFA_SRC_FXJSE_CONTEXT_H_ | |
9 | |
10 #include "core/include/fxcrt/fx_basic.h" | |
11 #include "v8/include/v8.h" | |
12 #include "xfa/include/fxjse/fxjse.h" | |
13 | |
14 class CFXJSE_Class; | |
15 class CFXJSE_Value; | |
16 | |
17 class CFXJSE_Context { | |
18 protected: | |
19 CFXJSE_Context(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} | |
20 | |
21 public: | |
22 static CFXJSE_Context* Create(v8::Isolate* pIsolate, | |
23 const FXJSE_CLASS* lpGlobalClass = NULL, | |
24 void* lpGlobalObject = NULL); | |
25 ~CFXJSE_Context(); | |
26 V8_INLINE v8::Isolate* GetRuntime(void) { return m_pIsolate; } | |
27 void GetGlobalObject(CFXJSE_Value* pValue); | |
28 FX_BOOL ExecuteScript(const FX_CHAR* szScript, | |
29 CFXJSE_Value* lpRetValue, | |
30 CFXJSE_Value* lpNewThisObject = NULL); | |
31 | |
32 protected: | |
33 CFXJSE_Context(); | |
34 CFXJSE_Context(const CFXJSE_Context&); | |
35 CFXJSE_Context& operator=(const CFXJSE_Context&); | |
36 | |
37 protected: | |
38 v8::Global<v8::Context> m_hContext; | |
39 v8::Isolate* m_pIsolate; | |
40 CFX_ArrayTemplate<CFXJSE_Class*> m_rgClasses; | |
41 friend class CFXJSE_Class; | |
42 friend class CFXJSE_ScopeUtil_IsolateHandleContext; | |
43 friend class CFXJSE_ScopeUtil_IsolateHandleRootOrNormalContext; | |
44 }; | |
45 v8::Local<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate, | |
46 v8::TryCatch& trycatch); | |
47 | |
48 #endif // XFA_SRC_FXJSE_CONTEXT_H_ | |
OLD | NEW |