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

Side by Side Diff: xfa/fxfa/fm2js/xfa_expression.h

Issue 2528543003: More unique_ptrs in CXFA_FMParse::ParseForeachExpression and avoid leaks (Closed)
Patch Set: Not so much unique_ptr 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 | « no previous file | xfa/fxfa/fm2js/xfa_expression.cpp » ('j') | xfa/fxfa/fm2js/xfa_expression.cpp » ('J')
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 #ifndef XFA_FXFA_FM2JS_XFA_EXPRESSION_H_ 7 #ifndef XFA_FXFA_FM2JS_XFA_EXPRESSION_H_
8 #define XFA_FXFA_FM2JS_XFA_EXPRESSION_H_ 8 #define XFA_FXFA_FM2JS_XFA_EXPRESSION_H_
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector>
11 12
12 #include "xfa/fxfa/fm2js/xfa_simpleexpression.h" 13 #include "xfa/fxfa/fm2js/xfa_simpleexpression.h"
13 14
14 enum XFA_FM_EXPTYPE { 15 enum XFA_FM_EXPTYPE {
15 XFA_FM_EXPTYPE_UNKNOWN, 16 XFA_FM_EXPTYPE_UNKNOWN,
16 XFA_FM_EXPTYPE_FUNC, 17 XFA_FM_EXPTYPE_FUNC,
17 XFA_FM_EXPTYPE_VAR, 18 XFA_FM_EXPTYPE_VAR,
18 XFA_FM_EXPTYPE_EXP, 19 XFA_FM_EXPTYPE_EXP,
19 XFA_FM_EXPTYPE_BLOCK, 20 XFA_FM_EXPTYPE_BLOCK,
20 XFA_FM_EXPTYPE_IF, 21 XFA_FM_EXPTYPE_IF,
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 std::unique_ptr<CXFA_FMSimpleExpression> m_pStep; 191 std::unique_ptr<CXFA_FMSimpleExpression> m_pStep;
191 std::unique_ptr<CXFA_FMExpression> m_pList; 192 std::unique_ptr<CXFA_FMExpression> m_pList;
192 }; 193 };
193 194
194 class CXFA_FMForeachExpression : public CXFA_FMLoopExpression { 195 class CXFA_FMForeachExpression : public CXFA_FMLoopExpression {
195 public: 196 public:
196 // Takes ownership of |pAccessors|. 197 // Takes ownership of |pAccessors|.
197 CXFA_FMForeachExpression( 198 CXFA_FMForeachExpression(
198 uint32_t line, 199 uint32_t line,
199 const CFX_WideStringC& wsIdentifier, 200 const CFX_WideStringC& wsIdentifier,
200 CFX_ArrayTemplate<CXFA_FMSimpleExpression*>* pAccessors, 201 std::vector<std::unique_ptr<CXFA_FMSimpleExpression>>&& pAccessors,
201 CXFA_FMExpression* pList); 202 CXFA_FMExpression* pList);
202 ~CXFA_FMForeachExpression() override; 203 ~CXFA_FMForeachExpression() override;
203 204
204 void ToJavaScript(CFX_WideTextBuf& javascript) override; 205 void ToJavaScript(CFX_WideTextBuf& javascript) override;
205 void ToImpliedReturnJS(CFX_WideTextBuf&) override; 206 void ToImpliedReturnJS(CFX_WideTextBuf&) override;
206 207
207 private: 208 private:
208 CFX_WideStringC m_wsIdentifier; 209 CFX_WideStringC m_wsIdentifier;
209 CFX_ArrayTemplate<CXFA_FMSimpleExpression*>* m_pAccessors; 210 std::vector<std::unique_ptr<CXFA_FMSimpleExpression>> m_pAccessors;
210 std::unique_ptr<CXFA_FMExpression> m_pList; 211 std::unique_ptr<CXFA_FMExpression> m_pList;
211 }; 212 };
212 213
213 #endif // XFA_FXFA_FM2JS_XFA_EXPRESSION_H_ 214 #endif // XFA_FXFA_FM2JS_XFA_EXPRESSION_H_
OLDNEW
« no previous file with comments | « no previous file | xfa/fxfa/fm2js/xfa_expression.cpp » ('j') | xfa/fxfa/fm2js/xfa_expression.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698