summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_node.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-02-15 18:12:29 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-15 18:12:29 +0000
commite40678ed8a22ecd57421877af39cf7f281f618c4 (patch)
tree50bbf114829ad3b4852b3739f65c6385091c4ba0 /xfa/fxfa/parser/cxfa_node.h
parent625e6fec9ddd1d023116f7bd22d2192ef9bc49c8 (diff)
downloadpdfium-e40678ed8a22ecd57421877af39cf7f281f618c4.tar.xz
Make the CFX_XMLNode a MaybeOwned pointer
This CL removes the HasOwnXML flag from the CXFA_Node objects and instead uses a MaybeOwned pointer to keep track of the XML nodes. Change-Id: Ie678258247ec21ecb15c639647b189e140586d25 Reviewed-on: https://pdfium-review.googlesource.com/26811 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_node.h')
-rw-r--r--xfa/fxfa/parser/cxfa_node.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 8193f59e05..85aca156d8 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -13,6 +13,8 @@
#include <vector>
#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/maybe_owned.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "core/fxge/fx_dib.h"
#include "fxbarcode/BC_Library.h"
#include "third_party/base/optional.h"
@@ -21,7 +23,6 @@
class CFGAS_GEFont;
class CFX_DIBitmap;
-class CFX_XMLNode;
class CXFA_Bind;
class CXFA_Border;
class CXFA_Calculate;
@@ -67,9 +68,8 @@ enum XFA_NodeFlag {
XFA_NodeFlag_NeedsInitApp = 1 << 2,
XFA_NodeFlag_BindFormItems = 1 << 3,
XFA_NodeFlag_UserInteractive = 1 << 4,
- XFA_NodeFlag_OwnXMLNode = 1 << 5,
- XFA_NodeFlag_UnusedNode = 1 << 6,
- XFA_NodeFlag_LayoutGeneratedNode = 1 << 7
+ XFA_NodeFlag_UnusedNode = 1 << 5,
+ XFA_NodeFlag_LayoutGeneratedNode = 1 << 6
};
class CXFA_Node : public CXFA_Object {
@@ -156,10 +156,19 @@ class CXFA_Node : public CXFA_Object {
bool IsFormContainer() const {
return m_ePacket == XFA_PacketType::Form && IsContainerNode();
}
- void SetXMLMappingNode(CFX_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; }
- CFX_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; }
+
+ void ReleaseXMLNodeIfUnowned();
+ void SetXMLMappingNode(MaybeOwned<CFX_XMLNode> node) {
+ xml_node_ = std::move(node);
+ }
+ void SetXMLMappingNode(std::unique_ptr<CFX_XMLNode> node) {
+ xml_node_.Reset(std::move(node));
+ }
+ void SetXMLMappingNode(CFX_XMLNode* node) { xml_node_.Reset(node); }
+ CFX_XMLNode* GetXMLMappingNode() const { return xml_node_.Get(); }
CFX_XMLNode* CreateXMLMappingNode();
bool IsNeedSavingXMLNode();
+
uint32_t GetNameHash() const { return m_dwNameHash; }
bool IsUnnamed() const { return m_dwNameHash == 0; }
CXFA_Node* GetModelNode();
@@ -502,7 +511,7 @@ class CXFA_Node : public CXFA_Object {
CXFA_Node* first_child_;
CXFA_Node* last_child_;
- CFX_XMLNode* m_pXMLNode;
+ MaybeOwned<CFX_XMLNode> xml_node_;
const XFA_PacketType m_ePacket;
uint8_t m_ExecuteRecursionDepth = 0;
uint16_t m_uNodeFlags;