OLD | NEW |
1 // Copyright 2016 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 FXJS_CFXJSE_ISOLATETRACKER_H_ | 7 #ifndef FXJS_CFXJSE_ISOLATETRACKER_H_ |
8 #define FXJS_CFXJSE_ISOLATETRACKER_H_ | 8 #define FXJS_CFXJSE_ISOLATETRACKER_H_ |
9 | 9 |
| 10 #include <map> |
| 11 #include <memory> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
13 | 15 |
14 #include "fxjs/cfxjse_runtimedata.h" | 16 #include "fxjs/cfxjse_runtimedata.h" |
15 | 17 |
16 class CFXJSE_ScopeUtil_IsolateHandle { | 18 class CFXJSE_ScopeUtil_IsolateHandle { |
17 public: | 19 public: |
18 explicit CFXJSE_ScopeUtil_IsolateHandle(v8::Isolate* pIsolate) | 20 explicit CFXJSE_ScopeUtil_IsolateHandle(v8::Isolate* pIsolate) |
19 : m_isolate(pIsolate), m_iscope(pIsolate), m_hscope(pIsolate) {} | 21 : m_isolate(pIsolate), m_iscope(pIsolate), m_hscope(pIsolate) {} |
(...skipping 30 matching lines...) Expand all Loading... |
50 v8::Context::Scope m_cscope; | 52 v8::Context::Scope m_cscope; |
51 }; | 53 }; |
52 | 54 |
53 class CFXJSE_IsolateTracker { | 55 class CFXJSE_IsolateTracker { |
54 public: | 56 public: |
55 typedef void (*DisposeCallback)(v8::Isolate*, bool bOwnedIsolate); | 57 typedef void (*DisposeCallback)(v8::Isolate*, bool bOwnedIsolate); |
56 | 58 |
57 CFXJSE_IsolateTracker(); | 59 CFXJSE_IsolateTracker(); |
58 ~CFXJSE_IsolateTracker(); | 60 ~CFXJSE_IsolateTracker(); |
59 | 61 |
60 void Append(v8::Isolate* pIsolate); | 62 void Append(v8::Isolate* pIsolate, |
| 63 std::unique_ptr<v8::ArrayBuffer::Allocator> alloc); |
61 void Remove(v8::Isolate* pIsolate, DisposeCallback lpfnDisposeCallback); | 64 void Remove(v8::Isolate* pIsolate, DisposeCallback lpfnDisposeCallback); |
62 void RemoveAll(DisposeCallback lpfnDisposeCallback); | 65 void RemoveAll(DisposeCallback lpfnDisposeCallback); |
63 | 66 |
64 static CFXJSE_IsolateTracker* g_pInstance; | 67 static CFXJSE_IsolateTracker* g_pInstance; |
65 | 68 |
66 protected: | 69 protected: |
67 std::vector<v8::Isolate*> m_OwnedIsolates; | 70 std::vector<v8::Isolate*> m_OwnedIsolates; |
| 71 std::map<v8::Isolate*, std::unique_ptr<v8::ArrayBuffer::Allocator>> |
| 72 m_AllocatorMap; |
68 }; | 73 }; |
69 | 74 |
70 #endif // FXJS_CFXJSE_ISOLATETRACKER_H_ | 75 #endif // FXJS_CFXJSE_ISOLATETRACKER_H_ |
OLD | NEW |