summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_scriptcontext.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2017-01-05 12:18:41 -0800
committerCommit bot <commit-bot@chromium.org>2017-01-05 12:18:41 -0800
commit6bb3b894488fd6f38c096b708980a9f08286ac5c (patch)
tree2360efbf1aa5f2c452ca350382483d1c6b693f23 /xfa/fxfa/parser/cxfa_scriptcontext.cpp
parent48f776f7e801d719683b251dc21ee8c0e3250d90 (diff)
downloadpdfium-6bb3b894488fd6f38c096b708980a9f08286ac5c.tar.xz
Remove CFX_MapPtrToPtr from xfa/fxfa.
Review-Url: https://codereview.chromium.org/2612923002
Diffstat (limited to 'xfa/fxfa/parser/cxfa_scriptcontext.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
index 60ee722c91..b33d4efda4 100644
--- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp
+++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
@@ -125,17 +125,12 @@ CXFA_ScriptContext::CXFA_ScriptContext(CXFA_Document* pDocument)
m_eRunAtType(XFA_ATTRIBUTEENUM_Client) {}
CXFA_ScriptContext::~CXFA_ScriptContext() {
- FX_POSITION ps = m_mapVariableToContext.GetStartPosition();
- while (ps) {
- CXFA_Object* pScriptNode;
- CFXJSE_Context* pVariableContext = nullptr;
- m_mapVariableToContext.GetNextAssoc(ps, pScriptNode, pVariableContext);
-
+ for (const auto& pair : m_mapVariableToContext) {
+ CFXJSE_Context* pVariableContext = pair.second;
delete ToThisProxy(pVariableContext->GetGlobalObject().get(), nullptr);
delete pVariableContext;
}
- m_mapVariableToContext.RemoveAll();
-
+ m_mapVariableToContext.clear();
m_upObjectArray.RemoveAll();
}
@@ -461,7 +456,7 @@ CFXJSE_Context* CXFA_ScriptContext::CreateVariablesContext(
new CXFA_ThisProxy(pSubform, pScriptNode));
RemoveBuiltInObjs(pVariablesContext);
pVariablesContext->EnableCompatibleMode();
- m_mapVariableToContext.SetAt(pScriptNode, pVariablesContext);
+ m_mapVariableToContext[pScriptNode] = pVariablesContext;
return pVariablesContext;
}
CXFA_Object* CXFA_ScriptContext::GetVariablesThis(CXFA_Object* pObject,
@@ -484,7 +479,8 @@ bool CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) {
if (!pParent || pParent->GetElementType() != XFA_Element::Variables)
return false;
- if (m_mapVariableToContext.GetValueAt(pScriptNode))
+ auto it = m_mapVariableToContext.find(pScriptNode);
+ if (it != m_mapVariableToContext.end() && it->second)
return true;
CXFA_Node* pTextNode = pScriptNode->GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -521,10 +517,11 @@ bool CXFA_ScriptContext::QueryVariableValue(CXFA_Node* pScriptNode,
variablesNode->GetElementType() != XFA_Element::Variables)
return false;
- void* lpVariables = m_mapVariableToContext.GetValueAt(pScriptNode);
- if (!lpVariables)
+ auto it = m_mapVariableToContext.find(pScriptNode);
+ if (it == m_mapVariableToContext.end() || !it->second)
return false;
+ void* lpVariables = it->second;
bool bRes = false;
CFXJSE_Context* pVariableContext = static_cast<CFXJSE_Context*>(lpVariables);
std::unique_ptr<CFXJSE_Value> pObject = pVariableContext->GetGlobalObject();