From 0582ad18b1e7ab9e404b7f8071a015ec756f5afe Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 19 Apr 2016 05:53:40 -0700 Subject: XFA unused function cleanup This CL removes a series of unused XFA methods. Review URL: https://codereview.chromium.org/1899103002 --- xfa/fxjse/class.cpp | 29 -------------------------- xfa/fxjse/context.cpp | 52 ----------------------------------------------- xfa/fxjse/include/fxjse.h | 25 ----------------------- xfa/fxjse/value.cpp | 39 ----------------------------------- 4 files changed, 145 deletions(-) (limited to 'xfa/fxjse') diff --git a/xfa/fxjse/class.cpp b/xfa/fxjse/class.cpp index 29a8077bd0..181398c630 100644 --- a/xfa/fxjse/class.cpp +++ b/xfa/fxjse/class.cpp @@ -24,29 +24,6 @@ static void FXJSE_V8SetterCallback_Wrapper( v8::Local value, const v8::PropertyCallbackInfo& info); -void FXJSE_DefineFunctions(FXJSE_HCONTEXT hContext, - const FXJSE_FUNCTION* lpFunctions, - int nNum) { - CFXJSE_Context* lpContext = reinterpret_cast(hContext); - ASSERT(lpContext); - CFXJSE_ScopeUtil_IsolateHandleContext scope(lpContext); - v8::Isolate* pIsolate = lpContext->GetRuntime(); - v8::Local hGlobalObject = - FXJSE_GetGlobalObjectFromContext(scope.GetLocalContext()); - for (int32_t i = 0; i < nNum; i++) { - v8::Maybe maybe_success = hGlobalObject->DefineOwnProperty( - scope.GetLocalContext(), - v8::String::NewFromUtf8(pIsolate, lpFunctions[i].name), - v8::Function::New( - pIsolate, FXJSE_V8FunctionCallback_Wrapper, - v8::External::New(pIsolate, - const_cast(lpFunctions + i))), - static_cast(v8::ReadOnly | v8::DontDelete)); - if (!maybe_success.FromMaybe(false)) - return; - } -} - FXJSE_HCLASS FXJSE_DefineClass(FXJSE_HCONTEXT hContext, const FXJSE_CLASS* lpClass) { CFXJSE_Context* lpContext = reinterpret_cast(hContext); @@ -55,12 +32,6 @@ FXJSE_HCLASS FXJSE_DefineClass(FXJSE_HCONTEXT hContext, CFXJSE_Class::Create(lpContext, lpClass, FALSE)); } -FXJSE_HCLASS FXJSE_GetClass(FXJSE_HCONTEXT hContext, - const CFX_ByteStringC& szName) { - return reinterpret_cast(CFXJSE_Class::GetClassFromContext( - reinterpret_cast(hContext), szName)); -} - static void FXJSE_V8FunctionCallback_Wrapper( const v8::FunctionCallbackInfo& info) { const FXJSE_FUNCTION* lpFunctionInfo = diff --git a/xfa/fxjse/context.cpp b/xfa/fxjse/context.cpp index 83af487632..abb30c5dc5 100644 --- a/xfa/fxjse/context.cpp +++ b/xfa/fxjse/context.cpp @@ -37,12 +37,6 @@ FXJSE_HVALUE FXJSE_Context_GetGlobalObject(FXJSE_HCONTEXT hContext) { return reinterpret_cast(lpValue); } -FXJSE_HRUNTIME FXJSE_Context_GetRuntime(FXJSE_HCONTEXT hContext) { - CFXJSE_Context* pContext = reinterpret_cast(hContext); - return pContext ? reinterpret_cast(pContext->GetRuntime()) - : NULL; -} - static const FX_CHAR* szCompatibleModeScripts[] = { "(function(global, list) {\n" " 'use strict';\n" @@ -127,52 +121,6 @@ v8::Local FXJSE_CreateReturnValue(v8::Isolate* pIsolate, return hReturnValue; } -FX_BOOL FXJSE_ReturnValue_GetMessage(FXJSE_HVALUE hRetValue, - CFX_ByteString& utf8Name, - CFX_ByteString& utf8Message) { - CFXJSE_Value* lpValue = reinterpret_cast(hRetValue); - if (!lpValue) { - return FALSE; - } - v8::Isolate* pIsolate = lpValue->GetIsolate(); - CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); - v8::Local hValue = - v8::Local::New(pIsolate, lpValue->DirectGetValue()); - if (!hValue->IsObject()) { - return FALSE; - } - v8::String::Utf8Value hStringVal0( - hValue.As()->Get(0)->ToString()); - utf8Name = *hStringVal0; - v8::String::Utf8Value hStringVal1( - hValue.As()->Get(1)->ToString()); - utf8Message = *hStringVal1; - return TRUE; -} - -FX_BOOL FXJSE_ReturnValue_GetLineInfo(FXJSE_HVALUE hRetValue, - int32_t& nLine, - int32_t& nCol) { - CFXJSE_Value* lpValue = reinterpret_cast(hRetValue); - if (!lpValue) { - return FALSE; - } - v8::Isolate* pIsolate = lpValue->GetIsolate(); - CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); - v8::Local hValue = - v8::Local::New(pIsolate, lpValue->DirectGetValue()); - if (!hValue->IsObject()) { - return FALSE; - } - v8::MaybeLocal maybe_int = - hValue.As()->Get(3)->ToInt32(pIsolate->GetCurrentContext()); - nLine = maybe_int.FromMaybe(v8::Local())->Value(); - maybe_int = - hValue.As()->Get(5)->ToInt32(pIsolate->GetCurrentContext()); - nCol = maybe_int.FromMaybe(v8::Local())->Value(); - return TRUE; -} - CFXJSE_Context* CFXJSE_Context::Create(v8::Isolate* pIsolate, const FXJSE_CLASS* lpGlobalClass, void* lpGlobalObject) { diff --git a/xfa/fxjse/include/fxjse.h b/xfa/fxjse/include/fxjse.h index 54901704be..a93c3716a0 100644 --- a/xfa/fxjse/include/fxjse.h +++ b/xfa/fxjse/include/fxjse.h @@ -79,33 +79,24 @@ FXJSE_HCONTEXT FXJSE_Context_Create(FXJSE_HRUNTIME hRuntime, void* lpGlobalObject = nullptr); void FXJSE_Context_Release(FXJSE_HCONTEXT hContext); FXJSE_HVALUE FXJSE_Context_GetGlobalObject(FXJSE_HCONTEXT hContext); -FXJSE_HRUNTIME FXJSE_Context_GetRuntime(FXJSE_HCONTEXT hContext); void FXJSE_Context_EnableCompatibleMode(FXJSE_HCONTEXT hContext, uint32_t dwCompatibleFlags); -void FXJSE_DefineFunctions(FXJSE_HCONTEXT hContext, - const FXJSE_FUNCTION* lpFunctions, - int nNum); FXJSE_HCLASS FXJSE_DefineClass(FXJSE_HCONTEXT hContext, const FXJSE_CLASS* lpClass); -FXJSE_HCLASS FXJSE_GetClass(FXJSE_HCONTEXT hContext, - const CFX_ByteStringC& szName); FXJSE_HVALUE FXJSE_Value_Create(FXJSE_HRUNTIME hRuntime); void FXJSE_Value_Release(FXJSE_HVALUE hValue); -FXJSE_HRUNTIME FXJSE_Value_GetRuntime(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_IsInteger(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_IsDate(FXJSE_HVALUE hValue); FX_BOOL FXJSE_Value_ToBoolean(FXJSE_HVALUE hValue); FX_FLOAT FXJSE_Value_ToFloat(FXJSE_HVALUE hValue); @@ -128,7 +119,6 @@ void FXJSE_Value_SetObject(FXJSE_HVALUE hValue, void FXJSE_Value_SetArray(FXJSE_HVALUE hValue, uint32_t uValueCount, FXJSE_HVALUE* rgValues); -void FXJSE_Value_SetDate(FXJSE_HVALUE hValue, double dDouble); void FXJSE_Value_Set(FXJSE_HVALUE hValue, FXJSE_HVALUE hOriginalValue); FX_BOOL FXJSE_Value_GetObjectProp(FXJSE_HVALUE hValue, @@ -140,9 +130,6 @@ FX_BOOL FXJSE_Value_SetObjectProp(FXJSE_HVALUE hValue, FX_BOOL FXJSE_Value_GetObjectPropByIdx(FXJSE_HVALUE hValue, uint32_t uPropIdx, FXJSE_HVALUE hPropValue); -FX_BOOL FXJSE_Value_SetObjectPropByIdx(FXJSE_HVALUE hValue, - uint32_t uPropIdx, - FXJSE_HVALUE hPropValue); FX_BOOL FXJSE_Value_DeleteObjectProp(FXJSE_HVALUE hValue, const CFX_ByteStringC& szPropName); FX_BOOL FXJSE_Value_ObjectHasOwnProp(FXJSE_HVALUE hValue, @@ -152,11 +139,6 @@ FX_BOOL FXJSE_Value_SetObjectOwnProp(FXJSE_HVALUE hValue, const CFX_ByteStringC& szPropName, FXJSE_HVALUE hPropValue); -FX_BOOL FXJSE_Value_CallFunction(FXJSE_HVALUE hFunction, - FXJSE_HVALUE hThis, - FXJSE_HVALUE hRetValue, - uint32_t nArgCount, - FXJSE_HVALUE* lpArgs); FX_BOOL FXJSE_Value_SetFunctionBind(FXJSE_HVALUE hValue, FXJSE_HVALUE hOldFunction, FXJSE_HVALUE hNewThis); @@ -169,11 +151,4 @@ FX_BOOL FXJSE_ExecuteScript(FXJSE_HCONTEXT hContext, void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name, const CFX_ByteStringC& utf8Message); -FX_BOOL FXJSE_ReturnValue_GetMessage(FXJSE_HVALUE hRetValue, - CFX_ByteString& utf8Name, - CFX_ByteString& utf8Message); -FX_BOOL FXJSE_ReturnValue_GetLineInfo(FXJSE_HVALUE hRetValue, - int32_t& nLine, - int32_t& nCol); - #endif // XFA_FXJSE_INCLUDE_FXJSE_H_ diff --git a/xfa/fxjse/value.cpp b/xfa/fxjse/value.cpp index cd3220a17a..dd07b6cbb8 100644 --- a/xfa/fxjse/value.cpp +++ b/xfa/fxjse/value.cpp @@ -36,11 +36,6 @@ FX_BOOL FXJSE_Value_IsNumber(FXJSE_HVALUE hValue) { return lpValue && lpValue->IsNumber(); } -FX_BOOL FXJSE_Value_IsInteger(FXJSE_HVALUE hValue) { - CFXJSE_Value* lpValue = reinterpret_cast(hValue); - return lpValue && lpValue->IsInteger(); -} - FX_BOOL FXJSE_Value_IsObject(FXJSE_HVALUE hValue) { CFXJSE_Value* lpValue = reinterpret_cast(hValue); return lpValue && lpValue->IsObject(); @@ -56,11 +51,6 @@ FX_BOOL FXJSE_Value_IsFunction(FXJSE_HVALUE hValue) { return lpValue && lpValue->IsFunction(); } -FX_BOOL FXJSE_Value_IsDate(FXJSE_HVALUE hValue) { - CFXJSE_Value* lpValue = reinterpret_cast(hValue); - return lpValue && lpValue->IsDate(); -} - FX_BOOL FXJSE_Value_ToBoolean(FXJSE_HVALUE hValue) { return reinterpret_cast(hValue)->ToBoolean(); } @@ -136,10 +126,6 @@ void FXJSE_Value_SetArray(FXJSE_HVALUE hValue, ->SetArray(uValueCount, reinterpret_cast(rgValues)); } -void FXJSE_Value_SetDate(FXJSE_HVALUE hValue, double dDouble) { - reinterpret_cast(hValue)->SetDate(dDouble); -} - void FXJSE_Value_Set(FXJSE_HVALUE hValue, FXJSE_HVALUE hOriginalValue) { CFXJSE_Value* lpValue = reinterpret_cast(hValue); CFXJSE_Value* lpOriginalValue = @@ -175,15 +161,6 @@ FX_BOOL FXJSE_Value_GetObjectPropByIdx(FXJSE_HVALUE hValue, return lpValue->GetObjectProperty(uPropIdx, lpPropValue); } -FX_BOOL FXJSE_Value_SetObjectPropByIdx(FXJSE_HVALUE hValue, - uint32_t uPropIdx, - FXJSE_HVALUE hPropValue) { - CFXJSE_Value* lpValue = reinterpret_cast(hValue); - CFXJSE_Value* lpPropValue = reinterpret_cast(hPropValue); - ASSERT(lpValue && lpPropValue); - return lpValue->SetObjectProperty(uPropIdx, lpPropValue); -} - FX_BOOL FXJSE_Value_DeleteObjectProp(FXJSE_HVALUE hValue, const CFX_ByteStringC& szPropName) { return reinterpret_cast(hValue) @@ -216,17 +193,6 @@ FX_BOOL FXJSE_Value_SetFunctionBind(FXJSE_HVALUE hValue, return lpValue->SetFunctionBind(lpOldFunction, lpNewThis); } -FX_BOOL FXJSE_Value_CallFunction(FXJSE_HVALUE hFunction, - FXJSE_HVALUE hThis, - FXJSE_HVALUE hRetValue, - uint32_t nArgCount, - FXJSE_HVALUE* lpArgs) { - CFXJSE_Value* lpThis = reinterpret_cast(hThis); - CFXJSE_Value* lpRetValue = reinterpret_cast(hRetValue); - return reinterpret_cast(hFunction) - ->Call(lpThis, lpRetValue, nArgCount, lpArgs); -} - FXJSE_HVALUE FXJSE_Value_Create(FXJSE_HRUNTIME hRuntime) { return reinterpret_cast( CFXJSE_Value::Create(reinterpret_cast(hRuntime))); @@ -237,11 +203,6 @@ void FXJSE_Value_Release(FXJSE_HVALUE hValue) { delete lpValue; } -FXJSE_HRUNTIME FXJSE_Value_GetRuntime(FXJSE_HVALUE hValue) { - return reinterpret_cast( - reinterpret_cast(hValue)->GetIsolate()); -} - void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name, const CFX_ByteStringC& utf8Message) { v8::Isolate* pIsolate = v8::Isolate::GetCurrent(); -- cgit v1.2.3