summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa/include
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-08-03 11:06:49 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-03 11:06:49 -0700
commit2d5b020304e8a9aa8afeb632c61daa7ece87e36d (patch)
tree4d7f04d4800577fa597b4ca1f1b4d31b87194ef0 /fpdfsdk/fpdfxfa/include
parentca27127240fbca2184f1c576b15b5212d5b314e6 (diff)
downloadpdfium-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')
-rw-r--r--fpdfsdk/fpdfxfa/include/fpdfxfa_app.h5
-rw-r--r--fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h14
2 files changed, 9 insertions, 10 deletions
diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h
index 5ebb2c2623..18cac4405b 100644
--- a/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h
+++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h
@@ -21,7 +21,7 @@ class CPDFXFA_App : public IXFA_AppProvider {
~CPDFXFA_App() override;
FX_BOOL Initialize(v8::Isolate* pIsolate);
- CXFA_FFApp* GetXFAApp() { return m_pXFAApp; }
+ CXFA_FFApp* GetXFAApp() { return m_pXFAApp.get(); }
FX_BOOL AddFormFillEnv(CPDFDoc_Environment* pEnv);
FX_BOOL RemoveFormFillEnv(CPDFDoc_Environment* pEnv);
@@ -74,9 +74,8 @@ class CPDFXFA_App : public IXFA_AppProvider {
protected:
FX_BOOL m_bJavaScriptInitialized;
- CXFA_FFApp* m_pXFAApp;
+ std::unique_ptr<CXFA_FFApp> m_pXFAApp;
v8::Isolate* m_pIsolate;
- IFXJS_Runtime* m_pJSRuntime;
CFX_WideString m_csAppType;
};
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;