summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-05-26 09:40:27 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-26 09:40:27 -0700
commit7f2abcc015583e63cceb52acde757cb2111420bd (patch)
treee8dc22bf5164f0c703ff4dda86447b85002c865d /xfa/fxfa
parentcfaffc09b1d62a81679fb01b0cc85e050be969b7 (diff)
downloadpdfium-7f2abcc015583e63cceb52acde757cb2111420bd.tar.xz
Replace FXJSE_HCONTEXT with CFXJSE_Context*
This Cl removes FXJSE_HCONTEXT and replaces it with the concrete CFXJSE_Context. All varibles have been updated as well to match the new type. Review-Url: https://codereview.chromium.org/2013963005
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jsapi.cpp6
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jsapi.h4
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.cpp16
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.h4
-rw-r--r--xfa/fxfa/parser/xfa_script_imp.cpp62
-rw-r--r--xfa/fxfa/parser/xfa_script_imp.h12
6 files changed, 52 insertions, 52 deletions
diff --git a/xfa/fxfa/fm2js/xfa_fm2jsapi.cpp b/xfa/fxfa/fm2js/xfa_fm2jsapi.cpp
index a5992a9709..df817606e2 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jsapi.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jsapi.cpp
@@ -44,12 +44,12 @@ XFA_HFM2JSCONTEXT XFA_FM2JS_ContextCreate() {
}
void XFA_FM2JS_ContextInitialize(XFA_HFM2JSCONTEXT hFM2JSContext,
- v8::Isolate* pScriptRuntime,
- FXJSE_HCONTEXT hScriptContext,
+ v8::Isolate* pScriptIsolate,
+ CFXJSE_Context* pScriptContext,
CXFA_Document* pDocument) {
CXFA_FM2JSContext* pContext =
reinterpret_cast<CXFA_FM2JSContext*>(hFM2JSContext);
- pContext->Initialize(pScriptRuntime, hScriptContext, pDocument);
+ pContext->Initialize(pScriptIsolate, pScriptContext, pDocument);
}
void XFA_FM2JS_GlobalPropertyGetter(XFA_HFM2JSCONTEXT hFM2JSContext,
diff --git a/xfa/fxfa/fm2js/xfa_fm2jsapi.h b/xfa/fxfa/fm2js/xfa_fm2jsapi.h
index 4b0045accf..011ae76ac6 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jsapi.h
+++ b/xfa/fxfa/fm2js/xfa_fm2jsapi.h
@@ -23,8 +23,8 @@ int32_t XFA_FM2JS_Translate(const CFX_WideStringC& wsFormcalc,
CFX_WideString& wsError);
XFA_HFM2JSCONTEXT XFA_FM2JS_ContextCreate();
void XFA_FM2JS_ContextInitialize(XFA_HFM2JSCONTEXT hFM2JSContext,
- v8::Isolate* pScriptRuntime,
- FXJSE_HCONTEXT hScriptContext,
+ v8::Isolate* pScriptIsolate,
+ CFXJSE_Context* pScriptContext,
CXFA_Document* pDocument);
void XFA_FM2JS_GlobalPropertyGetter(XFA_HFM2JSCONTEXT hFM2JSContext,
FXJSE_HVALUE hValue);
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index 7f0514eca0..f875ad2713 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -3239,16 +3239,16 @@ void CXFA_FM2JSContext::Eval(FXJSE_HOBJECT hThis,
XFA_FM2JS_Translate(
CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(),
wsJavaScriptBuf, wsError);
- FXJSE_HCONTEXT hContext = FXJSE_Context_Create(pIsolate);
+ CFXJSE_Context* pContext = FXJSE_Context_Create(pIsolate);
FXJSE_HVALUE returnValue = FXJSE_Value_Create(pIsolate);
javaScript = wsJavaScriptBuf.AsStringC();
FXJSE_ExecuteScript(
- hContext,
+ pContext,
FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()).c_str(),
returnValue);
FXJSE_Value_Set(args.GetReturnValue(), returnValue);
FXJSE_Value_Release(returnValue);
- FXJSE_Context_Release(hContext);
+ FXJSE_Context_Release(pContext);
}
FXJSE_Value_Release(scriptValue);
} else {
@@ -7175,11 +7175,11 @@ CXFA_FM2JSContext::~CXFA_FM2JSContext() {
}
m_pIsolate = NULL;
}
-void CXFA_FM2JSContext::Initialize(v8::Isolate* hScriptRuntime,
- FXJSE_HCONTEXT hScriptContext,
+void CXFA_FM2JSContext::Initialize(v8::Isolate* pScriptIsolate,
+ CFXJSE_Context* pScriptContext,
CXFA_Document* pDoc) {
m_pDocument = pDoc;
- m_pIsolate = hScriptRuntime;
+ m_pIsolate = pScriptIsolate;
m_fmClass.name = "XFA_FM2JS_FormCalcClass";
m_fmClass.constructor = NULL;
m_fmClass.properties = NULL;
@@ -7187,8 +7187,8 @@ void CXFA_FM2JSContext::Initialize(v8::Isolate* hScriptRuntime,
m_fmClass.propNum = 0;
m_fmClass.methNum =
sizeof(formcalc_fm2js_functions) / sizeof(formcalc_fm2js_functions[0]);
- m_hFMClass = FXJSE_DefineClass(hScriptContext, &m_fmClass);
- m_hValue = FXJSE_Value_Create(hScriptRuntime);
+ m_hFMClass = FXJSE_DefineClass(pScriptContext, &m_fmClass);
+ m_hValue = FXJSE_Value_Create(pScriptIsolate);
FXJSE_Value_SetNull(m_hValue);
FXJSE_Value_SetObject(m_hValue, this, m_hFMClass);
}
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h
index 3cd4a0b763..997b32fe59 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h
@@ -435,8 +435,8 @@ class CXFA_FM2JSContext {
CXFA_FM2JSContext();
~CXFA_FM2JSContext();
- void Initialize(v8::Isolate* pScriptRuntime,
- FXJSE_HCONTEXT hScriptContext,
+ void Initialize(v8::Isolate* pScriptIsolate,
+ CFXJSE_Context* pScriptContext,
CXFA_Document* pDoc);
void GlobalPropertyGetter(FXJSE_HVALUE hValue);
diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp
index 50810305e4..c29e7a88d0 100644
--- a/xfa/fxfa/parser/xfa_script_imp.cpp
+++ b/xfa/fxfa/parser/xfa_script_imp.cpp
@@ -22,7 +22,7 @@
CXFA_ScriptContext::CXFA_ScriptContext(CXFA_Document* pDocument)
: m_pDocument(pDocument),
- m_hJsContext(nullptr),
+ m_pJsContext(nullptr),
m_pIsolate(nullptr),
m_hJsClass(nullptr),
m_eScriptType(XFA_SCRIPTLANGTYPE_Unkown),
@@ -49,9 +49,9 @@ CXFA_ScriptContext::~CXFA_ScriptContext() {
XFA_FM2JS_ContextRelease(m_hFM2JSContext);
m_hFM2JSContext = NULL;
}
- if (m_hJsContext) {
- FXJSE_Context_Release(m_hJsContext);
- m_hJsContext = NULL;
+ if (m_pJsContext) {
+ FXJSE_Context_Release(m_pJsContext);
+ m_pJsContext = NULL;
}
delete m_pResolveProcessor;
m_upObjectArray.RemoveAll();
@@ -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_pIsolate, m_hJsContext,
+ XFA_FM2JS_ContextInitialize(m_hFM2JSContext, m_pIsolate, m_pJsContext,
m_pDocument);
}
CFX_WideTextBuf wsJavaScript;
@@ -93,7 +93,7 @@ FX_BOOL CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType,
m_pThisObject = pThisObject;
FXJSE_HVALUE pValue = pThisObject ? GetJSValueFromMap(pThisObject) : NULL;
FX_BOOL bRet =
- FXJSE_ExecuteScript(m_hJsContext, btScript.c_str(), hRetValue, pValue);
+ FXJSE_ExecuteScript(m_pJsContext, btScript.c_str(), hRetValue, pValue);
m_pThisObject = pOriginalObject;
m_eScriptType = eSaveType;
return bRet;
@@ -384,19 +384,19 @@ 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_pIsolate, &m_JsGlobalClass,
+ m_pJsContext = FXJSE_Context_Create(m_pIsolate, &m_JsGlobalClass,
m_pDocument->GetRoot());
- RemoveBuiltInObjs(m_hJsContext);
+ RemoveBuiltInObjs(m_pJsContext);
FXJSE_Context_EnableCompatibleMode(
- m_hJsContext, FXJSE_COMPATIBLEMODEFLAG_CONSTRUCTOREXTRAMETHODS);
+ m_pJsContext, FXJSE_COMPATIBLEMODEFLAG_CONSTRUCTOREXTRAMETHODS);
}
-FXJSE_HCONTEXT CXFA_ScriptContext::CreateVariablesContext(
+CFXJSE_Context* CXFA_ScriptContext::CreateVariablesContext(
CXFA_Node* pScriptNode,
CXFA_Node* pSubform) {
if (!pScriptNode || !pSubform)
return nullptr;
- if (m_mapVariableToHValue.GetCount() == 0) {
+ if (m_mapVariableToContext.GetCount() == 0) {
m_JsGlobalVariablesClass.constructor = nullptr;
m_JsGlobalVariablesClass.name = "XFAScriptObject";
m_JsGlobalVariablesClass.propNum = 0;
@@ -413,14 +413,14 @@ FXJSE_HCONTEXT CXFA_ScriptContext::CreateVariablesContext(
m_JsGlobalVariablesClass.dynMethodCall =
CXFA_ScriptContext::NormalMethodCall;
}
- FXJSE_HCONTEXT hVariablesContext =
+ CFXJSE_Context* pVariablesContext =
FXJSE_Context_Create(m_pIsolate, &m_JsGlobalVariablesClass,
new CXFA_ThisProxy(pSubform, pScriptNode));
- RemoveBuiltInObjs(hVariablesContext);
+ RemoveBuiltInObjs(pVariablesContext);
FXJSE_Context_EnableCompatibleMode(
- hVariablesContext, FXJSE_COMPATIBLEMODEFLAG_CONSTRUCTOREXTRAMETHODS);
- m_mapVariableToHValue.SetAt(pScriptNode, hVariablesContext);
- return hVariablesContext;
+ pVariablesContext, FXJSE_COMPATIBLEMODEFLAG_CONSTRUCTOREXTRAMETHODS);
+ m_mapVariableToContext.SetAt(pScriptNode, pVariablesContext);
+ return pVariablesContext;
}
CXFA_Object* CXFA_ScriptContext::GetVariablesThis(CXFA_Object* pObject,
FX_BOOL bScriptNode) {
@@ -442,7 +442,7 @@ FX_BOOL CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) {
if (!pParent || pParent->GetClassID() != XFA_ELEMENT_Variables)
return FALSE;
- if (m_mapVariableToHValue.GetValueAt(pScriptNode))
+ if (m_mapVariableToContext.GetValueAt(pScriptNode))
return TRUE;
CXFA_Node* pTextNode = pScriptNode->GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -457,12 +457,12 @@ FX_BOOL CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) {
FX_UTF8Encode(wsScript.c_str(), wsScript.GetLength());
FXJSE_HVALUE hRetValue = FXJSE_Value_Create(m_pIsolate);
CXFA_Node* pThisObject = pParent->GetNodeItem(XFA_NODEITEM_Parent);
- FXJSE_HCONTEXT hVariablesContext =
+ CFXJSE_Context* pVariablesContext =
CreateVariablesContext(pScriptNode, pThisObject);
CXFA_Object* pOriginalObject = m_pThisObject;
m_pThisObject = pThisObject;
FX_BOOL bRet =
- FXJSE_ExecuteScript(hVariablesContext, btScript.c_str(), hRetValue);
+ FXJSE_ExecuteScript(pVariablesContext, btScript.c_str(), hRetValue);
m_pThisObject = pOriginalObject;
FXJSE_Value_Release(hRetValue);
return bRet;
@@ -480,13 +480,13 @@ FX_BOOL CXFA_ScriptContext::QueryVariableHValue(
if (!variablesNode || variablesNode->GetClassID() != XFA_ELEMENT_Variables)
return FALSE;
- void* lpVariables = m_mapVariableToHValue.GetValueAt(pScriptNode);
+ void* lpVariables = m_mapVariableToContext.GetValueAt(pScriptNode);
if (!lpVariables)
return FALSE;
FX_BOOL bRes = FALSE;
- FXJSE_HCONTEXT hVariableContext = (FXJSE_HCONTEXT)lpVariables;
- FXJSE_HVALUE hObject = FXJSE_Context_GetGlobalObject(hVariableContext);
+ CFXJSE_Context* pVariableContext = static_cast<CFXJSE_Context*>(lpVariables);
+ FXJSE_HVALUE hObject = FXJSE_Context_GetGlobalObject(pVariableContext);
FXJSE_HVALUE hVariableValue = FXJSE_Value_Create(m_pIsolate);
if (!bGetter) {
FXJSE_Value_SetObjectOwnProp(hObject, szPropName, hValue);
@@ -507,17 +507,17 @@ FX_BOOL CXFA_ScriptContext::QueryVariableHValue(
}
void CXFA_ScriptContext::ReleaseVariablesMap() {
- FX_POSITION ps = m_mapVariableToHValue.GetStartPosition();
+ FX_POSITION ps = m_mapVariableToContext.GetStartPosition();
while (ps) {
CXFA_Object* pScriptNode;
- FXJSE_HCONTEXT hVariableContext = nullptr;
- m_mapVariableToHValue.GetNextAssoc(ps, pScriptNode, hVariableContext);
- FXJSE_HVALUE hObject = FXJSE_Context_GetGlobalObject(hVariableContext);
+ CFXJSE_Context* pVariableContext = nullptr;
+ m_mapVariableToContext.GetNextAssoc(ps, pScriptNode, pVariableContext);
+ FXJSE_HVALUE hObject = FXJSE_Context_GetGlobalObject(pVariableContext);
delete static_cast<CXFA_ThisProxy*>(FXJSE_Value_ToObject(hObject, nullptr));
FXJSE_Value_Release(hObject);
- FXJSE_Context_Release(hVariableContext);
+ FXJSE_Context_Release(pVariableContext);
}
- m_mapVariableToHValue.RemoveAll();
+ m_mapVariableToContext.RemoveAll();
}
void CXFA_ScriptContext::DefineJsClass() {
@@ -532,11 +532,11 @@ void CXFA_ScriptContext::DefineJsClass() {
m_JsNormalClass.dynPropTypeGetter = CXFA_ScriptContext::NormalPropTypeGetter;
m_JsNormalClass.dynPropDeleter = NULL;
m_JsNormalClass.dynMethodCall = CXFA_ScriptContext::NormalMethodCall;
- m_hJsClass = FXJSE_DefineClass(m_hJsContext, &m_JsNormalClass);
+ m_hJsClass = FXJSE_DefineClass(m_pJsContext, &m_JsNormalClass);
}
-void CXFA_ScriptContext::RemoveBuiltInObjs(FXJSE_HCONTEXT jsContext) const {
+void CXFA_ScriptContext::RemoveBuiltInObjs(CFXJSE_Context* pContext) const {
static const CFX_ByteStringC OBJ_NAME[2] = {"Number", "Date"};
- FXJSE_HVALUE hObject = FXJSE_Context_GetGlobalObject(jsContext);
+ FXJSE_HVALUE hObject = FXJSE_Context_GetGlobalObject(pContext);
FXJSE_HVALUE hProp = FXJSE_Value_Create(m_pIsolate);
for (int i = 0; i < 2; ++i) {
if (FXJSE_Value_GetObjectProp(hObject, OBJ_NAME[i], hProp))
diff --git a/xfa/fxfa/parser/xfa_script_imp.h b/xfa/fxfa/parser/xfa_script_imp.h
index 7a9f8ae3ff..2efd58914b 100644
--- a/xfa/fxfa/parser/xfa_script_imp.h
+++ b/xfa/fxfa/parser/xfa_script_imp.h
@@ -93,15 +93,15 @@ class CXFA_ScriptContext {
CXFA_NodeArray& GetUpObjectArray() { return m_upObjectArray; }
CXFA_Document* GetDocument() const { return m_pDocument; }
- protected:
+ private:
void DefineJsContext();
- FXJSE_HCONTEXT CreateVariablesContext(CXFA_Node* pScriptNode,
- CXFA_Node* pSubform);
+ CFXJSE_Context* CreateVariablesContext(CXFA_Node* pScriptNode,
+ CXFA_Node* pSubform);
void DefineJsClass();
- void RemoveBuiltInObjs(FXJSE_HCONTEXT jsContext) const;
+ void RemoveBuiltInObjs(CFXJSE_Context* pContext) const;
CXFA_Document* m_pDocument;
- FXJSE_HCONTEXT m_hJsContext;
+ CFXJSE_Context* m_pJsContext;
v8::Isolate* m_pIsolate;
FXJSE_HCLASS m_hJsClass;
XFA_SCRIPTLANGTYPE m_eScriptType;
@@ -109,7 +109,7 @@ class CXFA_ScriptContext {
FXJSE_CLASS m_JsNormalClass;
CFX_MapPtrTemplate<CXFA_Object*, FXJSE_HVALUE> m_mapXFAToHValue;
FXJSE_CLASS m_JsGlobalVariablesClass;
- CFX_MapPtrTemplate<CXFA_Object*, FXJSE_HCONTEXT> m_mapVariableToHValue;
+ CFX_MapPtrTemplate<CXFA_Object*, CFXJSE_Context*> m_mapVariableToContext;
CXFA_EventParam m_eventParam;
CXFA_NodeArray m_upObjectArray;
CFX_ArrayTemplate<CXFA_NodeList*> m_CacheListArray;