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

Side by Side Diff: xfa/fxfa/app/xfa_ffapp.cpp

Issue 2095653002: Remove NULL in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 5 months 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 unified diff | Download patch
« no previous file with comments | « xfa/fxfa/app/xfa_checksum.cpp ('k') | xfa/fxfa/app/xfa_ffbarcode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/include/xfa_ffapp.h" 7 #include "xfa/fxfa/include/xfa_ffapp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 delete m_pFontMgr; 102 delete m_pFontMgr;
103 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 103 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
104 if (m_pFontSource) 104 if (m_pFontSource)
105 m_pFontSource->Release(); 105 m_pFontSource->Release();
106 #endif 106 #endif
107 if (m_pFDEFontMgr) 107 if (m_pFDEFontMgr)
108 m_pFDEFontMgr->Release(); 108 m_pFDEFontMgr->Release();
109 } 109 }
110 110
111 CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { 111 CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() {
112 if (!m_pDocHandler) { 112 if (!m_pDocHandler)
113 m_pDocHandler = new CXFA_FFDocHandler; 113 m_pDocHandler = new CXFA_FFDocHandler;
114 }
115 return m_pDocHandler; 114 return m_pDocHandler;
116 } 115 }
117 CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, 116 CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider,
118 IFX_FileRead* pStream, 117 IFX_FileRead* pStream,
119 FX_BOOL bTakeOverFile) { 118 FX_BOOL bTakeOverFile) {
120 CXFA_FFDoc* pDoc = new CXFA_FFDoc(this, pProvider); 119 std::unique_ptr<CXFA_FFDoc> pDoc(new CXFA_FFDoc(this, pProvider));
121 FX_BOOL bSuccess = pDoc->OpenDoc(pStream, bTakeOverFile); 120 FX_BOOL bSuccess = pDoc->OpenDoc(pStream, bTakeOverFile);
122 if (!bSuccess) { 121 return bSuccess ? pDoc.release() : nullptr;
123 delete pDoc;
124 pDoc = NULL;
125 }
126 return pDoc;
127 } 122 }
123
128 CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, 124 CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider,
129 CPDF_Document* pPDFDoc) { 125 CPDF_Document* pPDFDoc) {
130 if (pPDFDoc == NULL) { 126 if (!pPDFDoc)
131 return NULL; 127 return nullptr;
132 } 128
133 CXFA_FFDoc* pDoc = new CXFA_FFDoc(this, pProvider); 129 std::unique_ptr<CXFA_FFDoc> pDoc(new CXFA_FFDoc(this, pProvider));
134 FX_BOOL bSuccess = pDoc->OpenDoc(pPDFDoc); 130 FX_BOOL bSuccess = pDoc->OpenDoc(pPDFDoc);
135 if (!bSuccess) { 131 return bSuccess ? pDoc.release() : nullptr;
136 delete pDoc;
137 pDoc = NULL;
138 }
139 return pDoc;
140 } 132 }
141 133
142 void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) { 134 void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
143 if (!m_pFontMgr) 135 if (!m_pFontMgr)
144 m_pFontMgr = new CXFA_FontMgr(); 136 m_pFontMgr = new CXFA_FontMgr();
145 m_pFontMgr->SetDefFontMgr(std::move(pFontMgr)); 137 m_pFontMgr->SetDefFontMgr(std::move(pFontMgr));
146 } 138 }
147 139
148 CXFA_FontMgr* CXFA_FFApp::GetXFAFontMgr() { 140 CXFA_FontMgr* CXFA_FFApp::GetXFAFontMgr() {
149 return m_pFontMgr; 141 return m_pFontMgr;
(...skipping 22 matching lines...) Expand all
172 m_pAdapterWidgetMgr = new CXFA_FWLAdapterWidgetMgr; 164 m_pAdapterWidgetMgr = new CXFA_FWLAdapterWidgetMgr;
173 pDelegate->OnSetCapability(FWL_WGTMGR_DisableThread | 165 pDelegate->OnSetCapability(FWL_WGTMGR_DisableThread |
174 FWL_WGTMGR_DisableForm); 166 FWL_WGTMGR_DisableForm);
175 m_pWidgetMgrDelegate = pDelegate; 167 m_pWidgetMgrDelegate = pDelegate;
176 } 168 }
177 return m_pAdapterWidgetMgr; 169 return m_pAdapterWidgetMgr;
178 } 170 }
179 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() { 171 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() {
180 return m_pProvider->GetTimerMgr(); 172 return m_pProvider->GetTimerMgr();
181 } 173 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_checksum.cpp ('k') | xfa/fxfa/app/xfa_ffbarcode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698