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 FXJSE_RUNTIME_H_ 8 #define FXJSE_RUNTIME_H_ 9 class CFXJSE_RuntimeList; 10 class CFXJSE_RuntimeData { 11 protected: 12 CFXJSE_RuntimeData(v8::Isolate* pIsolate) : m_pIsolate(pIsolate){}; 13 14 public: 15 static CFXJSE_RuntimeData* Create(v8::Isolate* pIsolate); 16 static CFXJSE_RuntimeData* Get(v8::Isolate* pIsolate); 17 18 public: 19 v8::Isolate* m_pIsolate; 20 v8::Global<v8::FunctionTemplate> m_hRootContextGlobalTemplate; 21 v8::Global<v8::Context> m_hRootContext; 22 23 public: 24 static CFXJSE_RuntimeList* g_RuntimeList; 25 26 protected: 27 CFXJSE_RuntimeData(); 28 CFXJSE_RuntimeData(const CFXJSE_RuntimeData&); 29 CFXJSE_RuntimeData& operator=(const CFXJSE_RuntimeData&); 30 }; 31 class CFXJSE_RuntimeList { 32 public: 33 typedef void (*RuntimeDisposeCallback)(v8::Isolate*); 34 35 public: 36 void AppendRuntime(v8::Isolate* pIsolate); 37 void RemoveRuntime(v8::Isolate* pIsolate, 38 RuntimeDisposeCallback lpfnDisposeCallback); 39 void RemoveAllRuntimes(RuntimeDisposeCallback lpfnDisposeCallback); 40 41 protected: 42 CFX_ArrayTemplate<v8::Isolate*> m_RuntimeList; 43 }; 44 #endif 45