diff options
author | weili <weili@chromium.org> | 2016-09-22 10:38:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-22 10:38:53 -0700 |
commit | a4ad5957af799374d4710f3847b85f57bea13f47 (patch) | |
tree | 8c7177419e240452f95688464df0c3e355b21edc /fxjs/include | |
parent | da4bd1099d3566bc7f68a036eef091b07a8d873a (diff) | |
download | pdfium-a4ad5957af799374d4710f3847b85f57bea13f47.tar.xz |
Simplify memory management for per isolate data
Use smart pointers for FXJS_PerIsolateData owned member variables. Also
move creation and deletion of dynamic object map into
FXJS_PerIsolateData's constructor and destructor. Overall, the
interfaces and memory management should be simpler.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2358343002
Diffstat (limited to 'fxjs/include')
-rw-r--r-- | fxjs/include/fxjs_v8.h | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/fxjs/include/fxjs_v8.h b/fxjs/include/fxjs_v8.h index 8b5fc8399a..c87d8a5873 100644 --- a/fxjs/include/fxjs_v8.h +++ b/fxjs/include/fxjs_v8.h @@ -100,23 +100,14 @@ class FXJS_PerIsolateData { static void SetUp(v8::Isolate* pIsolate); static FXJS_PerIsolateData* Get(v8::Isolate* pIsolate); - void CreateDynamicObjsMap(v8::Isolate* pIsolate) { - if (!m_pDynamicObjsMap) - m_pDynamicObjsMap = new V8TemplateMap(pIsolate); - } - void ReleaseDynamicObjsMap() { - delete m_pDynamicObjsMap; - m_pDynamicObjsMap = nullptr; - } - - std::vector<CFXJS_ObjDefinition*> m_ObjectDefnArray; + std::vector<std::unique_ptr<CFXJS_ObjDefinition>> m_ObjectDefnArray; #ifdef PDF_ENABLE_XFA std::unique_ptr<CFXJSE_RuntimeData> m_pFXJSERuntimeData; #endif // PDF_ENABLE_XFA - V8TemplateMap* m_pDynamicObjsMap; + std::unique_ptr<V8TemplateMap> m_pDynamicObjsMap; protected: - FXJS_PerIsolateData(); + explicit FXJS_PerIsolateData(v8::Isolate* pIsolate); }; class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |