diff options
author | tsepez <tsepez@chromium.org> | 2016-06-01 14:01:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-01 14:01:31 -0700 |
commit | d5f726188761cd00cb3d16921093a859bda39a71 (patch) | |
tree | 53b0ae177f9f1d08a627ac3517356f5e62345beb /xfa/fxjse/runtime.h | |
parent | c3246466df915a5b8a639dd3a611d18cd106773b (diff) | |
download | pdfium-d5f726188761cd00cb3d16921093a859bda39a71.tar.xz |
Track shared isolates better in FXJSE.
Fix the asymmetry between creating only some isolates and
releasing all of them, even the shared ones, by being more
careful not to trash those we didn't create.
Review-Url: https://codereview.chromium.org/2025193002
Diffstat (limited to 'xfa/fxjse/runtime.h')
-rw-r--r-- | xfa/fxjse/runtime.h | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/xfa/fxjse/runtime.h b/xfa/fxjse/runtime.h index 1240089be4..b57efe1df7 100644 --- a/xfa/fxjse/runtime.h +++ b/xfa/fxjse/runtime.h @@ -15,39 +15,32 @@ class CFXJSE_RuntimeList; class CFXJSE_RuntimeData { - protected: - CFXJSE_RuntimeData(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} - public: - static CFXJSE_RuntimeData* Create(v8::Isolate* pIsolate); static CFXJSE_RuntimeData* Get(v8::Isolate* pIsolate); - public: v8::Isolate* m_pIsolate; v8::Global<v8::FunctionTemplate> m_hRootContextGlobalTemplate; v8::Global<v8::Context> m_hRootContext; - public: - static CFXJSE_RuntimeList* g_RuntimeList; - protected: + static CFXJSE_RuntimeData* Create(v8::Isolate* pIsolate); + CFXJSE_RuntimeData(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} CFXJSE_RuntimeData(); CFXJSE_RuntimeData(const CFXJSE_RuntimeData&); CFXJSE_RuntimeData& operator=(const CFXJSE_RuntimeData&); }; -class CFXJSE_RuntimeList { +class CFXJSE_IsolateTracker { public: - typedef void (*RuntimeDisposeCallback)(v8::Isolate*); + typedef void (*DisposeCallback)(v8::Isolate*, bool bOwnedIsolate); + static CFXJSE_IsolateTracker* g_pInstance; - public: - void AppendRuntime(v8::Isolate* pIsolate); - void RemoveRuntime(v8::Isolate* pIsolate, - RuntimeDisposeCallback lpfnDisposeCallback); - void RemoveAllRuntimes(RuntimeDisposeCallback lpfnDisposeCallback); + void Append(v8::Isolate* pIsolate); + void Remove(v8::Isolate* pIsolate, DisposeCallback lpfnDisposeCallback); + void RemoveAll(DisposeCallback lpfnDisposeCallback); protected: - std::vector<v8::Isolate*> m_RuntimeList; + std::vector<v8::Isolate*> m_OwnedIsolates; }; #endif // XFA_FXJSE_RUNTIME_H_ |