summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_document.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-02-13 20:55:03 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-13 20:55:03 +0000
commit80bf582f00adeefae67ae432b74c3b0609e7845e (patch)
tree18c88bc620fcded6fc39cdfe3a5b0ae04643424d /xfa/fxfa/parser/cxfa_document.h
parent566d0b9486f024f253d1c331866b04529c9a22b3 (diff)
downloadpdfium-80bf582f00adeefae67ae432b74c3b0609e7845e.tar.xz
Cleanup CXFA_Node ownership
Currently a CXFA_Node can be owned by the CXFA_Document root pointer, the CXFA_Document Purge list or as a child of another CXFA_Node. This makes it hard to know who currently owns what. This CL moves all ownership of nodes into a CXFA_NodeOwner class which CXFA_Document subclasses. The node owner always owns all nodes and is responsible for cleaning them up upon destruction. The destruction order is not guarenteed to be in tree order as nodes can be inserted and moved around the tree. Change-Id: I6b202b8e844999ba835093dcdd1a808938b6d9a8 Reviewed-on: https://pdfium-review.googlesource.com/26434 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_document.h')
-rw-r--r--xfa/fxfa/parser/cxfa_document.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h
index 09c2601fa9..4d1c417c5b 100644
--- a/xfa/fxfa/parser/cxfa_document.h
+++ b/xfa/fxfa/parser/cxfa_document.h
@@ -9,11 +9,11 @@
#include <map>
#include <memory>
-#include <set>
#include <vector>
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
+#include "xfa/fxfa/parser/cxfa_nodeowner.h"
enum XFA_VERSION {
XFA_VERSION_UNKNOWN = 0,
@@ -57,10 +57,10 @@ class CXFA_LayoutProcessor;
class CXFA_Node;
class CXFA_Object;
-class CXFA_Document {
+class CXFA_Document : public CXFA_NodeOwner {
public:
explicit CXFA_Document(CXFA_DocumentParser* pParser);
- virtual ~CXFA_Document();
+ ~CXFA_Document() override;
virtual CXFA_FFNotify* GetNotify() const;
@@ -77,10 +77,7 @@ class CXFA_Document {
CXFA_LayoutProcessor* GetDocLayout();
CFXJSE_Engine* GetScriptContext();
- void SetRoot(CXFA_Node* pNewRoot);
-
- void AddPurgeNode(CXFA_Node* pNode);
- bool RemovePurgeNode(CXFA_Node* pNode);
+ void SetRoot(CXFA_Node* pNewRoot) { m_pRootNode = pNewRoot; }
bool HasFlag(uint32_t dwFlag) { return (m_dwDocFlags & dwFlag) == dwFlag; }
void SetFlag(uint32_t dwFlag, bool bOn);
@@ -119,7 +116,6 @@ class CXFA_Document {
std::unique_ptr<CScript_LogPseudoModel> m_pScriptLog;
std::unique_ptr<CScript_LayoutPseudoModel> m_pScriptLayout;
std::unique_ptr<CScript_SignaturePseudoModel> m_pScriptSignature;
- std::set<CXFA_Node*> m_PurgeNodes;
XFA_VERSION m_eCurVersionMode;
uint32_t m_dwDocFlags;
};