diff options
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cscript_layoutpseudomodel.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_dataexporter.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_dataexporter.h | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_dataimporter.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_dataimporter.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_layoutprocessor.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_layoutprocessor.h | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_nodelocale.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_object.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_scriptcontext.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_scriptcontext.h | 4 |
12 files changed, 28 insertions, 17 deletions
diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index 693d4029a3..6e6a1086ff 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -368,7 +368,8 @@ void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) { if (!pDocLayout) return; - auto pArrayNodeList = pdfium::MakeUnique<CXFA_ArrayNodeList>(m_pDocument); + auto pArrayNodeList = + pdfium::MakeUnique<CXFA_ArrayNodeList>(m_pDocument.Get()); pArrayNodeList->SetArrayNodeList( GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea)); pArguments->GetReturnValue()->SetObject( diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index dda93a36fc..49a1f5857b 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -458,6 +458,8 @@ CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument) ASSERT(m_pDocument); } +CXFA_DataExporter::~CXFA_DataExporter() {} + bool CXFA_DataExporter::Export( const CFX_RetainPtr<IFX_SeekableStream>& pWrite) { return Export(pWrite, m_pDocument->GetRoot(), 0, nullptr); diff --git a/xfa/fxfa/parser/cxfa_dataexporter.h b/xfa/fxfa/parser/cxfa_dataexporter.h index cd949be964..4c0d90af9e 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.h +++ b/xfa/fxfa/parser/cxfa_dataexporter.h @@ -18,6 +18,7 @@ class CFX_SeekableStreamProxy; class CXFA_DataExporter { public: explicit CXFA_DataExporter(CXFA_Document* pDocument); + ~CXFA_DataExporter(); bool Export(const CFX_RetainPtr<IFX_SeekableStream>& pWrite); bool Export(const CFX_RetainPtr<IFX_SeekableStream>& pWrite, @@ -31,7 +32,7 @@ class CXFA_DataExporter { uint32_t dwFlag, const char* pChecksum); - CXFA_Document* const m_pDocument; + CFX_UnownedPtr<CXFA_Document> const m_pDocument; }; #endif // XFA_FXFA_PARSER_CXFA_DATAEXPORTER_H_ diff --git a/xfa/fxfa/parser/cxfa_dataimporter.cpp b/xfa/fxfa/parser/cxfa_dataimporter.cpp index d83b92b08d..e4ae3d0796 100644 --- a/xfa/fxfa/parser/cxfa_dataimporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataimporter.cpp @@ -22,10 +22,12 @@ CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument) ASSERT(m_pDocument); } +CXFA_DataImporter::~CXFA_DataImporter() {} + bool CXFA_DataImporter::ImportData( const CFX_RetainPtr<IFX_SeekableStream>& pDataDocument) { auto pDataDocumentParser = - pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument, false); + pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument.Get(), false); if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) != XFA_PARSESTATUS_Ready) { return false; diff --git a/xfa/fxfa/parser/cxfa_dataimporter.h b/xfa/fxfa/parser/cxfa_dataimporter.h index e76475cd1e..d3af1de517 100644 --- a/xfa/fxfa/parser/cxfa_dataimporter.h +++ b/xfa/fxfa/parser/cxfa_dataimporter.h @@ -8,6 +8,7 @@ #define XFA_FXFA_PARSER_CXFA_DATAIMPORTER_H_ #include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_system.h" class CXFA_Document; @@ -16,11 +17,12 @@ class IFX_SeekableStream; class CXFA_DataImporter { public: explicit CXFA_DataImporter(CXFA_Document* pDocument); + ~CXFA_DataImporter(); bool ImportData(const CFX_RetainPtr<IFX_SeekableStream>& pDataDocument); private: - CXFA_Document* const m_pDocument; + CFX_UnownedPtr<CXFA_Document> const m_pDocument; }; #endif // XFA_FXFA_PARSER_CXFA_DATAIMPORTER_H_ diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp index 0fbae9e368..765f8b2fe7 100644 --- a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp @@ -24,7 +24,7 @@ CXFA_LayoutProcessor::CXFA_LayoutProcessor(CXFA_Document* pDocument) CXFA_LayoutProcessor::~CXFA_LayoutProcessor() {} CXFA_Document* CXFA_LayoutProcessor::GetDocument() const { - return m_pDocument; + return m_pDocument.Get(); } int32_t CXFA_LayoutProcessor::StartLayout(bool bForceRestart) { diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.h b/xfa/fxfa/parser/cxfa_layoutprocessor.h index 5a48560f26..360a9df685 100644 --- a/xfa/fxfa/parser/cxfa_layoutprocessor.h +++ b/xfa/fxfa/parser/cxfa_layoutprocessor.h @@ -10,6 +10,7 @@ #include <memory> #include <vector> +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_system.h" class CXFA_ContainerLayoutItem; @@ -44,7 +45,7 @@ class CXFA_LayoutProcessor { private: bool IsNeedLayout(); - CXFA_Document* const m_pDocument; + CFX_UnownedPtr<CXFA_Document> const m_pDocument; std::unique_ptr<CXFA_ItemLayoutProcessor> m_pRootItemLayoutProcessor; std::unique_ptr<CXFA_LayoutPageMgr> m_pLayoutPageMgr; std::vector<CXFA_Node*> m_rgChangedContainers; diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index e7ec4cf890..2daa49e066 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -1040,7 +1040,7 @@ void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue, refNode = this; pScriptContext->ResolveObjects(refNode, wsExpression.AsStringC(), resoveNodeRS, dwFlag); - CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument); + CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument.Get()); if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { for (CXFA_Object* pObject : resoveNodeRS.objects) { if (pObject->IsNode()) @@ -1083,7 +1083,8 @@ void CXFA_Node::Script_TreeClass_Nodes(CFXJSE_Value* pValue, CFX_WideString wsMessage = L"Unable to set "; FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringC()); } else { - CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this); + CXFA_AttachNodeList* pNodeList = + new CXFA_AttachNodeList(m_pDocument.Get(), this); pValue->SetObject(pNodeList, pScriptContext->GetJseNormalClass()); } } @@ -1282,7 +1283,8 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { bIgnoreRoot = !!pArguments->GetInt32(1); if (iLength >= 3) bOverwrite = !!pArguments->GetInt32(2); - auto pParser = pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument, false); + auto pParser = + pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument.Get(), false); if (!pParser) return; CFX_XMLNode* pXMLNode = pParser->ParseXMLData(wsExpression); @@ -1524,7 +1526,7 @@ void CXFA_Node::Script_NodeClass_OneOfChild(CFXJSE_Value* pValue, void CXFA_Node::Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments) {} void CXFA_Node::Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments) { - CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument); + CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument.Get()); pArguments->GetReturnValue()->SetObject( pFormNodes, m_pDocument->GetScriptContext()->GetJseNormalClass()); } @@ -3269,7 +3271,7 @@ void CXFA_Node::Script_Form_FormNodes(CFXJSE_Arguments* pArguments) { } std::vector<CXFA_Node*> formItems; - CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument); + CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument.Get()); pFormNodes->SetArrayNodeList(formItems); pArguments->GetReturnValue()->SetObject( pFormNodes, m_pDocument->GetScriptContext()->GetJseNormalClass()); diff --git a/xfa/fxfa/parser/cxfa_nodelocale.h b/xfa/fxfa/parser/cxfa_nodelocale.h index 2465650b47..e051bb6ac3 100644 --- a/xfa/fxfa/parser/cxfa_nodelocale.h +++ b/xfa/fxfa/parser/cxfa_nodelocale.h @@ -47,7 +47,7 @@ class CXFA_NodeLocale : public IFX_Locale { int index, bool bAbbr) const; - CXFA_Node* const m_pLocale; + CFX_UnownedPtr<CXFA_Node> const m_pLocale; }; #endif // XFA_FXFA_PARSER_CXFA_NODELOCALE_H_ diff --git a/xfa/fxfa/parser/cxfa_object.h b/xfa/fxfa/parser/cxfa_object.h index 9596453712..4f1850f14c 100644 --- a/xfa/fxfa/parser/cxfa_object.h +++ b/xfa/fxfa/parser/cxfa_object.h @@ -38,7 +38,7 @@ class CXFA_Object : public CFXJSE_HostObject { const CFX_WideStringC& elementName); ~CXFA_Object() override; - CXFA_Document* GetDocument() const { return m_pDocument; } + CXFA_Document* GetDocument() const { return m_pDocument.Get(); } XFA_ObjectType GetObjectType() const { return m_objectType; } bool IsNode() const { @@ -86,7 +86,7 @@ class CXFA_Object : public CFXJSE_HostObject { protected: void ThrowException(const wchar_t* str, ...) const; - CXFA_Document* const m_pDocument; + CFX_UnownedPtr<CXFA_Document> const m_pDocument; const XFA_ObjectType m_objectType; const XFA_Element m_elementType; diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index cf6467e240..49da63eee3 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -150,7 +150,7 @@ bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) { if (!m_FM2JSContext) { m_FM2JSContext = pdfium::MakeUnique<CXFA_FM2JSContext>( - m_pIsolate, m_JsContext.get(), m_pDocument); + m_pIsolate, m_JsContext.get(), m_pDocument.Get()); } CFX_WideTextBuf wsJavaScript; if (!CXFA_FM2JSContext::Translate(wsScript, &wsJavaScript)) { diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.h b/xfa/fxfa/parser/cxfa_scriptcontext.h index d3a9609769..45e6897a4c 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.h +++ b/xfa/fxfa/parser/cxfa_scriptcontext.h @@ -92,7 +92,7 @@ class CXFA_ScriptContext { bool IsStrictScopeInJavaScript(); XFA_SCRIPTLANGTYPE GetType(); std::vector<CXFA_Node*>* GetUpObjectArray() { return &m_upObjectArray; } - CXFA_Document* GetDocument() const { return m_pDocument; } + CXFA_Document* GetDocument() const { return m_pDocument.Get(); } static CXFA_Object* ToObject(CFXJSE_Value* pValue, CFXJSE_Class* pClass); @@ -103,7 +103,7 @@ class CXFA_ScriptContext { void DefineJsClass(); void RemoveBuiltInObjs(CFXJSE_Context* pContext) const; - CXFA_Document* const m_pDocument; + CFX_UnownedPtr<CXFA_Document> const m_pDocument; std::unique_ptr<CFXJSE_Context> m_JsContext; v8::Isolate* m_pIsolate; CFXJSE_Class* m_pJsClass; |