Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / src / fxjse / src / runtime.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef FXJSE_RUNTIME_H_\r
8 #define FXJSE_RUNTIME_H_\r
9 class CFXJSE_RuntimeList;\r
10 class CFXJSE_RuntimeData : public CFX_Object\r
11 {\r
12 protected:\r
13     CFXJSE_RuntimeData(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {};\r
14 public:\r
15     static CFXJSE_RuntimeData* Create(v8::Isolate* pIsolate);\r
16     static CFXJSE_RuntimeData* Get(v8::Isolate* pIsolate);\r
17 public:\r
18     v8::Isolate*                                                        m_pIsolate;\r
19     v8::Persistent<v8::FunctionTemplate>        m_hRootContextGlobalTemplate;\r
20     v8::Persistent<v8::Context>                         m_hRootContext;\r
21 public:\r
22     static CFXJSE_RuntimeList*  g_RuntimeList;\r
23 protected:\r
24     CFXJSE_RuntimeData();\r
25     CFXJSE_RuntimeData(const CFXJSE_RuntimeData&);\r
26     CFXJSE_RuntimeData& operator = (const CFXJSE_RuntimeData&);\r
27 };\r
28 class CFXJSE_RuntimeList : public CFX_Object\r
29 {\r
30 public:\r
31     typedef void (*RuntimeDisposeCallback)(v8::Isolate*);\r
32 public:\r
33     void AppendRuntime(v8::Isolate* pIsolate);\r
34     void RemoveRuntime(v8::Isolate* pIsolate, RuntimeDisposeCallback lpfnDisposeCallback);\r
35     void RemoveAllRuntimes(RuntimeDisposeCallback lpfnDisposeCallback);\r
36 protected:\r
37     CFX_ArrayTemplate<v8::Isolate*> m_RuntimeList;\r
38 };\r
39 #endif\r