From f8a943908a414836271a1b7d7e4a97635d941b7f Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 14 Mar 2017 12:13:22 -0700 Subject: Replace CXFA_{Object,Node}Array with std::vector These two ought to happen at the same time as they are intertwined in spots. Remove blatant casts between the two along the way. Change-Id: I9ce5d2faadf1e38aba7cade316560d24a66d8669 Reviewed-on: https://pdfium-review.googlesource.com/2933 Commit-Queue: Tom Sepez Commit-Queue: dsinclair Reviewed-by: dsinclair --- xfa/fxfa/parser/xfa_resolvenode_rs.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'xfa/fxfa/parser/xfa_resolvenode_rs.h') diff --git a/xfa/fxfa/parser/xfa_resolvenode_rs.h b/xfa/fxfa/parser/xfa_resolvenode_rs.h index 7ad218efe8..a60ef9a3c6 100644 --- a/xfa/fxfa/parser/xfa_resolvenode_rs.h +++ b/xfa/fxfa/parser/xfa_resolvenode_rs.h @@ -8,8 +8,10 @@ #define XFA_FXFA_PARSER_XFA_RESOLVENODE_RS_H_ #include +#include #include "fxjs/cfxjse_value.h" +#include "third_party/base/ptr_util.h" #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/parser/cxfa_valuearray.h" @@ -45,10 +47,9 @@ struct XFA_RESOLVENODE_RS { int32_t GetAttributeResult(CXFA_ValueArray& valueArray) const { if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { - v8::Isolate* pIsolate = valueArray.m_pIsolate; - for (int32_t i = 0; i < nodes.GetSize(); i++) { - std::unique_ptr pValue(new CFXJSE_Value(pIsolate)); - (nodes[i]->*(pScriptAttribute->lpfnCallback))( + for (CXFA_Object* pObject : objects) { + auto pValue = pdfium::MakeUnique(valueArray.m_pIsolate); + (pObject->*(pScriptAttribute->lpfnCallback))( pValue.get(), false, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute); valueArray.Add(pValue.release()); } @@ -56,7 +57,7 @@ struct XFA_RESOLVENODE_RS { return valueArray.GetSize(); } - CXFA_ObjArray nodes; + std::vector objects; // Not owned. XFA_RESOVENODE_RSTYPE dwFlags; const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; }; @@ -64,7 +65,6 @@ struct XFA_RESOLVENODE_RS { inline XFA_RESOLVENODE_RS::XFA_RESOLVENODE_RS() : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(nullptr) {} -inline XFA_RESOLVENODE_RS::~XFA_RESOLVENODE_RS() { - nodes.RemoveAll(); -} +inline XFA_RESOLVENODE_RS::~XFA_RESOLVENODE_RS() {} + #endif // XFA_FXFA_PARSER_XFA_RESOLVENODE_RS_H_ -- cgit v1.2.3