From bc7e310b027809562eb589bfef72737c193ee27a Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 3 Jul 2018 17:17:54 +0000 Subject: Use UnownedPtr<> in cxfa_{ffwidgethandler,imagrenderer,loadercontext}.h Change-Id: I25496c9792a99ca27d2ab84c267770ff941cf921 Reviewed-on: https://pdfium-review.googlesource.com/36912 Reviewed-by: dsinclair Commit-Queue: dsinclair --- xfa/fxfa/cxfa_ffwidgethandler.cpp | 11 +++++------ xfa/fxfa/cxfa_ffwidgethandler.h | 3 ++- xfa/fxfa/cxfa_imagerenderer.cpp | 3 ++- xfa/fxfa/cxfa_imagerenderer.h | 3 ++- xfa/fxfa/cxfa_loadercontext.h | 2 +- xfa/fxfa/cxfa_textlayout.cpp | 4 ++-- 6 files changed, 14 insertions(+), 12 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp index a820db8083..eb9a4ca63a 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.cpp +++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp @@ -234,11 +234,11 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_Node* pNode, switch (pParam->m_eType) { case XFA_EVENT_Calculate: - return pNode->ProcessCalculate(m_pDocView); + return pNode->ProcessCalculate(m_pDocView.Get()); case XFA_EVENT_Validate: if (m_pDocView->GetDoc()->GetDocEnvironment()->IsValidationsEnabled( m_pDocView->GetDoc())) { - return pNode->ProcessValidate(m_pDocView, 0); + return pNode->ProcessValidate(m_pDocView.Get(), 0); } return XFA_EVENTERROR_Disabled; case XFA_EVENT_InitCalculate: { @@ -247,15 +247,14 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_Node* pNode, return XFA_EVENTERROR_NotExist; if (pNode->IsUserInteractive()) return XFA_EVENTERROR_Disabled; - return pNode->ExecuteScript(m_pDocView, calc->GetScriptIfExists(), + return pNode->ExecuteScript(m_pDocView.Get(), calc->GetScriptIfExists(), pParam); } default: break; } - int32_t iRet = pNode->ProcessEvent(m_pDocView, - gs_EventActivity[pParam->m_eType], pParam); - return iRet; + return pNode->ProcessEvent(m_pDocView.Get(), + gs_EventActivity[pParam->m_eType], pParam); } CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent, diff --git a/xfa/fxfa/cxfa_ffwidgethandler.h b/xfa/fxfa/cxfa_ffwidgethandler.h index 975f3607e4..f2b6ae0d1c 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.h +++ b/xfa/fxfa/cxfa_ffwidgethandler.h @@ -9,6 +9,7 @@ #include +#include "core/fxcrt/unowned_ptr.h" #include "xfa/fxfa/cxfa_eventparam.h" #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/parser/cxfa_document.h" @@ -123,7 +124,7 @@ class CXFA_FFWidgetHandler { CXFA_Document* GetObjFactory() const; CXFA_Document* GetXFADoc() const; - CXFA_FFDocView* m_pDocView; + UnownedPtr m_pDocView; }; #endif // XFA_FXFA_CXFA_FFWIDGETHANDLER_H_ diff --git a/xfa/fxfa/cxfa_imagerenderer.cpp b/xfa/fxfa/cxfa_imagerenderer.cpp index f6cb5e9317..f90ea64a93 100644 --- a/xfa/fxfa/cxfa_imagerenderer.cpp +++ b/xfa/fxfa/cxfa_imagerenderer.cpp @@ -149,7 +149,8 @@ void CXFA_ImageRenderer::CompositeDIBitmap( if (!pCloneConvert) return; - CXFA_ImageRenderer imageRender(m_pDevice, pCloneConvert, &m_ImageMatrix); + CXFA_ImageRenderer imageRender(m_pDevice.Get(), pCloneConvert, + &m_ImageMatrix); if (!imageRender.Start()) return; diff --git a/xfa/fxfa/cxfa_imagerenderer.h b/xfa/fxfa/cxfa_imagerenderer.h index 8ed9ab0c75..236c3ccc5a 100644 --- a/xfa/fxfa/cxfa_imagerenderer.h +++ b/xfa/fxfa/cxfa_imagerenderer.h @@ -11,6 +11,7 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/retain_ptr.h" +#include "core/fxcrt/unowned_ptr.h" #include "core/fxge/fx_dib.h" class CFX_RenderDevice; @@ -34,7 +35,7 @@ class CXFA_ImageRenderer { int left, int top); - CFX_RenderDevice* m_pDevice; + UnownedPtr m_pDevice; int m_Status = 0; CFX_Matrix m_ImageMatrix; RetainPtr m_pDIBSource; diff --git a/xfa/fxfa/cxfa_loadercontext.h b/xfa/fxfa/cxfa_loadercontext.h index 36ec95b7f3..ff7c6032a8 100644 --- a/xfa/fxfa/cxfa_loadercontext.h +++ b/xfa/fxfa/cxfa_loadercontext.h @@ -30,7 +30,7 @@ class CXFA_LoaderContext { int32_t m_iLines; int32_t m_iTotalLines; uint32_t m_dwFlags; - CFX_XMLNode* m_pXMLNode; + UnownedPtr m_pXMLNode; UnownedPtr m_pNode; RetainPtr m_pParentStyle; std::vector m_lineHeights; diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp index eb7fab383a..32a1b393a6 100644 --- a/xfa/fxfa/cxfa_textlayout.cpp +++ b/xfa/fxfa/cxfa_textlayout.cpp @@ -459,11 +459,11 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) { if (!pContainerNode) return true; - CFX_XMLNode* pXMLNode = m_pLoader->m_pXMLNode; + CFX_XMLNode* pXMLNode = m_pLoader->m_pXMLNode.Get(); if (!pXMLNode) return true; - CFX_XMLNode* pSaveXMLNode = m_pLoader->m_pXMLNode; + CFX_XMLNode* pSaveXMLNode = pXMLNode; for (; pXMLNode; pXMLNode = pXMLNode->GetNextSibling()) { if (!LoadRichText(pXMLNode, szText.width, &fLinePos, m_pLoader->m_pParentStyle, true, nullptr)) { -- cgit v1.2.3