summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-14 19:50:23 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-14 19:50:23 -0800
commit37b12ad873198a9644f3de0d2eff001285e1ad42 (patch)
tree30471459df282284efdf363fa48f8e072ce629a2 /xfa
parentb8642f8a3c3a6d359c4e319b8ba91f8df6448a4f (diff)
downloadpdfium-37b12ad873198a9644f3de0d2eff001285e1ad42.tar.xz
Return unique_ptr from CXFA_FFApp::CreateDoc.
Remove one unused CreateDoc variant. Review-Url: https://codereview.chromium.org/2576893002
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/app/xfa_ffapp.cpp18
-rw-r--r--xfa/fxfa/xfa_ffapp.h6
2 files changed, 9 insertions, 15 deletions
diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp
index 273b9f5b36..219f06e4ff 100644
--- a/xfa/fxfa/app/xfa_ffapp.cpp
+++ b/xfa/fxfa/app/xfa_ffapp.cpp
@@ -102,21 +102,17 @@ CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() {
return m_pDocHandler.get();
}
-CXFA_FFDoc* CXFA_FFApp::CreateDoc(
+std::unique_ptr<CXFA_FFDoc> CXFA_FFApp::CreateDoc(
IXFA_DocEnvironment* pDocEnvironment,
- const CFX_RetainPtr<IFX_SeekableReadStream>& pStream) {
- auto pDoc = pdfium::MakeUnique<CXFA_FFDoc>(this, pDocEnvironment);
- return pDoc->OpenDoc(pStream) ? pDoc.release() : nullptr;
-}
-
-CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocEnvironment* pDocEnvironment,
- CPDF_Document* pPDFDoc) {
+ CPDF_Document* pPDFDoc) {
if (!pPDFDoc)
return nullptr;
- std::unique_ptr<CXFA_FFDoc> pDoc(new CXFA_FFDoc(this, pDocEnvironment));
- bool bSuccess = pDoc->OpenDoc(pPDFDoc);
- return bSuccess ? pDoc.release() : nullptr;
+ auto pDoc = pdfium::MakeUnique<CXFA_FFDoc>(this, pDocEnvironment);
+ if (!pDoc->OpenDoc(pPDFDoc))
+ return nullptr;
+
+ return pDoc;
}
void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
diff --git a/xfa/fxfa/xfa_ffapp.h b/xfa/fxfa/xfa_ffapp.h
index bc6e948ebf..411fd2d273 100644
--- a/xfa/fxfa/xfa_ffapp.h
+++ b/xfa/fxfa/xfa_ffapp.h
@@ -35,10 +35,8 @@ class CXFA_FFApp {
explicit CXFA_FFApp(IXFA_AppProvider* pProvider);
~CXFA_FFApp();
- CXFA_FFDoc* CreateDoc(IXFA_DocEnvironment* pDocEnvironment,
- const CFX_RetainPtr<IFX_SeekableReadStream>& pStream);
- CXFA_FFDoc* CreateDoc(IXFA_DocEnvironment* pDocEnvironment,
- CPDF_Document* pPDFDoc);
+ std::unique_ptr<CXFA_FFDoc> CreateDoc(IXFA_DocEnvironment* pDocEnvironment,
+ CPDF_Document* pPDFDoc);
void SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr);
CXFA_FFDocHandler* GetDocHandler();