From 3fea540931b6b2c700c50809a3d4d8a506f4f797 Mon Sep 17 00:00:00 2001 From: Jochen Eisinger Date: Tue, 19 May 2015 00:33:06 +0200 Subject: Replace v8::Handle with v8::Local and v8::Persistent with v8::Global those types are just aliases, and we should consistently use the new version R=tsepez@chromium.org BUG= Review URL: https://codereview.chromium.org/1138823004 --- fpdfsdk/src/jsapi/fxjs_v8.cpp | 166 +++++++++++++++++++++--------------------- 1 file changed, 83 insertions(+), 83 deletions(-) (limited to 'fpdfsdk/src/jsapi') diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp index b1adeb7112..0c0d8b5b1b 100644 --- a/fpdfsdk/src/jsapi/fxjs_v8.cpp +++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp @@ -46,7 +46,7 @@ public: v8::Isolate::Scope isolate_scope(isolate); v8::HandleScope handle_scope(isolate); - v8::Handle objTemplate = v8::ObjectTemplate::New(isolate); + v8::Local objTemplate = v8::ObjectTemplate::New(isolate); objTemplate->SetInternalFieldCount(2); m_objTemplate.Reset(isolate, objTemplate); @@ -70,8 +70,8 @@ public: unsigned m_bApplyNew; FX_BOOL m_bSetAsGlobalObject; - v8::Persistent m_objTemplate; - v8::Persistent m_StaticObj; + v8::Global m_objTemplate; + v8::Global m_StaticObj; }; int JS_DefineObj(IJS_Runtime* pJSRuntime, const wchar_t* sObjName, FXJSOBJTYPE eObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned bApplyNew) @@ -147,7 +147,7 @@ int JS_DefineObjAllProperties(IJS_Runtime* pJSRuntime, int nObjDefnID, v8::Named return 0; } -int JS_DefineObjConst(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sConstName, v8::Handle pDefault) +int JS_DefineObjConst(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sConstName, v8::Local pDefault) { v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; v8::Isolate::Scope isolate_scope(isolate); @@ -167,7 +167,7 @@ int JS_DefineObjConst(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sC return 0; } -static v8::Persistent& _getGlobalObjectTemplate(IJS_Runtime* pJSRuntime) +static v8::Global& _getGlobalObjectTemplate(IJS_Runtime* pJSRuntime) { v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; v8::Isolate::Scope isolate_scope(isolate); @@ -181,7 +181,7 @@ static v8::Persistent& _getGlobalObjectTemplate(IJS_Runtime* if(pObjDef->m_bSetAsGlobalObject) return pObjDef->m_objTemplate; } - static v8::Persistent gloabalObjectTemplate; + static v8::Global gloabalObjectTemplate; return gloabalObjectTemplate; } @@ -197,7 +197,7 @@ int JS_DefineGlobalMethod(IJS_Runtime* pJSRuntime, const wchar_t* sMethodName, v v8::Local funTempl = v8::FunctionTemplate::New(isolate, pMethodCall); v8::Local objTemp; - v8::Persistent& globalObjTemp = _getGlobalObjectTemplate(pJSRuntime); + v8::Global& globalObjTemp = _getGlobalObjectTemplate(pJSRuntime); if(globalObjTemp.IsEmpty()) objTemp = v8::ObjectTemplate::New(isolate); else @@ -209,7 +209,7 @@ int JS_DefineGlobalMethod(IJS_Runtime* pJSRuntime, const wchar_t* sMethodName, v return 0; } -int JS_DefineGlobalConst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8::Handle pDefault) +int JS_DefineGlobalConst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8::Local pDefault) { v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; v8::Isolate::Scope isolate_scope(isolate); @@ -220,7 +220,7 @@ int JS_DefineGlobalConst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8: v8::Local objTemp; - v8::Persistent& globalObjTemp = _getGlobalObjectTemplate(pJSRuntime); + v8::Global& globalObjTemp = _getGlobalObjectTemplate(pJSRuntime); if(globalObjTemp.IsEmpty()) objTemp = v8::ObjectTemplate::New(isolate); else @@ -233,17 +233,17 @@ int JS_DefineGlobalConst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8: } -void JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_Context* context, v8::Persistent& v8PersistentContext) +void JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_Context* context, v8::Global& v8PersistentContext) { v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; v8::Isolate::Scope isolate_scope(isolate); v8::HandleScope handle_scope(isolate); - v8::Persistent& globalObjTemp = _getGlobalObjectTemplate(pJSRuntime); - v8::Handle v8Context = v8::Context::New(isolate, NULL, v8::Local::New(isolate, globalObjTemp)); + v8::Global& globalObjTemp = _getGlobalObjectTemplate(pJSRuntime); + v8::Local v8Context = v8::Context::New(isolate, NULL, v8::Local::New(isolate, globalObjTemp)); v8::Context::Scope context_scope(v8Context); - v8::Handle ptr = v8::External::New(isolate, pFXRuntime); + v8::Local ptr = v8::External::New(isolate, pFXRuntime); v8Context->SetEmbedderData(1, ptr); CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(0); @@ -254,7 +254,7 @@ void JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_ CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(i); CFX_WideString ws = CFX_WideString(pObjDef->objName); CFX_ByteString bs = ws.UTF8Encode(); - v8::Handle objName = v8::String::NewFromUtf8(isolate, bs.c_str(), v8::NewStringType::kNormal, bs.GetLength()).ToLocalChecked(); + v8::Local objName = v8::String::NewFromUtf8(isolate, bs.c_str(), v8::NewStringType::kNormal, bs.GetLength()).ToLocalChecked(); if(pObjDef->objType == JS_DYNAMIC) @@ -274,7 +274,7 @@ void JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_ } else { - v8::Handle obj = JS_NewFxDynamicObj(pJSRuntime, context, i); + v8::Local obj = JS_NewFxDynamicObj(pJSRuntime, context, i); v8Context->Global()->Set(v8Context, objName, obj).FromJust(); pObjDef->m_StaticObj.Reset(isolate, obj); } @@ -282,7 +282,7 @@ void JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_ v8PersistentContext.Reset(isolate, v8Context); } -void JS_ReleaseRuntime(IJS_Runtime* pJSRuntime, v8::Persistent& v8PersistentContext) +void JS_ReleaseRuntime(IJS_Runtime* pJSRuntime, v8::Global& v8PersistentContext) { v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; v8::Isolate::Scope isolate_scope(isolate); @@ -351,7 +351,7 @@ int JS_Execute(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t return -1; } - v8::Handle result; + v8::Local result; if (!compiled_script->Run(context).ToLocal(&result)) { v8::String::Utf8Value error(try_catch.Exception()); return -1; @@ -359,7 +359,7 @@ int JS_Execute(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t return 0; } -v8::Handle JS_NewFxDynamicObj(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, int nObjDefnID) +v8::Local JS_NewFxDynamicObj(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, int nObjDefnID) { v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; v8::Isolate::Scope isolate_scope(isolate); @@ -369,14 +369,14 @@ v8::Handle JS_NewFxDynamicObj(IJS_Runtime* pJSRuntime, IFXJS_Context v8::Local objTempl = v8::ObjectTemplate::New(isolate); v8::Local obj; if (objTempl->NewInstance(context).ToLocal(&obj)) return obj; - return v8::Handle(); + return v8::Local(); } CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(0); - if(!pArray) return v8::Handle(); + if(!pArray) return v8::Local(); - if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return v8::Handle(); + if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return v8::Local(); CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(nObjDefnID); v8::Local objTemp = v8::Local::New(isolate, pObjDef->m_objTemplate); @@ -393,15 +393,15 @@ v8::Handle JS_NewFxDynamicObj(IJS_Runtime* pJSRuntime, IFXJS_Context return obj; } -v8::Handle JS_GetStaticObj(IJS_Runtime* pJSRuntime, int nObjDefnID) +v8::Local JS_GetStaticObj(IJS_Runtime* pJSRuntime, int nObjDefnID) { v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; v8::Isolate::Scope isolate_scope(isolate); CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(0); - if(!pArray) return v8::Handle(); + if(!pArray) return v8::Local(); - if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return v8::Handle(); + if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return v8::Local(); CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(nObjDefnID); v8::Local obj = v8::Local::New(isolate,pObjDef->m_StaticObj); return obj; @@ -411,20 +411,20 @@ void JS_SetThisObj(IJS_Runtime* pJSRuntime, int nThisObjID) { //Do nothing. } -v8::Handle JS_GetThisObj(IJS_Runtime * pJSRuntime) +v8::Local JS_GetThisObj(IJS_Runtime * pJSRuntime) { //Return the global object. v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; v8::Isolate::Scope isolate_scope(isolate); CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(0); - if(!pArray) return v8::Handle(); + if(!pArray) return v8::Local(); v8::Local context = isolate->GetCurrentContext(); return context->Global()->GetPrototype()->ToObject(context).ToLocalChecked(); } -int JS_GetObjDefnID(v8::Handle pObj) +int JS_GetObjDefnID(v8::Local pObj) { if(pObj.IsEmpty() || !pObj->InternalFieldCount()) return -1; CJS_PrivateData* pPrivateData = (CJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0); @@ -433,7 +433,7 @@ int JS_GetObjDefnID(v8::Handle pObj) return -1; } -IJS_Runtime* JS_GetRuntime(v8::Handle pObj) +IJS_Runtime* JS_GetRuntime(v8::Local pObj) { if(pObj.IsEmpty()) return NULL; v8::Local context = pObj->CreationContext(); @@ -478,7 +478,7 @@ unsigned JS_CalcHash(const wchar_t* main) { return (unsigned)FX_HashCode_String_GetW(main, FXSYS_wcslen(main)); } -const wchar_t* JS_GetTypeof(v8::Handle pObj) +const wchar_t* JS_GetTypeof(v8::Local pObj) { if(pObj.IsEmpty()) return NULL; if(pObj->IsString()) @@ -498,17 +498,17 @@ const wchar_t* JS_GetTypeof(v8::Handle pObj) return NULL; } -void JS_SetPrivate(v8::Handle pObj, void* p) +void JS_SetPrivate(v8::Local pObj, void* p) { JS_SetPrivate(NULL, pObj, p); } -void* JS_GetPrivate(v8::Handle pObj) +void* JS_GetPrivate(v8::Local pObj) { return JS_GetPrivate(NULL,pObj); } -void JS_SetPrivate(IJS_Runtime* pJSRuntime, v8::Handle pObj, void* p) +void JS_SetPrivate(IJS_Runtime* pJSRuntime, v8::Local pObj, void* p) { if(pObj.IsEmpty() || !pObj->InternalFieldCount()) return; CJS_PrivateData* pPrivateData = (CJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0); @@ -516,7 +516,7 @@ void JS_SetPrivate(IJS_Runtime* pJSRuntime, v8::Handle pObj, void* p pPrivateData->pPrivate = p; } -void* JS_GetPrivate(IJS_Runtime* pJSRuntime, v8::Handle pObj) +void* JS_GetPrivate(IJS_Runtime* pJSRuntime, v8::Local pObj) { if(pObj.IsEmpty()) return NULL; CJS_PrivateData* pPrivateData = NULL; @@ -540,7 +540,7 @@ void JS_FreePrivate(void* pPrivateData) delete (CJS_PrivateData*)pPrivateData; } -void JS_FreePrivate(v8::Handle pObj) +void JS_FreePrivate(v8::Local pObj) { if(pObj.IsEmpty() || !pObj->InternalFieldCount()) return; JS_FreePrivate(pObj->GetAlignedPointerFromInternalField(0)); @@ -548,12 +548,12 @@ void JS_FreePrivate(v8::Handle pObj) } -v8::Handle JS_GetObjectValue(v8::Handle pObj) +v8::Local JS_GetObjectValue(v8::Local pObj) { return pObj; } -v8::Handle WSToJSString(IJS_Runtime* pJSRuntime, const wchar_t* PropertyName, int Len = -1) +v8::Local WSToJSString(IJS_Runtime* pJSRuntime, const wchar_t* PropertyName, int Len = -1) { CFX_WideString ws = CFX_WideString(PropertyName,Len); CFX_ByteString bs = ws.UTF8Encode(); @@ -561,149 +561,149 @@ v8::Handle WSToJSString(IJS_Runtime* pJSRuntime, const wchar_t* Prop return v8::String::NewFromUtf8(pJSRuntime, bs.c_str(), v8::NewStringType::kNormal).ToLocalChecked(); } -v8::Handle JS_GetObjectElement(IJS_Runtime* pJSRuntime, v8::Handle pObj,const wchar_t* PropertyName) +v8::Local JS_GetObjectElement(IJS_Runtime* pJSRuntime, v8::Local pObj,const wchar_t* PropertyName) { - if(pObj.IsEmpty()) return v8::Handle(); + if(pObj.IsEmpty()) return v8::Local(); v8::Local val; - if (!pObj->Get(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName)).ToLocal(&val)) return v8::Handle(); + if (!pObj->Get(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName)).ToLocal(&val)) return v8::Local(); return val; } -v8::Handle JS_GetObjectElementNames(IJS_Runtime* pJSRuntime, v8::Handle pObj) +v8::Local JS_GetObjectElementNames(IJS_Runtime* pJSRuntime, v8::Local pObj) { - if(pObj.IsEmpty()) return v8::Handle(); + if(pObj.IsEmpty()) return v8::Local(); v8::Local val; if (!pObj->GetPropertyNames(pJSRuntime->GetCurrentContext()).ToLocal(&val)) return v8::Local(); return val; } -void JS_PutObjectString(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName, const wchar_t* sValue) //VT_string +void JS_PutObjectString(IJS_Runtime* pJSRuntime,v8::Local pObj, const wchar_t* PropertyName, const wchar_t* sValue) //VT_string { if(pObj.IsEmpty()) return; pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime, PropertyName), WSToJSString(pJSRuntime, sValue)).FromJust(); } -void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName, int nValue) +void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Local pObj, const wchar_t* PropertyName, int nValue) { if(pObj.IsEmpty()) return; pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),v8::Int32::New(pJSRuntime, nValue)).FromJust(); } -void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName, float fValue) +void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Local pObj, const wchar_t* PropertyName, float fValue) { if(pObj.IsEmpty()) return; pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),v8::Number::New(pJSRuntime, (double)fValue)).FromJust(); } -void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName, double dValue) +void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Local pObj, const wchar_t* PropertyName, double dValue) { if(pObj.IsEmpty()) return; pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),v8::Number::New(pJSRuntime, (double)dValue)).FromJust(); } -void JS_PutObjectBoolean(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName, bool bValue) +void JS_PutObjectBoolean(IJS_Runtime* pJSRuntime,v8::Local pObj, const wchar_t* PropertyName, bool bValue) { if(pObj.IsEmpty()) return; pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),v8::Boolean::New(pJSRuntime, bValue)).FromJust(); } -void JS_PutObjectObject(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName, v8::Handle pPut) +void JS_PutObjectObject(IJS_Runtime* pJSRuntime,v8::Local pObj, const wchar_t* PropertyName, v8::Local pPut) { if(pObj.IsEmpty()) return; pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),pPut).FromJust(); } -void JS_PutObjectNull(IJS_Runtime* pJSRuntime,v8::Handle pObj, const wchar_t* PropertyName) +void JS_PutObjectNull(IJS_Runtime* pJSRuntime,v8::Local pObj, const wchar_t* PropertyName) { if(pObj.IsEmpty()) return; - pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),v8::Handle()).FromJust(); + pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),v8::Local()).FromJust(); } -v8::Handle JS_NewArray(IJS_Runtime* pJSRuntime) +v8::Local JS_NewArray(IJS_Runtime* pJSRuntime) { return v8::Array::New(pJSRuntime); } -unsigned JS_PutArrayElement(IJS_Runtime* pJSRuntime, v8::Handle pArray,unsigned index,v8::Handle pValue,FXJSVALUETYPE eType) +unsigned JS_PutArrayElement(IJS_Runtime* pJSRuntime, v8::Local pArray,unsigned index,v8::Local pValue,FXJSVALUETYPE eType) { if(pArray.IsEmpty()) return 0; if (pArray->Set(pJSRuntime->GetCurrentContext(), index, pValue).IsNothing()) return 0; return 1; } -v8::Handle JS_GetArrayElement(IJS_Runtime* pJSRuntime, v8::Handle pArray,unsigned index) +v8::Local JS_GetArrayElement(IJS_Runtime* pJSRuntime, v8::Local pArray,unsigned index) { - if(pArray.IsEmpty()) return v8::Handle(); + if(pArray.IsEmpty()) return v8::Local(); v8::Local val; if (pArray->Get(pJSRuntime->GetCurrentContext(), index).ToLocal(&val)) return v8::Local(); return val; } -unsigned JS_GetArrayLength(v8::Handle pArray) +unsigned JS_GetArrayLength(v8::Local pArray) { if(pArray.IsEmpty()) return 0; return pArray->Length(); } -v8::Handle JS_NewNumber(IJS_Runtime* pJSRuntime,int number) +v8::Local JS_NewNumber(IJS_Runtime* pJSRuntime,int number) { return v8::Int32::New(pJSRuntime, number); } -v8::Handle JS_NewNumber(IJS_Runtime* pJSRuntime,double number) +v8::Local JS_NewNumber(IJS_Runtime* pJSRuntime,double number) { return v8::Number::New(pJSRuntime, number); } -v8::Handle JS_NewNumber(IJS_Runtime* pJSRuntime,float number) +v8::Local JS_NewNumber(IJS_Runtime* pJSRuntime,float number) { return v8::Number::New(pJSRuntime, (float)number); } -v8::Handle JS_NewBoolean(IJS_Runtime* pJSRuntime,bool b) +v8::Local JS_NewBoolean(IJS_Runtime* pJSRuntime,bool b) { return v8::Boolean::New(pJSRuntime, b); } -v8::Handle JS_NewObject(IJS_Runtime* pJSRuntime,v8::Handle pObj) +v8::Local JS_NewObject(IJS_Runtime* pJSRuntime,v8::Local pObj) { - if(pObj.IsEmpty()) return v8::Handle(); + if(pObj.IsEmpty()) return v8::Local(); return pObj->Clone(); } -v8::Handle JS_NewObject2(IJS_Runtime* pJSRuntime,v8::Handle pObj) +v8::Local JS_NewObject2(IJS_Runtime* pJSRuntime,v8::Local pObj) { - if(pObj.IsEmpty()) return v8::Handle(); + if(pObj.IsEmpty()) return v8::Local(); return pObj->Clone(); } -v8::Handle JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string) +v8::Local JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string) { return WSToJSString(pJSRuntime, string); } -v8::Handle JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string, unsigned nLen) +v8::Local JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string, unsigned nLen) { return WSToJSString(pJSRuntime, string, nLen); } -v8::Handle JS_NewNull() +v8::Local JS_NewNull() { - return v8::Handle(); + return v8::Local(); } -v8::Handle JS_NewDate(IJS_Runtime* pJSRuntime,double d) +v8::Local JS_NewDate(IJS_Runtime* pJSRuntime,double d) { return v8::Date::New(pJSRuntime->GetCurrentContext(), d).ToLocalChecked(); } -v8::Handle JS_NewValue(IJS_Runtime* pJSRuntime) +v8::Local JS_NewValue(IJS_Runtime* pJSRuntime) { - return v8::Handle(); + return v8::Local(); } -v8::Handle JS_GetListValue(IJS_Runtime* pJSRuntime, v8::Handle pList, int index) +v8::Local JS_GetListValue(IJS_Runtime* pJSRuntime, v8::Local pList, int index) { v8::Local context = pJSRuntime->GetCurrentContext(); @@ -716,38 +716,38 @@ v8::Handle JS_GetListValue(IJS_Runtime* pJSRuntime, v8::HandleGet(context, index).ToLocal(&val)) return val; } } - return v8::Handle(); + return v8::Local(); } -int JS_ToInt32(IJS_Runtime* pJSRuntime, v8::Handle pValue) +int JS_ToInt32(IJS_Runtime* pJSRuntime, v8::Local pValue) { if(pValue.IsEmpty()) return 0; v8::Local context = pJSRuntime->GetCurrentContext(); return pValue->ToInt32(context).ToLocalChecked()->Value(); } -bool JS_ToBoolean(IJS_Runtime* pJSRuntime, v8::Handle pValue) +bool JS_ToBoolean(IJS_Runtime* pJSRuntime, v8::Local pValue) { if(pValue.IsEmpty()) return false; v8::Local context = pJSRuntime->GetCurrentContext(); return pValue->ToBoolean(context).ToLocalChecked()->Value(); } -double JS_ToNumber(IJS_Runtime* pJSRuntime, v8::Handle pValue) +double JS_ToNumber(IJS_Runtime* pJSRuntime, v8::Local pValue) { if(pValue.IsEmpty()) return 0.0; v8::Local context = pJSRuntime->GetCurrentContext(); return pValue->ToNumber(context).ToLocalChecked()->Value(); } -v8::Handle JS_ToObject(IJS_Runtime* pJSRuntime, v8::Handle pValue) +v8::Local JS_ToObject(IJS_Runtime* pJSRuntime, v8::Local pValue) { - if(pValue.IsEmpty()) return v8::Handle(); + if(pValue.IsEmpty()) return v8::Local(); v8::Local context = pJSRuntime->GetCurrentContext(); return pValue->ToObject(context).ToLocalChecked(); } -CFX_WideString JS_ToString(IJS_Runtime* pJSRuntime, v8::Handle pValue) +CFX_WideString JS_ToString(IJS_Runtime* pJSRuntime, v8::Local pValue) { if(pValue.IsEmpty()) return L""; v8::Local context = pJSRuntime->GetCurrentContext(); @@ -755,14 +755,14 @@ CFX_WideString JS_ToString(IJS_Runtime* pJSRuntime, v8::Handle pValue return CFX_WideString::FromUTF8(*s, s.length()); } -v8::Handle JS_ToArray(IJS_Runtime* pJSRuntime, v8::Handle pValue) +v8::Local JS_ToArray(IJS_Runtime* pJSRuntime, v8::Local pValue) { - if(pValue.IsEmpty()) return v8::Handle(); + if(pValue.IsEmpty()) return v8::Local(); v8::Local context = pJSRuntime->GetCurrentContext(); - return v8::Handle::Cast(pValue->ToObject(context).ToLocalChecked()); + return v8::Local::Cast(pValue->ToObject(context).ToLocalChecked()); } -void JS_ValueCopy(v8::Handle& pTo, v8::Handle pFrom) +void JS_ValueCopy(v8::Local& pTo, v8::Local pFrom) { pTo = pFrom; } @@ -1000,11 +1000,11 @@ double JS_DateParse(const wchar_t* string) v = o->Get(context,v8::String::NewFromUtf8(pIsolate, "parse", v8::NewStringType::kNormal).ToLocalChecked()).ToLocalChecked(); if(v->IsFunction()) { - v8::Local funC = v8::Handle::Cast(v); + v8::Local funC = v8::Local::Cast(v); const int argc = 1; v8::Local timeStr = WSToJSString(pIsolate, string); - v8::Handle argv[argc] = {timeStr}; + v8::Local argv[argc] = {timeStr}; v = funC->Call(context, context->Global(), argc, argv).ToLocalChecked(); if(v->IsNumber()) { -- cgit v1.2.3