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/fxjse/cfxjse_arguments.h | 2 +- xfa/fxjse/class.cpp | 5 ++--- xfa/fxjse/context.cpp | 6 +++--- xfa/fxjse/include/fxjse.h | 10 +++++----- xfa/fxjse/runtime.cpp | 7 +++---- xfa/fxjse/value.cpp | 5 ++--- 6 files changed, 16 insertions(+), 19 deletions(-) (limited to 'xfa/fxjse') diff --git a/xfa/fxjse/cfxjse_arguments.h b/xfa/fxjse/cfxjse_arguments.h index b38d0772c0..423e22d888 100644 --- a/xfa/fxjse/cfxjse_arguments.h +++ b/xfa/fxjse/cfxjse_arguments.h @@ -11,7 +11,7 @@ class CFXJSE_Arguments { public: - FXJSE_HRUNTIME GetRuntime() const; + v8::Isolate* GetRuntime() const; int32_t GetLength() const; FXJSE_HVALUE GetValue(int32_t index) const; FX_BOOL GetBoolean(int32_t index) const; diff --git a/xfa/fxjse/class.cpp b/xfa/fxjse/class.cpp index d5c9b2debc..ff5990aa85 100644 --- a/xfa/fxjse/class.cpp +++ b/xfa/fxjse/class.cpp @@ -136,11 +136,10 @@ static void FXJSE_V8ConstructorCallback_Wrapper( info.This()->SetAlignedPointerInInternalField(0, NULL); } -FXJSE_HRUNTIME CFXJSE_Arguments::GetRuntime() const { +v8::Isolate* CFXJSE_Arguments::GetRuntime() const { const CFXJSE_ArgumentsImpl* lpArguments = reinterpret_cast(this); - return reinterpret_cast( - lpArguments->m_pRetValue->GetIsolate()); + return lpArguments->m_pRetValue->GetIsolate(); } int32_t CFXJSE_Arguments::GetLength() const { diff --git a/xfa/fxjse/context.cpp b/xfa/fxjse/context.cpp index 9d478295d6..b125177617 100644 --- a/xfa/fxjse/context.cpp +++ b/xfa/fxjse/context.cpp @@ -19,11 +19,11 @@ CFXJSE_Context* CFXContextFromHContext(FXJSE_HCONTEXT hContext) { } // namespace -FXJSE_HCONTEXT FXJSE_Context_Create(FXJSE_HRUNTIME hRuntime, +FXJSE_HCONTEXT FXJSE_Context_Create(v8::Isolate* pIsolate, const FXJSE_CLASS* lpGlobalClass, void* lpGlobalObject) { - CFXJSE_Context* pContext = CFXJSE_Context::Create( - reinterpret_cast(hRuntime), lpGlobalClass, lpGlobalObject); + CFXJSE_Context* pContext = + CFXJSE_Context::Create(pIsolate, lpGlobalClass, lpGlobalObject); return reinterpret_cast(pContext); } diff --git a/xfa/fxjse/include/fxjse.h b/xfa/fxjse/include/fxjse.h index a93c3716a0..d009372c54 100644 --- a/xfa/fxjse/include/fxjse.h +++ b/xfa/fxjse/include/fxjse.h @@ -9,11 +9,11 @@ #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" +#include "v8/include/v8.h" struct FXJSE_CLASS; class CFXJSE_Arguments; -typedef struct FXJSE_HRUNTIME_ { void* pData; } * FXJSE_HRUNTIME; typedef struct FXJSE_HCONTEXT_ { void* pData; } * FXJSE_HCONTEXT; typedef struct FXJSE_HCLASS_ { void* pData; } * FXJSE_HCLASS; typedef struct FXJSE_HVALUE_ { void* pData; } * FXJSE_HVALUE; @@ -71,10 +71,10 @@ struct FXJSE_CLASS { void FXJSE_Initialize(); void FXJSE_Finalize(); -FXJSE_HRUNTIME FXJSE_Runtime_Create(); -void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime, bool bOwnedRuntime); +v8::Isolate* FXJSE_Runtime_Create(); +void FXJSE_Runtime_Release(v8::Isolate* pIsolate, bool bOwnedRuntime); -FXJSE_HCONTEXT FXJSE_Context_Create(FXJSE_HRUNTIME hRuntime, +FXJSE_HCONTEXT FXJSE_Context_Create(v8::Isolate* pIsolate, const FXJSE_CLASS* lpGlobalClass = nullptr, void* lpGlobalObject = nullptr); void FXJSE_Context_Release(FXJSE_HCONTEXT hContext); @@ -86,7 +86,7 @@ void FXJSE_Context_EnableCompatibleMode(FXJSE_HCONTEXT hContext, FXJSE_HCLASS FXJSE_DefineClass(FXJSE_HCONTEXT hContext, const FXJSE_CLASS* lpClass); -FXJSE_HVALUE FXJSE_Value_Create(FXJSE_HRUNTIME hRuntime); +FXJSE_HVALUE FXJSE_Value_Create(v8::Isolate* pIsolate); void FXJSE_Value_Release(FXJSE_HVALUE hValue); FX_BOOL FXJSE_Value_IsUndefined(FXJSE_HVALUE hValue); diff --git a/xfa/fxjse/runtime.cpp b/xfa/fxjse/runtime.cpp index 1ee6c18599..64d685bd5f 100644 --- a/xfa/fxjse/runtime.cpp +++ b/xfa/fxjse/runtime.cpp @@ -55,17 +55,16 @@ void FXJSE_Finalize() { } } -FXJSE_HRUNTIME FXJSE_Runtime_Create() { +v8::Isolate* FXJSE_Runtime_Create() { v8::Isolate::CreateParams params; params.array_buffer_allocator = new FXJSE_ArrayBufferAllocator(); v8::Isolate* pIsolate = v8::Isolate::New(params); ASSERT(pIsolate && CFXJSE_RuntimeData::g_RuntimeList); CFXJSE_RuntimeData::g_RuntimeList->AppendRuntime(pIsolate); - return reinterpret_cast(pIsolate); + return pIsolate; } -void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime, bool bOwnedRuntime) { - v8::Isolate* pIsolate = reinterpret_cast(hRuntime); +void FXJSE_Runtime_Release(v8::Isolate* pIsolate, bool bOwnedRuntime) { if (!pIsolate) return; if (bOwnedRuntime) { diff --git a/xfa/fxjse/value.cpp b/xfa/fxjse/value.cpp index dd07b6cbb8..c23e12c32f 100644 --- a/xfa/fxjse/value.cpp +++ b/xfa/fxjse/value.cpp @@ -193,9 +193,8 @@ FX_BOOL FXJSE_Value_SetFunctionBind(FXJSE_HVALUE hValue, return lpValue->SetFunctionBind(lpOldFunction, lpNewThis); } -FXJSE_HVALUE FXJSE_Value_Create(FXJSE_HRUNTIME hRuntime) { - return reinterpret_cast( - CFXJSE_Value::Create(reinterpret_cast(hRuntime))); +FXJSE_HVALUE FXJSE_Value_Create(v8::Isolate* pIsolate) { + return reinterpret_cast(CFXJSE_Value::Create(pIsolate)); } void FXJSE_Value_Release(FXJSE_HVALUE hValue) { -- cgit v1.2.3