diff options
author | weili <weili@chromium.org> | 2016-08-03 11:06:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-03 11:06:49 -0700 |
commit | 2d5b020304e8a9aa8afeb632c61daa7ece87e36d (patch) | |
tree | 4d7f04d4800577fa597b4ca1f1b4d31b87194ef0 /fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h | |
parent | ca27127240fbca2184f1c576b15b5212d5b314e6 (diff) | |
download | pdfium-2d5b020304e8a9aa8afeb632c61daa7ece87e36d.tar.xz |
Use smart pointers for class owned pointers
For all classes under /fpdfsdk, use smart pointer to replace
raw pointer type for class owned member variables so that memory
management will be easier.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2173253002
Diffstat (limited to 'fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h')
-rw-r--r-- | fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h index 21a5b13cfa..ed4c8727fc 100644 --- a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h +++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h @@ -9,6 +9,7 @@ #include "xfa/fxfa/include/xfa_ffdoc.h" +#include <memory> #include <vector> #include "public/fpdfview.h" @@ -32,7 +33,7 @@ class CPDFXFA_Document : public IXFA_DocProvider { FX_BOOL LoadXFADoc(); CPDFXFA_App* GetApp() { return m_pApp; } CPDF_Document* GetPDFDoc() { return m_pPDFDoc; } - CXFA_FFDoc* GetXFADoc() { return m_pXFADoc; } + CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); } CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } int GetPageCount(); @@ -193,18 +194,17 @@ class CPDFXFA_Document : public IXFA_DocProvider { void CloseXFADoc(CXFA_FFDocHandler* pDoc) { if (pDoc) { m_pXFADoc->CloseDoc(); - delete m_pXFADoc; - m_pXFADoc = nullptr; + m_pXFADoc.reset(); m_pXFADocView = nullptr; } } int m_iDocType; CPDF_Document* m_pPDFDoc; - CPDFSDK_Document* m_pSDKDoc; - CXFA_FFDoc* m_pXFADoc; - CXFA_FFDocView* m_pXFADocView; - CPDFXFA_App* m_pApp; + std::unique_ptr<CPDFSDK_Document> m_pSDKDoc; + std::unique_ptr<CXFA_FFDoc> m_pXFADoc; + CXFA_FFDocView* m_pXFADocView; // not owned. + CPDFXFA_App* const m_pApp; IJS_Context* m_pJSContext; CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList; LoadStatus m_nLoadStatus; |