summaryrefslogtreecommitdiff
path: root/xfa/fxjse
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-05-26 11:14:08 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-26 11:14:08 -0700
commit12a6b0c1bb3ab86a03a84464bed168995ae0d82a (patch)
tree03c381e1eb6afd47f14c76cc3f9b91641a603dff /xfa/fxjse
parentd3e354a43531eaed87e43d9ff2df4525186ea28d (diff)
downloadpdfium-12a6b0c1bb3ab86a03a84464bed168995ae0d82a.tar.xz
Remove FXJSE_HOBJECT and FXJSE_HVALUE for CFXJSE_Value*
This CL replaces FXJSE_HOBJECT and FXJSE_HVALUE with the concrete CFXJSE_Value* type. All variables are renamed to match. Review-Url: https://codereview.chromium.org/2012253002
Diffstat (limited to 'xfa/fxjse')
-rw-r--r--xfa/fxjse/cfxjse_arguments.h6
-rw-r--r--xfa/fxjse/class.cpp22
-rw-r--r--xfa/fxjse/context.cpp12
-rw-r--r--xfa/fxjse/dynprop.cpp55
-rw-r--r--xfa/fxjse/include/fxjse.h108
-rw-r--r--xfa/fxjse/value.cpp207
-rw-r--r--xfa/fxjse/value.h2
7 files changed, 182 insertions, 230 deletions
diff --git a/xfa/fxjse/cfxjse_arguments.h b/xfa/fxjse/cfxjse_arguments.h
index d86ec0f1f8..9a20c7c4a3 100644
--- a/xfa/fxjse/cfxjse_arguments.h
+++ b/xfa/fxjse/cfxjse_arguments.h
@@ -13,13 +13,13 @@ class CFXJSE_Arguments {
public:
v8::Isolate* GetRuntime() const;
int32_t GetLength() const;
- FXJSE_HVALUE GetValue(int32_t index) const;
+ CFXJSE_Value* GetValue(int32_t index) const;
FX_BOOL GetBoolean(int32_t index) const;
int32_t GetInt32(int32_t index) const;
FX_FLOAT GetFloat(int32_t index) const;
CFX_ByteString GetUTF8String(int32_t index) const;
- void* GetObject(int32_t index, CFXJSE_Class* hClass = nullptr) const;
- FXJSE_HVALUE GetReturnValue();
+ void* GetObject(int32_t index, CFXJSE_Class* pClass = nullptr) const;
+ CFXJSE_Value* GetReturnValue();
};
#endif // XFA_FXJSE_CFXJSE_ARGUMENTS_H_
diff --git a/xfa/fxjse/class.cpp b/xfa/fxjse/class.cpp
index 6d0a719821..a2f4146208 100644
--- a/xfa/fxjse/class.cpp
+++ b/xfa/fxjse/class.cpp
@@ -42,8 +42,7 @@ static void FXJSE_V8FunctionCallback_Wrapper(
lpThisValue->ForceSetValue(info.This());
CFXJSE_Value* lpRetValue = CFXJSE_Value::Create(info.GetIsolate());
CFXJSE_ArgumentsImpl impl = {&info, lpRetValue};
- lpFunctionInfo->callbackProc(reinterpret_cast<FXJSE_HOBJECT>(lpThisValue),
- szFunctionName,
+ lpFunctionInfo->callbackProc(lpThisValue, szFunctionName,
reinterpret_cast<CFXJSE_Arguments&>(impl));
if (!lpRetValue->DirectGetValue().IsEmpty()) {
info.GetReturnValue().Set(lpRetValue->DirectGetValue());
@@ -66,8 +65,7 @@ static void FXJSE_V8ClassGlobalConstructorCallback_Wrapper(
lpThisValue->ForceSetValue(info.This());
CFXJSE_Value* lpRetValue = CFXJSE_Value::Create(info.GetIsolate());
CFXJSE_ArgumentsImpl impl = {&info, lpRetValue};
- lpClassDefinition->constructor(reinterpret_cast<FXJSE_HOBJECT>(lpThisValue),
- szFunctionName,
+ lpClassDefinition->constructor(lpThisValue, szFunctionName,
reinterpret_cast<CFXJSE_Arguments&>(impl));
if (!lpRetValue->DirectGetValue().IsEmpty()) {
info.GetReturnValue().Set(lpRetValue->DirectGetValue());
@@ -90,9 +88,7 @@ static void FXJSE_V8GetterCallback_Wrapper(
CFXJSE_Value* lpThisValue = CFXJSE_Value::Create(info.GetIsolate());
CFXJSE_Value* lpPropValue = CFXJSE_Value::Create(info.GetIsolate());
lpThisValue->ForceSetValue(info.This());
- lpPropertyInfo->getProc(reinterpret_cast<FXJSE_HOBJECT>(lpThisValue),
- szPropertyName,
- reinterpret_cast<FXJSE_HVALUE>(lpPropValue));
+ lpPropertyInfo->getProc(lpThisValue, szPropertyName, lpPropValue);
info.GetReturnValue().Set(lpPropValue->DirectGetValue());
delete lpThisValue;
lpThisValue = NULL;
@@ -114,9 +110,7 @@ static void FXJSE_V8SetterCallback_Wrapper(
CFXJSE_Value* lpPropValue = CFXJSE_Value::Create(info.GetIsolate());
lpThisValue->ForceSetValue(info.This());
lpPropValue->ForceSetValue(value);
- lpPropertyInfo->setProc(reinterpret_cast<FXJSE_HOBJECT>(lpThisValue),
- szPropertyName,
- reinterpret_cast<FXJSE_HVALUE>(lpPropValue));
+ lpPropertyInfo->setProc(lpThisValue, szPropertyName, lpPropValue);
delete lpThisValue;
lpThisValue = NULL;
delete lpPropValue;
@@ -146,13 +140,13 @@ int32_t CFXJSE_Arguments::GetLength() const {
return lpArguments->m_pInfo->Length();
}
-FXJSE_HVALUE CFXJSE_Arguments::GetValue(int32_t index) const {
+CFXJSE_Value* CFXJSE_Arguments::GetValue(int32_t index) const {
const CFXJSE_ArgumentsImpl* lpArguments =
reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this);
CFXJSE_Value* lpArgValue = CFXJSE_Value::Create(v8::Isolate::GetCurrent());
ASSERT(lpArgValue);
lpArgValue->ForceSetValue((*lpArguments->m_pInfo)[index]);
- return reinterpret_cast<FXJSE_HVALUE>(lpArgValue);
+ return lpArgValue;
}
FX_BOOL CFXJSE_Arguments::GetBoolean(int32_t index) const {
@@ -192,10 +186,10 @@ void* CFXJSE_Arguments::GetObject(int32_t index, CFXJSE_Class* pClass) const {
return FXJSE_RetrieveObjectBinding(hValue.As<v8::Object>(), pClass);
}
-FXJSE_HVALUE CFXJSE_Arguments::GetReturnValue() {
+CFXJSE_Value* CFXJSE_Arguments::GetReturnValue() {
const CFXJSE_ArgumentsImpl* lpArguments =
reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this);
- return reinterpret_cast<FXJSE_HVALUE>(lpArguments->m_pRetValue);
+ return lpArguments->m_pRetValue;
}
static void FXJSE_Context_GlobalObjToString(
const v8::FunctionCallbackInfo<v8::Value>& info) {
diff --git a/xfa/fxjse/context.cpp b/xfa/fxjse/context.cpp
index 76df5616e5..bdc31e4594 100644
--- a/xfa/fxjse/context.cpp
+++ b/xfa/fxjse/context.cpp
@@ -21,14 +21,14 @@ void FXJSE_Context_Release(CFXJSE_Context* pContext) {
delete pContext;
}
-FXJSE_HVALUE FXJSE_Context_GetGlobalObject(CFXJSE_Context* pContext) {
+CFXJSE_Value* FXJSE_Context_GetGlobalObject(CFXJSE_Context* pContext) {
if (!pContext)
return nullptr;
CFXJSE_Value* lpValue = CFXJSE_Value::Create(pContext->GetRuntime());
ASSERT(lpValue);
pContext->GetGlobalObject(lpValue);
- return reinterpret_cast<FXJSE_HVALUE>(lpValue);
+ return lpValue;
}
static const FX_CHAR* szCompatibleModeScripts[] = {
@@ -68,11 +68,9 @@ void FXJSE_Context_EnableCompatibleMode(CFXJSE_Context* pContext,
FX_BOOL FXJSE_ExecuteScript(CFXJSE_Context* pContext,
const FX_CHAR* szScript,
- FXJSE_HVALUE hRetValue,
- FXJSE_HVALUE hNewThisObject) {
- return pContext->ExecuteScript(
- szScript, reinterpret_cast<CFXJSE_Value*>(hRetValue),
- reinterpret_cast<CFXJSE_Value*>(hNewThisObject));
+ CFXJSE_Value* pRetValue,
+ CFXJSE_Value* pNewThisObject) {
+ return pContext->ExecuteScript(szScript, pRetValue, pNewThisObject);
}
v8::Local<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate,
diff --git a/xfa/fxjse/dynprop.cpp b/xfa/fxjse/dynprop.cpp
index 498c6608cf..514f1b3a9d 100644
--- a/xfa/fxjse/dynprop.cpp
+++ b/xfa/fxjse/dynprop.cpp
@@ -22,8 +22,7 @@ static void FXJSE_DynPropGetterAdapter_MethodCallback(
lpThisValue->ForceSetValue(info.This());
CFXJSE_Value* lpRetValue = CFXJSE_Value::Create(info.GetIsolate());
CFXJSE_ArgumentsImpl impl = {&info, lpRetValue};
- lpClass->dynMethodCall(reinterpret_cast<FXJSE_HOBJECT>(lpThisValue),
- szFxPropName,
+ lpClass->dynMethodCall(lpThisValue, szFxPropName,
reinterpret_cast<CFXJSE_Arguments&>(impl));
if (!lpRetValue->DirectGetValue().IsEmpty()) {
info.GetReturnValue().Set(lpRetValue->DirectGetValue());
@@ -35,22 +34,21 @@ static void FXJSE_DynPropGetterAdapter_MethodCallback(
}
static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS* lpClass,
- FXJSE_HOBJECT hObject,
+ CFXJSE_Value* pObject,
const CFX_ByteStringC& szPropName,
- FXJSE_HVALUE hValue) {
+ CFXJSE_Value* pValue) {
ASSERT(lpClass);
int32_t nPropType =
lpClass->dynPropTypeGetter == nullptr
? FXJSE_ClassPropType_Property
- : lpClass->dynPropTypeGetter(hObject, szPropName, FALSE);
+ : lpClass->dynPropTypeGetter(pObject, szPropName, FALSE);
if (nPropType == FXJSE_ClassPropType_Property) {
if (lpClass->dynPropGetter) {
- lpClass->dynPropGetter(hObject, szPropName, hValue);
+ lpClass->dynPropGetter(pObject, szPropName, pValue);
}
} else if (nPropType == FXJSE_ClassPropType_Method) {
- if (lpClass->dynMethodCall && hValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- v8::Isolate* pIsolate = lpValue->GetIsolate();
+ if (lpClass->dynMethodCall && pValue) {
+ v8::Isolate* pIsolate = pValue->GetIsolate();
v8::HandleScope hscope(pIsolate);
v8::Local<v8::ObjectTemplate> hCallBackInfoTemplate =
v8::ObjectTemplate::New(pIsolate);
@@ -63,51 +61,51 @@ static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS* lpClass,
1, v8::String::NewFromUtf8(
pIsolate, reinterpret_cast<const char*>(szPropName.raw_str()),
v8::String::kNormalString, szPropName.GetLength()));
- lpValue->ForceSetValue(v8::Function::New(
- lpValue->GetIsolate(), FXJSE_DynPropGetterAdapter_MethodCallback,
+ pValue->ForceSetValue(v8::Function::New(
+ pValue->GetIsolate(), FXJSE_DynPropGetterAdapter_MethodCallback,
hCallBackInfo));
}
}
}
static void FXJSE_DynPropSetterAdapter(const FXJSE_CLASS* lpClass,
- FXJSE_HOBJECT hObject,
+ CFXJSE_Value* pObject,
const CFX_ByteStringC& szPropName,
- FXJSE_HVALUE hValue) {
+ CFXJSE_Value* pValue) {
ASSERT(lpClass);
int32_t nPropType =
lpClass->dynPropTypeGetter == nullptr
? FXJSE_ClassPropType_Property
- : lpClass->dynPropTypeGetter(hObject, szPropName, FALSE);
+ : lpClass->dynPropTypeGetter(pObject, szPropName, FALSE);
if (nPropType != FXJSE_ClassPropType_Method) {
if (lpClass->dynPropSetter) {
- lpClass->dynPropSetter(hObject, szPropName, hValue);
+ lpClass->dynPropSetter(pObject, szPropName, pValue);
}
}
}
static FX_BOOL FXJSE_DynPropQueryAdapter(const FXJSE_CLASS* lpClass,
- FXJSE_HOBJECT hObject,
+ CFXJSE_Value* pObject,
const CFX_ByteStringC& szPropName) {
ASSERT(lpClass);
int32_t nPropType =
lpClass->dynPropTypeGetter == nullptr
? FXJSE_ClassPropType_Property
- : lpClass->dynPropTypeGetter(hObject, szPropName, TRUE);
+ : lpClass->dynPropTypeGetter(pObject, szPropName, TRUE);
return nPropType != FXJSE_ClassPropType_None;
}
static FX_BOOL FXJSE_DynPropDeleterAdapter(const FXJSE_CLASS* lpClass,
- FXJSE_HOBJECT hObject,
+ CFXJSE_Value* pObject,
const CFX_ByteStringC& szPropName) {
ASSERT(lpClass);
int32_t nPropType =
lpClass->dynPropTypeGetter == nullptr
? FXJSE_ClassPropType_Property
- : lpClass->dynPropTypeGetter(hObject, szPropName, FALSE);
+ : lpClass->dynPropTypeGetter(pObject, szPropName, FALSE);
if (nPropType != FXJSE_ClassPropType_Method) {
if (lpClass->dynPropDeleter) {
- return lpClass->dynPropDeleter(hObject, szPropName);
+ return lpClass->dynPropDeleter(pObject, szPropName);
} else {
return nPropType == FXJSE_ClassPropType_Property ? FALSE : TRUE;
}
@@ -127,9 +125,7 @@ static void FXJSE_V8_GenericNamedPropertyQueryCallback(
CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
CFXJSE_Value* lpThisValue = CFXJSE_Value::Create(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
- if (FXJSE_DynPropQueryAdapter(lpClass,
- reinterpret_cast<FXJSE_HOBJECT>(lpThisValue),
- szFxPropName)) {
+ if (FXJSE_DynPropQueryAdapter(lpClass, lpThisValue, szFxPropName)) {
info.GetReturnValue().Set(v8::DontDelete);
} else {
const int32_t iV8Absent = 64;
@@ -152,10 +148,7 @@ static void FXJSE_V8_GenericNamedPropertyDeleterCallback(
CFXJSE_Value* lpThisValue = CFXJSE_Value::Create(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
info.GetReturnValue().Set(
- FXJSE_DynPropDeleterAdapter(
- lpClass, reinterpret_cast<FXJSE_HOBJECT>(lpThisValue), szFxPropName)
- ? true
- : false);
+ !!FXJSE_DynPropDeleterAdapter(lpClass, lpThisValue, szFxPropName));
delete lpThisValue;
lpThisValue = nullptr;
}
@@ -171,9 +164,7 @@ static void FXJSE_V8_GenericNamedPropertyGetterCallback(
CFXJSE_Value* lpThisValue = CFXJSE_Value::Create(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
CFXJSE_Value* lpNewValue = CFXJSE_Value::Create(info.GetIsolate());
- FXJSE_DynPropGetterAdapter(
- lpClass, reinterpret_cast<FXJSE_HOBJECT>(lpThisValue), szFxPropName,
- reinterpret_cast<FXJSE_HVALUE>(lpNewValue));
+ FXJSE_DynPropGetterAdapter(lpClass, lpThisValue, szFxPropName, lpNewValue);
info.GetReturnValue().Set(lpNewValue->DirectGetValue());
delete lpThisValue;
lpThisValue = nullptr;
@@ -192,9 +183,7 @@ static void FXJSE_V8_GenericNamedPropertySetterCallback(
lpThisValue->ForceSetValue(thisObject);
CFXJSE_Value* lpNewValue = CFXJSE_Value::Create(info.GetIsolate());
lpNewValue->ForceSetValue(value);
- FXJSE_DynPropSetterAdapter(
- lpClass, reinterpret_cast<FXJSE_HOBJECT>(lpThisValue), szFxPropName,
- reinterpret_cast<FXJSE_HVALUE>(lpNewValue));
+ FXJSE_DynPropSetterAdapter(lpClass, lpThisValue, szFxPropName, lpNewValue);
info.GetReturnValue().Set(value);
delete lpThisValue;
lpThisValue = nullptr;
diff --git a/xfa/fxjse/include/fxjse.h b/xfa/fxjse/include/fxjse.h
index 5cf2d2abb7..4484303046 100644
--- a/xfa/fxjse/include/fxjse.h
+++ b/xfa/fxjse/include/fxjse.h
@@ -14,21 +14,18 @@
class CFXJSE_Arguments;
class CFXJSE_Class;
class CFXJSE_Context;
+class CFXJSE_Value;
-typedef struct FXJSE_HVALUE_ { void* pData; } * FXJSE_HVALUE;
-// NOLINTNEXTLINE
-typedef struct FXJSE_HOBJECT_ : public FXJSE_HVALUE_{} * FXJSE_HOBJECT;
-
-typedef void (*FXJSE_FuncCallback)(FXJSE_HOBJECT hThis,
+typedef void (*FXJSE_FuncCallback)(CFXJSE_Value* pThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args);
-typedef void (*FXJSE_PropAccessor)(FXJSE_HOBJECT hObject,
+typedef void (*FXJSE_PropAccessor)(CFXJSE_Value* pObject,
const CFX_ByteStringC& szPropName,
- FXJSE_HVALUE hValue);
-typedef int32_t (*FXJSE_PropTypeGetter)(FXJSE_HOBJECT hObject,
+ CFXJSE_Value* pValue);
+typedef int32_t (*FXJSE_PropTypeGetter)(CFXJSE_Value* pObject,
const CFX_ByteStringC& szPropName,
FX_BOOL bQueryIn);
-typedef FX_BOOL (*FXJSE_PropDeleter)(FXJSE_HOBJECT hObject,
+typedef FX_BOOL (*FXJSE_PropDeleter)(CFXJSE_Value* pObject,
const CFX_ByteStringC& szPropName);
enum FXJSE_ClassPropTypes {
@@ -77,7 +74,7 @@ CFXJSE_Context* FXJSE_Context_Create(v8::Isolate* pIsolate,
const FXJSE_CLASS* lpGlobalClass = nullptr,
void* lpGlobalObject = nullptr);
void FXJSE_Context_Release(CFXJSE_Context* pContext);
-FXJSE_HVALUE FXJSE_Context_GetGlobalObject(CFXJSE_Context* pContext);
+CFXJSE_Value* FXJSE_Context_GetGlobalObject(CFXJSE_Context* pContext);
void FXJSE_Context_EnableCompatibleMode(CFXJSE_Context* pContext,
uint32_t dwCompatibleFlags);
@@ -85,67 +82,68 @@ void FXJSE_Context_EnableCompatibleMode(CFXJSE_Context* pContext,
CFXJSE_Class* FXJSE_DefineClass(CFXJSE_Context* pContext,
const FXJSE_CLASS* lpClass);
-FXJSE_HVALUE FXJSE_Value_Create(v8::Isolate* pIsolate);
-void FXJSE_Value_Release(FXJSE_HVALUE hValue);
-
-FX_BOOL FXJSE_Value_IsUndefined(FXJSE_HVALUE hValue);
-FX_BOOL FXJSE_Value_IsNull(FXJSE_HVALUE hValue);
-FX_BOOL FXJSE_Value_IsBoolean(FXJSE_HVALUE hValue);
-FX_BOOL FXJSE_Value_IsUTF8String(FXJSE_HVALUE hValue);
-FX_BOOL FXJSE_Value_IsNumber(FXJSE_HVALUE hValue);
-FX_BOOL FXJSE_Value_IsObject(FXJSE_HVALUE hValue);
-FX_BOOL FXJSE_Value_IsArray(FXJSE_HVALUE hValue);
-FX_BOOL FXJSE_Value_IsFunction(FXJSE_HVALUE hValue);
-
-FX_BOOL FXJSE_Value_ToBoolean(FXJSE_HVALUE hValue);
-FX_FLOAT FXJSE_Value_ToFloat(FXJSE_HVALUE hValue);
-double FXJSE_Value_ToDouble(FXJSE_HVALUE hValue);
-int32_t FXJSE_Value_ToInteger(FXJSE_HVALUE hValue);
-void FXJSE_Value_ToUTF8String(FXJSE_HVALUE hValue, CFX_ByteString& szStrOutput);
-void* FXJSE_Value_ToObject(FXJSE_HVALUE hValue, CFXJSE_Class* hClass);
-
-void FXJSE_Value_SetUndefined(FXJSE_HVALUE hValue);
-void FXJSE_Value_SetNull(FXJSE_HVALUE hValue);
-void FXJSE_Value_SetBoolean(FXJSE_HVALUE hValue, FX_BOOL bBoolean);
-void FXJSE_Value_SetUTF8String(FXJSE_HVALUE hValue,
+CFXJSE_Value* FXJSE_Value_Create(v8::Isolate* pIsolate);
+void FXJSE_Value_Release(CFXJSE_Value* pValue);
+
+FX_BOOL FXJSE_Value_IsUndefined(CFXJSE_Value* pValue);
+FX_BOOL FXJSE_Value_IsNull(CFXJSE_Value* pValue);
+FX_BOOL FXJSE_Value_IsBoolean(CFXJSE_Value* pValue);
+FX_BOOL FXJSE_Value_IsUTF8String(CFXJSE_Value* pValue);
+FX_BOOL FXJSE_Value_IsNumber(CFXJSE_Value* pValue);
+FX_BOOL FXJSE_Value_IsObject(CFXJSE_Value* pValue);
+FX_BOOL FXJSE_Value_IsArray(CFXJSE_Value* pValue);
+FX_BOOL FXJSE_Value_IsFunction(CFXJSE_Value* pValue);
+
+FX_BOOL FXJSE_Value_ToBoolean(CFXJSE_Value* pValue);
+FX_FLOAT FXJSE_Value_ToFloat(CFXJSE_Value* pValue);
+double FXJSE_Value_ToDouble(CFXJSE_Value* pValue);
+int32_t FXJSE_Value_ToInteger(CFXJSE_Value* pValue);
+void FXJSE_Value_ToUTF8String(CFXJSE_Value* pValue,
+ CFX_ByteString& szStrOutput);
+void* FXJSE_Value_ToObject(CFXJSE_Value* pValue, CFXJSE_Class* pClass);
+
+void FXJSE_Value_SetUndefined(CFXJSE_Value* pValue);
+void FXJSE_Value_SetNull(CFXJSE_Value* pValue);
+void FXJSE_Value_SetBoolean(CFXJSE_Value* pValue, FX_BOOL bBoolean);
+void FXJSE_Value_SetUTF8String(CFXJSE_Value* pValue,
const CFX_ByteStringC& szString);
-void FXJSE_Value_SetInteger(FXJSE_HVALUE hValue, int32_t nInteger);
-void FXJSE_Value_SetFloat(FXJSE_HVALUE hValue, FX_FLOAT fFloat);
-void FXJSE_Value_SetDouble(FXJSE_HVALUE hValue, double dDouble);
-void FXJSE_Value_SetObject(FXJSE_HVALUE hValue,
+void FXJSE_Value_SetInteger(CFXJSE_Value* pValue, int32_t nInteger);
+void FXJSE_Value_SetFloat(CFXJSE_Value* pValue, FX_FLOAT fFloat);
+void FXJSE_Value_SetDouble(CFXJSE_Value* pValue, double dDouble);
+void FXJSE_Value_SetObject(CFXJSE_Value* pValue,
void* lpObject,
CFXJSE_Class* pClass);
-void FXJSE_Value_SetArray(FXJSE_HVALUE hValue,
+void FXJSE_Value_SetArray(CFXJSE_Value* pValue,
uint32_t uValueCount,
- FXJSE_HVALUE* rgValues);
-void FXJSE_Value_Set(FXJSE_HVALUE hValue, FXJSE_HVALUE hOriginalValue);
+ CFXJSE_Value** rgValues);
+void FXJSE_Value_Set(CFXJSE_Value* pValue, CFXJSE_Value* pOriginalValue);
-FX_BOOL FXJSE_Value_GetObjectProp(FXJSE_HVALUE hValue,
+FX_BOOL FXJSE_Value_GetObjectProp(CFXJSE_Value* pValue,
const CFX_ByteStringC& szPropName,
- FXJSE_HVALUE hPropValue);
-FX_BOOL FXJSE_Value_SetObjectProp(FXJSE_HVALUE hValue,
+ CFXJSE_Value* pPropValue);
+FX_BOOL FXJSE_Value_SetObjectProp(CFXJSE_Value* pValue,
const CFX_ByteStringC& szPropName,
- FXJSE_HVALUE hPropValue);
-FX_BOOL FXJSE_Value_GetObjectPropByIdx(FXJSE_HVALUE hValue,
+ CFXJSE_Value* pPropValue);
+FX_BOOL FXJSE_Value_GetObjectPropByIdx(CFXJSE_Value* pValue,
uint32_t uPropIdx,
- FXJSE_HVALUE hPropValue);
-FX_BOOL FXJSE_Value_DeleteObjectProp(FXJSE_HVALUE hValue,
+ CFXJSE_Value* pPropValue);
+FX_BOOL FXJSE_Value_DeleteObjectProp(CFXJSE_Value* pValue,
const CFX_ByteStringC& szPropName);
-FX_BOOL FXJSE_Value_ObjectHasOwnProp(FXJSE_HVALUE hValue,
+FX_BOOL FXJSE_Value_ObjectHasOwnProp(CFXJSE_Value* pValue,
const CFX_ByteStringC& szPropName,
FX_BOOL bUseTypeGetter);
-FX_BOOL FXJSE_Value_SetObjectOwnProp(FXJSE_HVALUE hValue,
+FX_BOOL FXJSE_Value_SetObjectOwnProp(CFXJSE_Value* pValue,
const CFX_ByteStringC& szPropName,
- FXJSE_HVALUE hPropValue);
+ CFXJSE_Value* pPropValue);
-FX_BOOL FXJSE_Value_SetFunctionBind(FXJSE_HVALUE hValue,
- FXJSE_HVALUE hOldFunction,
- FXJSE_HVALUE hNewThis);
+FX_BOOL FXJSE_Value_SetFunctionBind(CFXJSE_Value* pValue,
+ CFXJSE_Value* pOldFunction,
+ CFXJSE_Value* pNewThis);
FX_BOOL FXJSE_ExecuteScript(CFXJSE_Context* pContext,
const FX_CHAR* szScript,
- FXJSE_HVALUE hRetValue,
- FXJSE_HVALUE hNewThisObject = nullptr);
+ CFXJSE_Value* pRetValue,
+ CFXJSE_Value* pNewThisObject = nullptr);
void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name,
const CFX_ByteStringC& utf8Message);
diff --git a/xfa/fxjse/value.cpp b/xfa/fxjse/value.cpp
index a9f73b2755..e7a3463f28 100644
--- a/xfa/fxjse/value.cpp
+++ b/xfa/fxjse/value.cpp
@@ -11,193 +11,166 @@
#include "xfa/fxjse/class.h"
#include "xfa/fxjse/util_inline.h"
-FX_BOOL FXJSE_Value_IsUndefined(FXJSE_HVALUE hValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- return lpValue && lpValue->IsUndefined();
+FX_BOOL FXJSE_Value_IsUndefined(CFXJSE_Value* pValue) {
+ return pValue && pValue->IsUndefined();
}
-FX_BOOL FXJSE_Value_IsNull(FXJSE_HVALUE hValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- return lpValue && lpValue->IsNull();
+FX_BOOL FXJSE_Value_IsNull(CFXJSE_Value* pValue) {
+ return pValue && pValue->IsNull();
}
-FX_BOOL FXJSE_Value_IsBoolean(FXJSE_HVALUE hValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- return lpValue && lpValue->IsBoolean();
+FX_BOOL FXJSE_Value_IsBoolean(CFXJSE_Value* pValue) {
+ return pValue && pValue->IsBoolean();
}
-FX_BOOL FXJSE_Value_IsUTF8String(FXJSE_HVALUE hValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- return lpValue && lpValue->IsString();
+FX_BOOL FXJSE_Value_IsUTF8String(CFXJSE_Value* pValue) {
+ return pValue && pValue->IsString();
}
-FX_BOOL FXJSE_Value_IsNumber(FXJSE_HVALUE hValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- return lpValue && lpValue->IsNumber();
+FX_BOOL FXJSE_Value_IsNumber(CFXJSE_Value* pValue) {
+ return pValue && pValue->IsNumber();
}
-FX_BOOL FXJSE_Value_IsObject(FXJSE_HVALUE hValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- return lpValue && lpValue->IsObject();
+FX_BOOL FXJSE_Value_IsObject(CFXJSE_Value* pValue) {
+ return pValue && pValue->IsObject();
}
-FX_BOOL FXJSE_Value_IsArray(FXJSE_HVALUE hValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- return lpValue && lpValue->IsArray();
+FX_BOOL FXJSE_Value_IsArray(CFXJSE_Value* pValue) {
+ return pValue && pValue->IsArray();
}
-FX_BOOL FXJSE_Value_IsFunction(FXJSE_HVALUE hValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- return lpValue && lpValue->IsFunction();
+FX_BOOL FXJSE_Value_IsFunction(CFXJSE_Value* pValue) {
+ return pValue && pValue->IsFunction();
}
-FX_BOOL FXJSE_Value_ToBoolean(FXJSE_HVALUE hValue) {
- return reinterpret_cast<CFXJSE_Value*>(hValue)->ToBoolean();
+FX_BOOL FXJSE_Value_ToBoolean(CFXJSE_Value* pValue) {
+ return pValue->ToBoolean();
}
-FX_FLOAT FXJSE_Value_ToFloat(FXJSE_HVALUE hValue) {
- return reinterpret_cast<CFXJSE_Value*>(hValue)->ToFloat();
+FX_FLOAT FXJSE_Value_ToFloat(CFXJSE_Value* pValue) {
+ return pValue->ToFloat();
}
-double FXJSE_Value_ToDouble(FXJSE_HVALUE hValue) {
- return reinterpret_cast<CFXJSE_Value*>(hValue)->ToDouble();
+double FXJSE_Value_ToDouble(CFXJSE_Value* pValue) {
+ return pValue->ToDouble();
}
-void FXJSE_Value_ToUTF8String(FXJSE_HVALUE hValue,
+void FXJSE_Value_ToUTF8String(CFXJSE_Value* pValue,
CFX_ByteString& szStrOutput) {
- return reinterpret_cast<CFXJSE_Value*>(hValue)->ToString(szStrOutput);
+ pValue->ToString(szStrOutput);
}
-int32_t FXJSE_Value_ToInteger(FXJSE_HVALUE hValue) {
- return reinterpret_cast<CFXJSE_Value*>(hValue)->ToInteger();
+int32_t FXJSE_Value_ToInteger(CFXJSE_Value* pValue) {
+ return pValue->ToInteger();
}
-void* FXJSE_Value_ToObject(FXJSE_HVALUE hValue, CFXJSE_Class* pClass) {
- return reinterpret_cast<CFXJSE_Value*>(hValue)->ToObject(pClass);
+void* FXJSE_Value_ToObject(CFXJSE_Value* pValue, CFXJSE_Class* pClass) {
+ return pValue->ToObject(pClass);
}
-void FXJSE_Value_SetUndefined(FXJSE_HVALUE hValue) {
- reinterpret_cast<CFXJSE_Value*>(hValue)->SetUndefined();
+void FXJSE_Value_SetUndefined(CFXJSE_Value* pValue) {
+ pValue->SetUndefined();
}
-void FXJSE_Value_SetNull(FXJSE_HVALUE hValue) {
- reinterpret_cast<CFXJSE_Value*>(hValue)->SetNull();
+void FXJSE_Value_SetNull(CFXJSE_Value* pValue) {
+ pValue->SetNull();
}
-void FXJSE_Value_SetBoolean(FXJSE_HVALUE hValue, FX_BOOL bBoolean) {
- reinterpret_cast<CFXJSE_Value*>(hValue)->SetBoolean(bBoolean);
+void FXJSE_Value_SetBoolean(CFXJSE_Value* pValue, FX_BOOL bBoolean) {
+ pValue->SetBoolean(bBoolean);
}
-void FXJSE_Value_SetUTF8String(FXJSE_HVALUE hValue,
+void FXJSE_Value_SetUTF8String(CFXJSE_Value* pValue,
const CFX_ByteStringC& szString) {
- reinterpret_cast<CFXJSE_Value*>(hValue)->SetString(szString);
+ pValue->SetString(szString);
}
-void FXJSE_Value_SetInteger(FXJSE_HVALUE hValue, int32_t nInteger) {
- reinterpret_cast<CFXJSE_Value*>(hValue)->SetInteger(nInteger);
+void FXJSE_Value_SetInteger(CFXJSE_Value* pValue, int32_t nInteger) {
+ pValue->SetInteger(nInteger);
}
-void FXJSE_Value_SetFloat(FXJSE_HVALUE hValue, FX_FLOAT fFloat) {
- reinterpret_cast<CFXJSE_Value*>(hValue)->SetFloat(fFloat);
+void FXJSE_Value_SetFloat(CFXJSE_Value* pValue, FX_FLOAT fFloat) {
+ pValue->SetFloat(fFloat);
}
-void FXJSE_Value_SetDouble(FXJSE_HVALUE hValue, double dDouble) {
- reinterpret_cast<CFXJSE_Value*>(hValue)->SetDouble(dDouble);
+void FXJSE_Value_SetDouble(CFXJSE_Value* pValue, double dDouble) {
+ pValue->SetDouble(dDouble);
}
-void FXJSE_Value_SetObject(FXJSE_HVALUE hValue,
+void FXJSE_Value_SetObject(CFXJSE_Value* pValue,
void* lpObject,
CFXJSE_Class* pClass) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
if (!pClass) {
ASSERT(!lpObject);
- lpValue->SetJSObject();
+ pValue->SetJSObject();
} else {
- lpValue->SetHostObject(lpObject, pClass);
+ pValue->SetHostObject(lpObject, pClass);
}
}
-void FXJSE_Value_SetArray(FXJSE_HVALUE hValue,
+void FXJSE_Value_SetArray(CFXJSE_Value* pValue,
uint32_t uValueCount,
- FXJSE_HVALUE* rgValues) {
- reinterpret_cast<CFXJSE_Value*>(hValue)
- ->SetArray(uValueCount, reinterpret_cast<CFXJSE_Value**>(rgValues));
+ CFXJSE_Value** rgValues) {
+ pValue->SetArray(uValueCount, rgValues);
}
-void FXJSE_Value_Set(FXJSE_HVALUE hValue, FXJSE_HVALUE hOriginalValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- CFXJSE_Value* lpOriginalValue =
- reinterpret_cast<CFXJSE_Value*>(hOriginalValue);
- ASSERT(lpValue && lpOriginalValue);
- lpValue->Assign(lpOriginalValue);
+void FXJSE_Value_Set(CFXJSE_Value* pValue, CFXJSE_Value* pOriginalValue) {
+ ASSERT(pOriginalValue);
+ pValue->Assign(pOriginalValue);
}
-FX_BOOL FXJSE_Value_GetObjectProp(FXJSE_HVALUE hValue,
+FX_BOOL FXJSE_Value_GetObjectProp(CFXJSE_Value* pValue,
const CFX_ByteStringC& szPropName,
- FXJSE_HVALUE hPropValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- CFXJSE_Value* lpPropValue = reinterpret_cast<CFXJSE_Value*>(hPropValue);
- ASSERT(lpValue && lpPropValue);
- return lpValue->GetObjectProperty(szPropName, lpPropValue);
+ CFXJSE_Value* pPropValue) {
+ ASSERT(pPropValue);
+ return pValue->GetObjectProperty(szPropName, pPropValue);
}
-FX_BOOL FXJSE_Value_SetObjectProp(FXJSE_HVALUE hValue,
+FX_BOOL FXJSE_Value_SetObjectProp(CFXJSE_Value* pValue,
const CFX_ByteStringC& szPropName,
- FXJSE_HVALUE hPropValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- CFXJSE_Value* lpPropValue = reinterpret_cast<CFXJSE_Value*>(hPropValue);
- ASSERT(lpValue && lpPropValue);
- return lpValue->SetObjectProperty(szPropName, lpPropValue);
+ CFXJSE_Value* pPropValue) {
+ ASSERT(pPropValue);
+ return pValue->SetObjectProperty(szPropName, pPropValue);
}
-FX_BOOL FXJSE_Value_GetObjectPropByIdx(FXJSE_HVALUE hValue,
+FX_BOOL FXJSE_Value_GetObjectPropByIdx(CFXJSE_Value* pValue,
uint32_t uPropIdx,
- FXJSE_HVALUE hPropValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- CFXJSE_Value* lpPropValue = reinterpret_cast<CFXJSE_Value*>(hPropValue);
- ASSERT(lpValue && lpPropValue);
- return lpValue->GetObjectProperty(uPropIdx, lpPropValue);
+ CFXJSE_Value* pPropValue) {
+ ASSERT(pPropValue);
+ return pValue->GetObjectProperty(uPropIdx, pPropValue);
}
-FX_BOOL FXJSE_Value_DeleteObjectProp(FXJSE_HVALUE hValue,
+FX_BOOL FXJSE_Value_DeleteObjectProp(CFXJSE_Value* pValue,
const CFX_ByteStringC& szPropName) {
- return reinterpret_cast<CFXJSE_Value*>(hValue)
- ->DeleteObjectProperty(szPropName);
+ return pValue->DeleteObjectProperty(szPropName);
}
-FX_BOOL FXJSE_Value_ObjectHasOwnProp(FXJSE_HVALUE hValue,
+FX_BOOL FXJSE_Value_ObjectHasOwnProp(CFXJSE_Value* pValue,
const CFX_ByteStringC& szPropName,
FX_BOOL bUseTypeGetter) {
- return reinterpret_cast<CFXJSE_Value*>(hValue)
- ->HasObjectOwnProperty(szPropName, bUseTypeGetter);
+ return pValue->HasObjectOwnProperty(szPropName, bUseTypeGetter);
}
-FX_BOOL FXJSE_Value_SetObjectOwnProp(FXJSE_HVALUE hValue,
+FX_BOOL FXJSE_Value_SetObjectOwnProp(CFXJSE_Value* pValue,
const CFX_ByteStringC& szPropName,
- FXJSE_HVALUE hPropValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- CFXJSE_Value* lpPropValue = reinterpret_cast<CFXJSE_Value*>(hPropValue);
- ASSERT(lpValue && lpPropValue);
- return lpValue->SetObjectOwnProperty(szPropName, lpPropValue);
+ CFXJSE_Value* pPropValue) {
+ ASSERT(pPropValue);
+ return pValue->SetObjectOwnProperty(szPropName, pPropValue);
}
-FX_BOOL FXJSE_Value_SetFunctionBind(FXJSE_HVALUE hValue,
- FXJSE_HVALUE hOldFunction,
- FXJSE_HVALUE hNewThis) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- CFXJSE_Value* lpOldFunction = reinterpret_cast<CFXJSE_Value*>(hOldFunction);
- CFXJSE_Value* lpNewThis = reinterpret_cast<CFXJSE_Value*>(hNewThis);
- ASSERT(lpValue && lpOldFunction && lpNewThis);
- return lpValue->SetFunctionBind(lpOldFunction, lpNewThis);
+FX_BOOL FXJSE_Value_SetFunctionBind(CFXJSE_Value* pValue,
+ CFXJSE_Value* pOldFunction,
+ CFXJSE_Value* pNewThis) {
+ ASSERT(pOldFunction && pNewThis);
+ return pValue->SetFunctionBind(pOldFunction, pNewThis);
}
-FXJSE_HVALUE FXJSE_Value_Create(v8::Isolate* pIsolate) {
- return reinterpret_cast<FXJSE_HVALUE>(CFXJSE_Value::Create(pIsolate));
+CFXJSE_Value* FXJSE_Value_Create(v8::Isolate* pIsolate) {
+ return CFXJSE_Value::Create(pIsolate);
}
-void FXJSE_Value_Release(FXJSE_HVALUE hValue) {
- CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
- delete lpValue;
+void FXJSE_Value_Release(CFXJSE_Value* pValue) {
+ delete pValue;
}
void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name,
@@ -240,13 +213,13 @@ void* CFXJSE_Value::ToObject(CFXJSE_Class* lpClass) const {
ASSERT(!m_hValue.IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
- v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
- ASSERT(!hValue.IsEmpty());
+ v8::Local<v8::Value> pValue = v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
+ ASSERT(!pValue.IsEmpty());
- if (!hValue->IsObject())
+ if (!pValue->IsObject())
return nullptr;
- return FXJSE_RetrieveObjectBinding(hValue.As<v8::Object>(), lpClass);
+ return FXJSE_RetrieveObjectBinding(pValue.As<v8::Object>(), lpClass);
}
V8_INLINE static double FXJSE_ftod(FX_FLOAT fNumber) {
@@ -291,8 +264,8 @@ V8_INLINE static double FXJSE_ftod(FX_FLOAT fNumber) {
void CFXJSE_Value::SetFloat(FX_FLOAT fFloat) {
CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate);
- v8::Local<v8::Value> hValue = v8::Number::New(m_pIsolate, FXJSE_ftod(fFloat));
- m_hValue.Reset(m_pIsolate, hValue);
+ v8::Local<v8::Value> pValue = v8::Number::New(m_pIsolate, FXJSE_ftod(fFloat));
+ m_hValue.Reset(m_pIsolate, pValue);
}
void CFXJSE_Value::SetHostObject(void* lpObject, CFXJSE_Class* lpClass) {
@@ -423,7 +396,7 @@ FX_BOOL CFXJSE_Value::SetObjectOwnProperty(const CFX_ByteStringC& szPropName,
if (!hObject->IsObject())
return FALSE;
- v8::Local<v8::Value> hValue =
+ v8::Local<v8::Value> pValue =
v8::Local<v8::Value>::New(m_pIsolate, lpPropValue->m_hValue);
return hObject.As<v8::Object>()
->DefineOwnProperty(
@@ -431,7 +404,7 @@ FX_BOOL CFXJSE_Value::SetObjectOwnProperty(const CFX_ByteStringC& szPropName,
v8::String::NewFromUtf8(m_pIsolate, szPropName.c_str(),
v8::String::kNormalString,
szPropName.GetLength()),
- hValue)
+ pValue)
.FromMaybe(false);
}
@@ -470,7 +443,7 @@ FX_BOOL CFXJSE_Value::SetFunctionBind(CFXJSE_Value* lpOldFunction,
FX_BOOL CFXJSE_Value::Call(CFXJSE_Value* lpReceiver,
CFXJSE_Value* lpRetValue,
uint32_t nArgCount,
- FXJSE_HVALUE* lpArgs) {
+ CFXJSE_Value** lpArgs) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hFunctionValue =
v8::Local<v8::Value>::New(m_pIsolate, DirectGetValue());
@@ -492,7 +465,7 @@ FX_BOOL CFXJSE_Value::Call(CFXJSE_Value* lpReceiver,
lpLocalArgs = FX_Alloc(v8::Local<v8::Value>, nArgCount);
for (uint32_t i = 0; i < nArgCount; i++) {
new (lpLocalArgs + i) v8::Local<v8::Value>;
- CFXJSE_Value* lpArg = (CFXJSE_Value*)lpArgs[i];
+ CFXJSE_Value* lpArg = lpArgs[i];
if (lpArg) {
lpLocalArgs[i] =
v8::Local<v8::Value>::New(m_pIsolate, lpArg->DirectGetValue());
diff --git a/xfa/fxjse/value.h b/xfa/fxjse/value.h
index 576d092bce..65b5fa8e3d 100644
--- a/xfa/fxjse/value.h
+++ b/xfa/fxjse/value.h
@@ -201,7 +201,7 @@ class CFXJSE_Value {
FX_BOOL Call(CFXJSE_Value* lpReceiver,
CFXJSE_Value* lpRetValue,
uint32_t nArgCount,
- FXJSE_HVALUE* lpArgs);
+ CFXJSE_Value** lpArgs);
V8_INLINE v8::Isolate* GetIsolate() const { return m_pIsolate; }
V8_INLINE const v8::Global<v8::Value>& DirectGetValue() const {