From ec3da5b821ed65c53eff1c78c2493afd7d933371 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 25 May 2016 16:42:05 -0700 Subject: Rename FXJSE_HRUNTIME to v8::Isolate This CL renames all of the instances of FXJSE_HRUNTIME to be v8::Isolate* and updates the various varible names to match the new type. Review-Url: https://codereview.chromium.org/2010833002 --- xfa/fxfa/parser/xfa_document.h | 2 +- xfa/fxfa/parser/xfa_document_imp.cpp | 4 ++-- xfa/fxfa/parser/xfa_script.h | 8 ++++---- xfa/fxfa/parser/xfa_script_imp.cpp | 22 +++++++++++----------- xfa/fxfa/parser/xfa_script_imp.h | 6 +++--- 5 files changed, 21 insertions(+), 21 deletions(-) (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/xfa_document.h b/xfa/fxfa/parser/xfa_document.h index 5279d3a995..2890a6677c 100644 --- a/xfa/fxfa/parser/xfa_document.h +++ b/xfa/fxfa/parser/xfa_document.h @@ -91,7 +91,7 @@ class CXFA_Document { CXFA_Node* GetNotBindNode(CXFA_ObjArray& arrayNodes); CXFA_LayoutProcessor* GetLayoutProcessor(); CXFA_LayoutProcessor* GetDocLayout(); - CXFA_ScriptContext* InitScriptContext(FXJSE_HRUNTIME hRuntime); + CXFA_ScriptContext* InitScriptContext(v8::Isolate* pIsolate); CXFA_ScriptContext* GetScriptContext(); void ClearLayoutData(); diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp index 4d13f16f0e..e7b6a128d9 100644 --- a/xfa/fxfa/parser/xfa_document_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_imp.cpp @@ -230,10 +230,10 @@ CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() { } return m_pLocalMgr; } -CXFA_ScriptContext* CXFA_Document::InitScriptContext(FXJSE_HRUNTIME hRuntime) { +CXFA_ScriptContext* CXFA_Document::InitScriptContext(v8::Isolate* pIsolate) { if (!m_pScriptContext) m_pScriptContext = new CXFA_ScriptContext(this); - m_pScriptContext->Initialize(hRuntime); + m_pScriptContext->Initialize(pIsolate); return m_pScriptContext; } CXFA_ScriptContext* CXFA_Document::GetScriptContext() { diff --git a/xfa/fxfa/parser/xfa_script.h b/xfa/fxfa/parser/xfa_script.h index 971fe06b56..04cc5b9a69 100644 --- a/xfa/fxfa/parser/xfa_script.h +++ b/xfa/fxfa/parser/xfa_script.h @@ -37,7 +37,7 @@ enum XFA_RESOVENODE_RSTYPE { class CXFA_HVALUEArray : public CFX_ArrayTemplate { public: - CXFA_HVALUEArray(FXJSE_HRUNTIME hRunTime) : m_hRunTime(hRunTime) {} + CXFA_HVALUEArray(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} ~CXFA_HVALUEArray() { for (int32_t i = 0; i < GetSize(); i++) { FXJSE_Value_Release(GetAt(i)); @@ -49,7 +49,7 @@ class CXFA_HVALUEArray : public CFX_ArrayTemplate { objArray.Add(pObject); } } - FXJSE_HRUNTIME m_hRunTime; + v8::Isolate* m_pIsolate; }; struct XFA_RESOLVENODE_RS { @@ -58,9 +58,9 @@ struct XFA_RESOLVENODE_RS { ~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); } int32_t GetAttributeResult(CXFA_HVALUEArray& hValueArray) const { if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { - FXJSE_HRUNTIME hRunTime = hValueArray.m_hRunTime; + v8::Isolate* pIsolate = hValueArray.m_pIsolate; for (int32_t i = 0; i < nodes.GetSize(); i++) { - FXJSE_HVALUE hValue = FXJSE_Value_Create(hRunTime); + FXJSE_HVALUE hValue = FXJSE_Value_Create(pIsolate); (nodes[i]->*(pScriptAttribute->lpfnCallback))( hValue, FALSE, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute); hValueArray.Add(hValue); diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index 7bd6aaa40c..50810305e4 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -23,7 +23,7 @@ CXFA_ScriptContext::CXFA_ScriptContext(CXFA_Document* pDocument) : m_pDocument(pDocument), m_hJsContext(nullptr), - m_hJsRuntime(nullptr), + m_pIsolate(nullptr), m_hJsClass(nullptr), m_eScriptType(XFA_SCRIPTLANGTYPE_Unkown), m_pScriptNodeArray(nullptr), @@ -58,8 +58,8 @@ CXFA_ScriptContext::~CXFA_ScriptContext() { for (int32_t i = 0; i < m_CacheListArray.GetSize(); i++) delete m_CacheListArray[i]; } -void CXFA_ScriptContext::Initialize(FXJSE_HRUNTIME hRuntime) { - m_hJsRuntime = hRuntime; +void CXFA_ScriptContext::Initialize(v8::Isolate* pIsolate) { + m_pIsolate = pIsolate; DefineJsContext(); DefineJsClass(); m_pResolveProcessor = new CXFA_ResolveProcessor; @@ -74,7 +74,7 @@ FX_BOOL CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) { if (!m_hFM2JSContext) { m_hFM2JSContext = XFA_FM2JS_ContextCreate(); - XFA_FM2JS_ContextInitialize(m_hFM2JSContext, m_hJsRuntime, m_hJsContext, + XFA_FM2JS_ContextInitialize(m_hFM2JSContext, m_pIsolate, m_hJsContext, m_pDocument); } CFX_WideTextBuf wsJavaScript; @@ -384,7 +384,7 @@ void CXFA_ScriptContext::DefineJsContext() { m_JsGlobalClass.dynPropTypeGetter = CXFA_ScriptContext::GlobalPropTypeGetter; m_JsGlobalClass.dynPropDeleter = NULL; m_JsGlobalClass.dynMethodCall = CXFA_ScriptContext::NormalMethodCall; - m_hJsContext = FXJSE_Context_Create(m_hJsRuntime, &m_JsGlobalClass, + m_hJsContext = FXJSE_Context_Create(m_pIsolate, &m_JsGlobalClass, m_pDocument->GetRoot()); RemoveBuiltInObjs(m_hJsContext); FXJSE_Context_EnableCompatibleMode( @@ -414,7 +414,7 @@ FXJSE_HCONTEXT CXFA_ScriptContext::CreateVariablesContext( CXFA_ScriptContext::NormalMethodCall; } FXJSE_HCONTEXT hVariablesContext = - FXJSE_Context_Create(m_hJsRuntime, &m_JsGlobalVariablesClass, + FXJSE_Context_Create(m_pIsolate, &m_JsGlobalVariablesClass, new CXFA_ThisProxy(pSubform, pScriptNode)); RemoveBuiltInObjs(hVariablesContext); FXJSE_Context_EnableCompatibleMode( @@ -455,7 +455,7 @@ FX_BOOL CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) { CFX_ByteString btScript = FX_UTF8Encode(wsScript.c_str(), wsScript.GetLength()); - FXJSE_HVALUE hRetValue = FXJSE_Value_Create(m_hJsRuntime); + FXJSE_HVALUE hRetValue = FXJSE_Value_Create(m_pIsolate); CXFA_Node* pThisObject = pParent->GetNodeItem(XFA_NODEITEM_Parent); FXJSE_HCONTEXT hVariablesContext = CreateVariablesContext(pScriptNode, pThisObject); @@ -487,7 +487,7 @@ FX_BOOL CXFA_ScriptContext::QueryVariableHValue( FX_BOOL bRes = FALSE; FXJSE_HCONTEXT hVariableContext = (FXJSE_HCONTEXT)lpVariables; FXJSE_HVALUE hObject = FXJSE_Context_GetGlobalObject(hVariableContext); - FXJSE_HVALUE hVariableValue = FXJSE_Value_Create(m_hJsRuntime); + FXJSE_HVALUE hVariableValue = FXJSE_Value_Create(m_pIsolate); if (!bGetter) { FXJSE_Value_SetObjectOwnProp(hObject, szPropName, hValue); bRes = TRUE; @@ -537,7 +537,7 @@ void CXFA_ScriptContext::DefineJsClass() { void CXFA_ScriptContext::RemoveBuiltInObjs(FXJSE_HCONTEXT jsContext) const { static const CFX_ByteStringC OBJ_NAME[2] = {"Number", "Date"}; FXJSE_HVALUE hObject = FXJSE_Context_GetGlobalObject(jsContext); - FXJSE_HVALUE hProp = FXJSE_Value_Create(m_hJsRuntime); + FXJSE_HVALUE hProp = FXJSE_Value_Create(m_pIsolate); for (int i = 0; i < 2; ++i) { if (FXJSE_Value_GetObjectProp(hObject, OBJ_NAME[i], hProp)) FXJSE_Value_DeleteObjectProp(hObject, OBJ_NAME[i]); @@ -643,7 +643,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode, } if (rndFind.m_dwFlag == XFA_RESOVENODE_RSTYPE_Attribute && rndFind.m_pScriptAttribute && nStart < wsExpression.GetLength()) { - FXJSE_HVALUE hValue = FXJSE_Value_Create(m_hJsRuntime); + FXJSE_HVALUE hValue = FXJSE_Value_Create(m_pIsolate); (rndFind.m_Nodes[0]->*(rndFind.m_pScriptAttribute->lpfnCallback))( hValue, FALSE, (XFA_ATTRIBUTE)rndFind.m_pScriptAttribute->eAttribute); @@ -721,7 +721,7 @@ FXJSE_HVALUE CXFA_ScriptContext::GetJSValueFromMap(CXFA_Object* pObject) { } void* pValue = m_mapXFAToHValue.GetValueAt(pObject); if (pValue == NULL) { - FXJSE_HVALUE jsHvalue = FXJSE_Value_Create(m_hJsRuntime); + FXJSE_HVALUE jsHvalue = FXJSE_Value_Create(m_pIsolate); FXJSE_Value_SetObject(jsHvalue, pObject, m_hJsClass); m_mapXFAToHValue.SetAt(pObject, jsHvalue); pValue = jsHvalue; diff --git a/xfa/fxfa/parser/xfa_script_imp.h b/xfa/fxfa/parser/xfa_script_imp.h index 322b64bef6..7a9f8ae3ff 100644 --- a/xfa/fxfa/parser/xfa_script_imp.h +++ b/xfa/fxfa/parser/xfa_script_imp.h @@ -23,7 +23,7 @@ class CXFA_ScriptContext { explicit CXFA_ScriptContext(CXFA_Document* pDocument); ~CXFA_ScriptContext(); - void Initialize(FXJSE_HRUNTIME hRuntime); + void Initialize(v8::Isolate* pIsolate); void SetEventParam(CXFA_EventParam param) { m_eventParam = param; } CXFA_EventParam* GetEventParam() { return &m_eventParam; } FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType, @@ -39,7 +39,7 @@ class CXFA_ScriptContext { FXJSE_HVALUE GetJSValueFromMap(CXFA_Object* pObject); void CacheList(CXFA_NodeList* pList) { m_CacheListArray.Add(pList); } CXFA_Object* GetThisObject() const { return m_pThisObject; } - FXJSE_HRUNTIME GetRuntime() const { return m_hJsRuntime; } + v8::Isolate* GetRuntime() const { return m_pIsolate; } int32_t GetIndexByName(CXFA_Node* refNode); int32_t GetIndexByClassName(CXFA_Node* refNode); @@ -102,7 +102,7 @@ class CXFA_ScriptContext { CXFA_Document* m_pDocument; FXJSE_HCONTEXT m_hJsContext; - FXJSE_HRUNTIME m_hJsRuntime; + v8::Isolate* m_pIsolate; FXJSE_HCLASS m_hJsClass; XFA_SCRIPTLANGTYPE m_eScriptType; FXJSE_CLASS m_JsGlobalClass; -- cgit v1.2.3