Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Unified Diff: xfa/fxfa/parser/xfa_script_imp.h

Issue 2062113002: Cleanup ownership in CXFA_ScriptContext. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Review feedback Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_object_imp.cpp ('k') | xfa/fxfa/parser/xfa_script_imp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/xfa_script_imp.h
diff --git a/xfa/fxfa/parser/xfa_script_imp.h b/xfa/fxfa/parser/xfa_script_imp.h
index 64d1e1a6d7c0b5dcf19ddb1ee6d21b7ed86a8dbd..d36e468b50dbd5678196aed5abb221384992748d 100644
--- a/xfa/fxfa/parser/xfa_script_imp.h
+++ b/xfa/fxfa/parser/xfa_script_imp.h
@@ -8,6 +8,8 @@
#define XFA_FXFA_PARSER_XFA_SCRIPT_IMP_H_
#include <map>
+#include <memory>
+#include <vector>
#include "fxjse/include/cfxjse_arguments.h"
#include "xfa/fxfa/fm2js/xfa_fm2jscontext.h"
@@ -37,7 +39,7 @@ class CXFA_ScriptContext {
uint32_t dwStyles = XFA_RESOLVENODE_Children,
CXFA_Node* bindNode = NULL);
CFXJSE_Value* GetJSValueFromMap(CXFA_Object* pObject);
- void CacheList(CXFA_NodeList* pList) { m_CacheListArray.Add(pList); }
+ void AddToCacheList(std::unique_ptr<CXFA_NodeList> pList);
CXFA_Object* GetThisObject() const { return m_pThisObject; }
v8::Isolate* GetRuntime() const { return m_pIsolate; }
@@ -87,7 +89,6 @@ class CXFA_ScriptContext {
FX_BOOL RunVariablesScript(CXFA_Node* pScriptNode);
CXFA_Object* GetVariablesThis(CXFA_Object* pObject,
FX_BOOL bScriptNode = FALSE);
- void ReleaseVariablesMap();
FX_BOOL IsStrictScopeInJavaScript();
XFA_SCRIPTLANGTYPE GetType();
CXFA_NodeArray& GetUpObjectArray() { return m_upObjectArray; }
@@ -103,18 +104,19 @@ class CXFA_ScriptContext {
void RemoveBuiltInObjs(CFXJSE_Context* pContext) const;
CXFA_Document* m_pDocument;
- CFXJSE_Context* m_pJsContext;
+ std::unique_ptr<CFXJSE_Context> m_JsContext;
v8::Isolate* m_pIsolate;
CFXJSE_Class* m_pJsClass;
XFA_SCRIPTLANGTYPE m_eScriptType;
- CFX_MapPtrTemplate<CXFA_Object*, CFXJSE_Value*> m_mapXFAToValue;
+ std::map<CXFA_Object*, std::unique_ptr<CFXJSE_Value>> m_mapObjectToValue;
CFX_MapPtrTemplate<CXFA_Object*, CFXJSE_Context*> m_mapVariableToContext;
CXFA_EventParam m_eventParam;
CXFA_NodeArray m_upObjectArray;
- CFX_ArrayTemplate<CXFA_NodeList*> m_CacheListArray;
+ // CacheList holds the NodeList items so we can clean them up when we're done.
+ std::vector<std::unique_ptr<CXFA_NodeList>> m_CacheList;
CXFA_NodeArray* m_pScriptNodeArray;
- CXFA_ResolveProcessor* m_pResolveProcessor;
- CXFA_FM2JSContext* m_hFM2JSContext;
+ std::unique_ptr<CXFA_ResolveProcessor> m_ResolveProcessor;
+ std::unique_ptr<CXFA_FM2JSContext> m_FM2JSContext;
CXFA_Object* m_pThisObject;
uint32_t m_dwBuiltInInFlags;
XFA_ATTRIBUTEENUM m_eRunAtType;
« no previous file with comments | « xfa/fxfa/parser/xfa_object_imp.cpp ('k') | xfa/fxfa/parser/xfa_script_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698