summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-25 12:03:18 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-25 19:16:31 +0000
commit797ca5cad52edde7c65da45a15216f20b1bfd8fd (patch)
tree811a96d5f505e7cff89395cea7dff89604fc9133 /xfa/fxfa/parser
parent3a4c408554f2f2ffb5a143f6dadcdd528fcf106e (diff)
downloadpdfium-797ca5cad52edde7c65da45a15216f20b1bfd8fd.tar.xz
Mass conversion of all const-lifetime class members
Sed + minimal conversions to compile, including moving some constructors into the .cpp file. Any that caused ASAN issues during the tests were omitted rather than trying to resolve the underlying issue. Change-Id: I00a421f33b253eb4071ffd9af3f2922c7443b335 Reviewed-on: https://pdfium-review.googlesource.com/5891 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cscript_layoutpseudomodel.cpp3
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.h3
-rw-r--r--xfa/fxfa/parser/cxfa_dataimporter.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_dataimporter.h4
-rw-r--r--xfa/fxfa/parser/cxfa_layoutprocessor.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_layoutprocessor.h3
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp12
-rw-r--r--xfa/fxfa/parser/cxfa_nodelocale.h2
-rw-r--r--xfa/fxfa/parser/cxfa_object.h4
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.h4
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;