From e9885e77a7daf7a8d45eaf0290a1ea5f208c24c6 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 26 May 2016 10:14:00 -0700 Subject: Replace FXJSE_HCLASS with CFXJSE_Class* This CL removes FXJSE_HCLASS and replaces with CFXJSE_Class*. All variables have been updated to the new type. Review-Url: https://codereview.chromium.org/2014213002 --- xfa/fxjse/cfxjse_arguments.h | 2 +- xfa/fxjse/class.cpp | 12 +++++------- xfa/fxjse/include/fxjse.h | 10 +++++----- xfa/fxjse/value.cpp | 12 +++++------- 4 files changed, 16 insertions(+), 20 deletions(-) (limited to 'xfa/fxjse') diff --git a/xfa/fxjse/cfxjse_arguments.h b/xfa/fxjse/cfxjse_arguments.h index 423e22d888..d86ec0f1f8 100644 --- a/xfa/fxjse/cfxjse_arguments.h +++ b/xfa/fxjse/cfxjse_arguments.h @@ -18,7 +18,7 @@ class CFXJSE_Arguments { 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, FXJSE_HCLASS hClass = nullptr) const; + void* GetObject(int32_t index, CFXJSE_Class* hClass = nullptr) const; FXJSE_HVALUE GetReturnValue(); }; diff --git a/xfa/fxjse/class.cpp b/xfa/fxjse/class.cpp index b7637455fd..6d0a719821 100644 --- a/xfa/fxjse/class.cpp +++ b/xfa/fxjse/class.cpp @@ -24,11 +24,10 @@ static void FXJSE_V8SetterCallback_Wrapper( v8::Local value, const v8::PropertyCallbackInfo& info); -FXJSE_HCLASS FXJSE_DefineClass(CFXJSE_Context* pContext, - const FXJSE_CLASS* lpClass) { +CFXJSE_Class* FXJSE_DefineClass(CFXJSE_Context* pContext, + const FXJSE_CLASS* lpClass) { ASSERT(pContext); - return reinterpret_cast( - CFXJSE_Class::Create(pContext, lpClass, FALSE)); + return CFXJSE_Class::Create(pContext, lpClass, FALSE); } static void FXJSE_V8FunctionCallback_Wrapper( @@ -182,7 +181,7 @@ CFX_ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const { return CFX_ByteString(*szStringVal); } -void* CFXJSE_Arguments::GetObject(int32_t index, FXJSE_HCLASS hClass) const { +void* CFXJSE_Arguments::GetObject(int32_t index, CFXJSE_Class* pClass) const { const CFXJSE_ArgumentsImpl* lpArguments = reinterpret_cast(this); v8::Local hValue = (*lpArguments->m_pInfo)[index]; @@ -190,8 +189,7 @@ void* CFXJSE_Arguments::GetObject(int32_t index, FXJSE_HCLASS hClass) const { if (!hValue->IsObject()) { return NULL; } - CFXJSE_Class* lpClass = reinterpret_cast(hClass); - return FXJSE_RetrieveObjectBinding(hValue.As(), lpClass); + return FXJSE_RetrieveObjectBinding(hValue.As(), pClass); } FXJSE_HVALUE CFXJSE_Arguments::GetReturnValue() { diff --git a/xfa/fxjse/include/fxjse.h b/xfa/fxjse/include/fxjse.h index 207d86e68c..5cf2d2abb7 100644 --- a/xfa/fxjse/include/fxjse.h +++ b/xfa/fxjse/include/fxjse.h @@ -12,9 +12,9 @@ #include "v8/include/v8.h" class CFXJSE_Arguments; +class CFXJSE_Class; class CFXJSE_Context; -typedef struct FXJSE_HCLASS_ { void* pData; } * FXJSE_HCLASS; typedef struct FXJSE_HVALUE_ { void* pData; } * FXJSE_HVALUE; // NOLINTNEXTLINE typedef struct FXJSE_HOBJECT_ : public FXJSE_HVALUE_{} * FXJSE_HOBJECT; @@ -82,8 +82,8 @@ FXJSE_HVALUE FXJSE_Context_GetGlobalObject(CFXJSE_Context* pContext); void FXJSE_Context_EnableCompatibleMode(CFXJSE_Context* pContext, uint32_t dwCompatibleFlags); -FXJSE_HCLASS FXJSE_DefineClass(CFXJSE_Context* pContext, - const FXJSE_CLASS* lpClass); +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); @@ -102,7 +102,7 @@ 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, FXJSE_HCLASS hClass); +void* FXJSE_Value_ToObject(FXJSE_HVALUE hValue, CFXJSE_Class* hClass); void FXJSE_Value_SetUndefined(FXJSE_HVALUE hValue); void FXJSE_Value_SetNull(FXJSE_HVALUE hValue); @@ -114,7 +114,7 @@ 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* lpObject, - FXJSE_HCLASS hClass); + CFXJSE_Class* pClass); void FXJSE_Value_SetArray(FXJSE_HVALUE hValue, uint32_t uValueCount, FXJSE_HVALUE* rgValues); diff --git a/xfa/fxjse/value.cpp b/xfa/fxjse/value.cpp index c23e12c32f..a9f73b2755 100644 --- a/xfa/fxjse/value.cpp +++ b/xfa/fxjse/value.cpp @@ -72,9 +72,8 @@ int32_t FXJSE_Value_ToInteger(FXJSE_HVALUE hValue) { return reinterpret_cast(hValue)->ToInteger(); } -void* FXJSE_Value_ToObject(FXJSE_HVALUE hValue, FXJSE_HCLASS hClass) { - CFXJSE_Class* lpClass = reinterpret_cast(hClass); - return reinterpret_cast(hValue)->ToObject(lpClass); +void* FXJSE_Value_ToObject(FXJSE_HVALUE hValue, CFXJSE_Class* pClass) { + return reinterpret_cast(hValue)->ToObject(pClass); } void FXJSE_Value_SetUndefined(FXJSE_HVALUE hValue) { @@ -108,14 +107,13 @@ void FXJSE_Value_SetDouble(FXJSE_HVALUE hValue, double dDouble) { void FXJSE_Value_SetObject(FXJSE_HVALUE hValue, void* lpObject, - FXJSE_HCLASS hClass) { + CFXJSE_Class* pClass) { CFXJSE_Value* lpValue = reinterpret_cast(hValue); - CFXJSE_Class* lpClass = reinterpret_cast(hClass); - if (!lpClass) { + if (!pClass) { ASSERT(!lpObject); lpValue->SetJSObject(); } else { - lpValue->SetHostObject(lpObject, lpClass); + lpValue->SetHostObject(lpObject, pClass); } } -- cgit v1.2.3