diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-19 05:53:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-19 05:53:40 -0700 |
commit | 0582ad18b1e7ab9e404b7f8071a015ec756f5afe (patch) | |
tree | 4c0807ec379b17fc4439f6e3183faa881edb291c /xfa/fxjse | |
parent | 86d945b2d24edade9c7175be1c31b246f54b04ca (diff) | |
download | pdfium-0582ad18b1e7ab9e404b7f8071a015ec756f5afe.tar.xz |
XFA unused function cleanup
This CL removes a series of unused XFA methods.
Review URL: https://codereview.chromium.org/1899103002
Diffstat (limited to 'xfa/fxjse')
-rw-r--r-- | xfa/fxjse/class.cpp | 29 | ||||
-rw-r--r-- | xfa/fxjse/context.cpp | 52 | ||||
-rw-r--r-- | xfa/fxjse/include/fxjse.h | 25 | ||||
-rw-r--r-- | xfa/fxjse/value.cpp | 39 |
4 files changed, 0 insertions, 145 deletions
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<v8::Value> value, const v8::PropertyCallbackInfo<void>& info); -void FXJSE_DefineFunctions(FXJSE_HCONTEXT hContext, - const FXJSE_FUNCTION* lpFunctions, - int nNum) { - CFXJSE_Context* lpContext = reinterpret_cast<CFXJSE_Context*>(hContext); - ASSERT(lpContext); - CFXJSE_ScopeUtil_IsolateHandleContext scope(lpContext); - v8::Isolate* pIsolate = lpContext->GetRuntime(); - v8::Local<v8::Object> hGlobalObject = - FXJSE_GetGlobalObjectFromContext(scope.GetLocalContext()); - for (int32_t i = 0; i < nNum; i++) { - v8::Maybe<bool> 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<FXJSE_FUNCTION*>(lpFunctions + i))), - static_cast<v8::PropertyAttribute>(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<CFXJSE_Context*>(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<FXJSE_HCLASS>(CFXJSE_Class::GetClassFromContext( - reinterpret_cast<CFXJSE_Context*>(hContext), szName)); -} - static void FXJSE_V8FunctionCallback_Wrapper( const v8::FunctionCallbackInfo<v8::Value>& 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<FXJSE_HVALUE>(lpValue); } -FXJSE_HRUNTIME FXJSE_Context_GetRuntime(FXJSE_HCONTEXT hContext) { - CFXJSE_Context* pContext = reinterpret_cast<CFXJSE_Context*>(hContext); - return pContext ? reinterpret_cast<FXJSE_HRUNTIME>(pContext->GetRuntime()) - : NULL; -} - static const FX_CHAR* szCompatibleModeScripts[] = { "(function(global, list) {\n" " 'use strict';\n" @@ -127,52 +121,6 @@ v8::Local<v8::Object> 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<CFXJSE_Value*>(hRetValue); - if (!lpValue) { - return FALSE; - } - v8::Isolate* pIsolate = lpValue->GetIsolate(); - CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); - v8::Local<v8::Value> hValue = - v8::Local<v8::Value>::New(pIsolate, lpValue->DirectGetValue()); - if (!hValue->IsObject()) { - return FALSE; - } - v8::String::Utf8Value hStringVal0( - hValue.As<v8::Object>()->Get(0)->ToString()); - utf8Name = *hStringVal0; - v8::String::Utf8Value hStringVal1( - hValue.As<v8::Object>()->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<CFXJSE_Value*>(hRetValue); - if (!lpValue) { - return FALSE; - } - v8::Isolate* pIsolate = lpValue->GetIsolate(); - CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); - v8::Local<v8::Value> hValue = - v8::Local<v8::Value>::New(pIsolate, lpValue->DirectGetValue()); - if (!hValue->IsObject()) { - return FALSE; - } - v8::MaybeLocal<v8::Int32> maybe_int = - hValue.As<v8::Object>()->Get(3)->ToInt32(pIsolate->GetCurrentContext()); - nLine = maybe_int.FromMaybe(v8::Local<v8::Int32>())->Value(); - maybe_int = - hValue.As<v8::Object>()->Get(5)->ToInt32(pIsolate->GetCurrentContext()); - nCol = maybe_int.FromMaybe(v8::Local<v8::Int32>())->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<CFXJSE_Value*>(hValue); - return lpValue && lpValue->IsInteger(); -} - FX_BOOL FXJSE_Value_IsObject(FXJSE_HVALUE hValue) { CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(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<CFXJSE_Value*>(hValue); - return lpValue && lpValue->IsDate(); -} - FX_BOOL FXJSE_Value_ToBoolean(FXJSE_HVALUE hValue) { return reinterpret_cast<CFXJSE_Value*>(hValue)->ToBoolean(); } @@ -136,10 +126,6 @@ void FXJSE_Value_SetArray(FXJSE_HVALUE hValue, ->SetArray(uValueCount, reinterpret_cast<CFXJSE_Value**>(rgValues)); } -void FXJSE_Value_SetDate(FXJSE_HVALUE hValue, double dDouble) { - reinterpret_cast<CFXJSE_Value*>(hValue)->SetDate(dDouble); -} - void FXJSE_Value_Set(FXJSE_HVALUE hValue, FXJSE_HVALUE hOriginalValue) { CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(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<CFXJSE_Value*>(hValue); - CFXJSE_Value* lpPropValue = reinterpret_cast<CFXJSE_Value*>(hPropValue); - ASSERT(lpValue && lpPropValue); - return lpValue->SetObjectProperty(uPropIdx, lpPropValue); -} - FX_BOOL FXJSE_Value_DeleteObjectProp(FXJSE_HVALUE hValue, const CFX_ByteStringC& szPropName) { return reinterpret_cast<CFXJSE_Value*>(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<CFXJSE_Value*>(hThis); - CFXJSE_Value* lpRetValue = reinterpret_cast<CFXJSE_Value*>(hRetValue); - return reinterpret_cast<CFXJSE_Value*>(hFunction) - ->Call(lpThis, lpRetValue, nArgCount, lpArgs); -} - FXJSE_HVALUE FXJSE_Value_Create(FXJSE_HRUNTIME hRuntime) { return reinterpret_cast<FXJSE_HVALUE>( CFXJSE_Value::Create(reinterpret_cast<v8::Isolate*>(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<FXJSE_HRUNTIME>( - reinterpret_cast<CFXJSE_Value*>(hValue)->GetIsolate()); -} - void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name, const CFX_ByteStringC& utf8Message) { v8::Isolate* pIsolate = v8::Isolate::GetCurrent(); |