| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef FXJSE_RUNTIME_H_ | 7 #ifndef FXJS_CFXJSE_RUNTIMEDATA_H_ |
| 8 #define FXJSE_RUNTIME_H_ | 8 #define FXJS_CFXJSE_RUNTIMEDATA_H_ |
| 9 | 9 |
| 10 #include <vector> | |
| 11 | |
| 12 #include "core/fxcrt/include/fx_basic.h" | |
| 13 #include "v8/include/v8.h" | 10 #include "v8/include/v8.h" |
| 14 | 11 |
| 15 class CFXJSE_RuntimeList; | 12 class CFXJSE_RuntimeList; |
| 16 | 13 |
| 17 class CFXJSE_RuntimeData { | 14 class CFXJSE_RuntimeData { |
| 18 public: | 15 public: |
| 19 ~CFXJSE_RuntimeData(); | 16 ~CFXJSE_RuntimeData(); |
| 20 | 17 |
| 21 static CFXJSE_RuntimeData* Get(v8::Isolate* pIsolate); | 18 static CFXJSE_RuntimeData* Get(v8::Isolate* pIsolate); |
| 22 | 19 |
| 23 v8::Isolate* m_pIsolate; | 20 v8::Isolate* m_pIsolate; |
| 24 v8::Global<v8::FunctionTemplate> m_hRootContextGlobalTemplate; | 21 v8::Global<v8::FunctionTemplate> m_hRootContextGlobalTemplate; |
| 25 v8::Global<v8::Context> m_hRootContext; | 22 v8::Global<v8::Context> m_hRootContext; |
| 26 | 23 |
| 27 protected: | 24 protected: |
| 28 explicit CFXJSE_RuntimeData(v8::Isolate* pIsolate); | 25 explicit CFXJSE_RuntimeData(v8::Isolate* pIsolate); |
| 29 | 26 |
| 30 static CFXJSE_RuntimeData* Create(v8::Isolate* pIsolate); | 27 static CFXJSE_RuntimeData* Create(v8::Isolate* pIsolate); |
| 31 | 28 |
| 32 private: | 29 private: |
| 33 CFXJSE_RuntimeData(const CFXJSE_RuntimeData&) = delete; | 30 CFXJSE_RuntimeData(const CFXJSE_RuntimeData&) = delete; |
| 34 CFXJSE_RuntimeData& operator=(const CFXJSE_RuntimeData&) = delete; | 31 CFXJSE_RuntimeData& operator=(const CFXJSE_RuntimeData&) = delete; |
| 35 }; | 32 }; |
| 36 | 33 |
| 37 class CFXJSE_IsolateTracker { | 34 #endif // FXJS_CFXJSE_RUNTIMEDATA_H_ |
| 38 public: | |
| 39 typedef void (*DisposeCallback)(v8::Isolate*, bool bOwnedIsolate); | |
| 40 | |
| 41 CFXJSE_IsolateTracker(); | |
| 42 ~CFXJSE_IsolateTracker(); | |
| 43 | |
| 44 void Append(v8::Isolate* pIsolate); | |
| 45 void Remove(v8::Isolate* pIsolate, DisposeCallback lpfnDisposeCallback); | |
| 46 void RemoveAll(DisposeCallback lpfnDisposeCallback); | |
| 47 | |
| 48 static CFXJSE_IsolateTracker* g_pInstance; | |
| 49 | |
| 50 protected: | |
| 51 std::vector<v8::Isolate*> m_OwnedIsolates; | |
| 52 }; | |
| 53 | |
| 54 #endif // FXJSE_RUNTIME_H_ | |
| OLD | NEW |