From 54be7be992f1cde40b9d5c0e55a119c6cc4e4e02 Mon Sep 17 00:00:00 2001 From: weili Date: Wed, 21 Sep 2016 10:19:50 -0700 Subject: Fix leaks related to the usage of JSE runtime data Per isolate runtime data should be deleted when the associated isolate's destructed. Also, the internal of per isolate runtime data is obscure to the JS engine. So XFA or this class itself has to be in charge of the memory management. Use smart pointer for it so that the resource could be released properly. BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2354923003 --- fxjs/include/fxjs_v8.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'fxjs/include') diff --git a/fxjs/include/fxjs_v8.h b/fxjs/include/fxjs_v8.h index 7c4a9070f8..c08cc8b7ad 100644 --- a/fxjs/include/fxjs_v8.h +++ b/fxjs/include/fxjs_v8.h @@ -18,9 +18,15 @@ #include #include +#include #include #include "core/fxcrt/include/fx_string.h" +#ifdef PDF_ENABLE_XFA +// Header for CFXJSE_RuntimeData. FXJS_V8 doesn't interpret this class, +// it is just passed along to XFA. +#include "fxjs/cfxjse_runtimedata.h" +#endif // PDF_ENABLE_XFA class CFXJS_Engine; class CFXJS_ObjDefinition; @@ -29,12 +35,6 @@ class CFXJS_ObjDefinition; // on to caller-provided methods. class IJS_Context; // A description of the event that caused JS execution. -#ifdef PDF_ENABLE_XFA -// FXJS_V8 places no interpreation on this calass; it merely passes it -// along to XFA. -class CFXJSE_RuntimeData; -#endif // PDF_ENABLE_XFA - enum FXJSOBJTYPE { FXJSOBJTYPE_DYNAMIC = 0, // Created by native method and returned to JS. FXJSOBJTYPE_STATIC, // Created by init and hung off of global object. @@ -111,7 +111,7 @@ class FXJS_PerIsolateData { std::vector m_ObjectDefnArray; #ifdef PDF_ENABLE_XFA - CFXJSE_RuntimeData* m_pFXJSERuntimeData; + std::unique_ptr m_pFXJSERuntimeData; #endif // PDF_ENABLE_XFA V8TemplateMap* m_pDynamicObjsMap; -- cgit v1.2.3