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

Side by Side Diff: xfa/fxfa/parser/cxfa_xml_parser.cpp

Issue 2555373002: Use unique_ptr for CXFA_XMLParser. (Closed)
Patch Set: Alphabetize class 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 unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/cxfa_xml_parser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/parser/cxfa_xml_parser.h" 7 #include "xfa/fxfa/parser/cxfa_xml_parser.h"
8 8
9 CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pRoot, 9 CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pRoot,
10 const CFX_RetainPtr<IFGAS_Stream>& pStream) 10 const CFX_RetainPtr<IFGAS_Stream>& pStream)
(...skipping 11 matching lines...) Expand all
22 m_NodeStack.Push(m_pParent); 22 m_NodeStack.Push(m_pParent);
23 m_pParser->Init(m_pStream, 32 * 1024, 1024 * 1024); 23 m_pParser->Init(m_pStream, 32 * 1024, 1024 * 1024);
24 } 24 }
25 25
26 CXFA_XMLParser::~CXFA_XMLParser() { 26 CXFA_XMLParser::~CXFA_XMLParser() {
27 m_NodeStack.RemoveAll(false); 27 m_NodeStack.RemoveAll(false);
28 m_ws1.clear(); 28 m_ws1.clear();
29 m_ws2.clear(); 29 m_ws2.clear();
30 } 30 }
31 31
32 void CXFA_XMLParser::Release() {
33 delete this;
34 }
35
36 int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) { 32 int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) {
37 if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error) 33 if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error)
38 return -1; 34 return -1;
39 if (m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString) 35 if (m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString)
40 return 100; 36 return 100;
41 37
42 int32_t iCount = 0; 38 int32_t iCount = 0;
43 while (true) { 39 while (true) {
44 m_syntaxParserResult = m_pParser->DoSyntaxParse(); 40 m_syntaxParserResult = m_pParser->DoSyntaxParse();
45 switch (m_syntaxParserResult) { 41 switch (m_syntaxParserResult) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 164 }
169 if (pPause && iCount > 500 && pPause->NeedToPauseNow()) { 165 if (pPause && iCount > 500 && pPause->NeedToPauseNow()) {
170 break; 166 break;
171 } 167 }
172 } 168 }
173 return (m_syntaxParserResult == FDE_XmlSyntaxResult::Error || 169 return (m_syntaxParserResult == FDE_XmlSyntaxResult::Error ||
174 m_NodeStack.GetSize() != 1) 170 m_NodeStack.GetSize() != 1)
175 ? -1 171 ? -1
176 : m_pParser->GetStatus(); 172 : m_pParser->GetStatus();
177 } 173 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/cxfa_xml_parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698