Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1364)

Unified Diff: xfa/fxfa/app/xfa_ffapp.cpp

Issue 2576893002: Return unique_ptr from CXFA_FFApp::CreateDoc. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/fpdfxfa/cpdfxfa_context.cpp ('k') | xfa/fxfa/xfa_ffapp.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/app/xfa_ffapp.cpp
diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp
index 273b9f5b36c3ea0a16acc251e1e2f4b2281c27c8..219f06e4ff765c526a80ca5668ebbd1d45e24791 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) {
« no previous file with comments | « fpdfsdk/fpdfxfa/cpdfxfa_context.cpp ('k') | xfa/fxfa/xfa_ffapp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698