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

Unified Diff: xfa/fxfa/parser/cxfa_scriptcontext.cpp

Issue 2612923002: Remove CFX_MapPtrToPtr from xfa/fxfa. (Closed)
Patch Set: endless loop Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/parser/cxfa_scriptcontext.h ('k') | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/cxfa_scriptcontext.cpp
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
index 60ee722c91eb6b8d92798aeb1d38dd557f24de93..b33d4efda4b1a733e1b092d719c5450e6aa6334f 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();
« no previous file with comments | « xfa/fxfa/parser/cxfa_scriptcontext.h ('k') | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698