summaryrefslogtreecommitdiff
path: root/fxjs/include
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-09-21 10:19:50 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-21 10:19:50 -0700
commit54be7be992f1cde40b9d5c0e55a119c6cc4e4e02 (patch)
treef5b2926ecf00cba53a9becb0db08b00e64c55ff5 /fxjs/include
parent5819e4f334521cb1599f3d5f1f28df40528727ba (diff)
downloadpdfium-54be7be992f1cde40b9d5c0e55a119c6cc4e4e02.tar.xz
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
Diffstat (limited to 'fxjs/include')
-rw-r--r--fxjs/include/fxjs_v8.h14
1 files changed, 7 insertions, 7 deletions
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 <v8.h>
#include <map>
+#include <memory>
#include <vector>
#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<CFXJS_ObjDefinition*> m_ObjectDefnArray;
#ifdef PDF_ENABLE_XFA
- CFXJSE_RuntimeData* m_pFXJSERuntimeData;
+ std::unique_ptr<CFXJSE_RuntimeData> m_pFXJSERuntimeData;
#endif // PDF_ENABLE_XFA
V8TemplateMap* m_pDynamicObjsMap;