mod_v8: Minor tweaks to keep up with recent V8 API changes

This commit is contained in:
Peter Olsson 2014-02-20 17:34:27 +01:00
parent bd72cd9cc1
commit c679d98eb7
7 changed files with 21 additions and 21 deletions

View File

@ -565,7 +565,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
TryCatch try_catch; TryCatch try_catch;
// Compile the source code. // Compile the source code.
Handle<Script> v8_script = Script::Compile(source, Handle<Value>::New(isolate, String::NewFromUtf8(isolate, script_file))); Handle<Script> v8_script = Script::Compile(source, Local<Value>::New(isolate, String::NewFromUtf8(isolate, script_file)));
if (try_catch.HasCaught()) { if (try_catch.HasCaught()) {
v8_error(isolate, &try_catch); v8_error(isolate, &try_catch);

View File

@ -122,7 +122,7 @@ int FSCoreDB::Callback(void *pArg, int argc, char **argv, char **columnNames)
} }
HandleScope scope(dbo->GetIsolate()); HandleScope scope(dbo->GetIsolate());
Handle<Function> func = Handle<Function>::New(dbo->GetIsolate(), dbo->_callback); Handle<Function> func = Local<Function>::New(dbo->GetIsolate(), dbo->_callback);
Handle<Value> jsargv[1] = { arg }; Handle<Value> jsargv[1] = { arg };
func->Call(dbo->GetIsolate()->GetCurrentContext()->Global(), 1, jsargv); func->Call(dbo->GetIsolate()->GetCurrentContext()->Global(), 1, jsargv);

View File

@ -72,7 +72,7 @@ size_t FSCURL::FileCallback(void *ptr, size_t size, size_t nmemb, void *data)
Handle<Function> func; Handle<Function> func;
if (!obj->_function.IsEmpty()) { if (!obj->_function.IsEmpty()) {
func = Handle<Function>::New(obj->GetIsolate(), obj->_function); func = Local<Function>::New(obj->GetIsolate(), obj->_function);
} }
if (!func.IsEmpty()) { if (!func.IsEmpty()) {
@ -83,7 +83,7 @@ size_t FSCURL::FileCallback(void *ptr, size_t size, size_t nmemb, void *data)
argv[argc++] = String::NewFromUtf8(obj->GetIsolate(), ""); argv[argc++] = String::NewFromUtf8(obj->GetIsolate(), "");
} }
if (!obj->_user_data.IsEmpty()) { if (!obj->_user_data.IsEmpty()) {
argv[argc++] = Handle<Value>::New(obj->GetIsolate(), Persistent<Value>::Cast(obj->_user_data)); argv[argc++] = Local<Value>::New(obj->GetIsolate(), Persistent<Value>::Cast(obj->_user_data));
} }
Handle<Value> res = func->Call(obj->GetIsolate()->GetCurrentContext()->Global(), argc, argv); Handle<Value> res = func->Call(obj->GetIsolate()->GetCurrentContext()->Global(), argc, argv);
@ -94,7 +94,7 @@ size_t FSCURL::FileCallback(void *ptr, size_t size, size_t nmemb, void *data)
obj->_ret.Reset(); obj->_ret.Reset();
} }
String::Utf8Value str(Handle<Value>::New(obj->GetIsolate(), res)); String::Utf8Value str(Local<Value>::New(obj->GetIsolate(), res));
if ((ret = *str)) { if ((ret = *str)) {
if (!strcmp(ret, "true") || !strcmp(ret, "undefined")) { if (!strcmp(ret, "true") || !strcmp(ret, "undefined")) {

View File

@ -213,11 +213,11 @@ switch_status_t FSSession::CommonCallback(switch_core_session_t *session, void *
HandleScope handle_scope(isolate); HandleScope handle_scope(isolate);
if (cb_state->jss_a && cb_state->jss_a->_session && cb_state->jss_a->_session == session) { if (cb_state->jss_a && cb_state->jss_a->_session && cb_state->jss_a->_session == session) {
argv[argc++] = Handle<Object>::New(isolate, cb_state->session_obj_a); argv[argc++] = Local<Object>::New(isolate, cb_state->session_obj_a);
} else if (cb_state->jss_b && cb_state->jss_b->_session && cb_state->jss_b->_session == session) { } else if (cb_state->jss_b && cb_state->jss_b->_session && cb_state->jss_b->_session == session) {
argv[argc++] = Handle<Object>::New(isolate, cb_state->session_obj_b); argv[argc++] = Local<Object>::New(isolate, cb_state->session_obj_b);
} else { } else {
argv[argc++] = Handle<Object>::New(isolate, cb_state->session_state->GetJavaScriptObject()); argv[argc++] = Local<Object>::New(isolate, cb_state->session_state->GetJavaScriptObject());
} }
switch (itype) { switch (itype) {
@ -226,7 +226,7 @@ switch_status_t FSSession::CommonCallback(switch_core_session_t *session, void *
Event = FSEvent::New(event, "", cb_state->session_state->GetOwner()); Event = FSEvent::New(event, "", cb_state->session_state->GetOwner());
if (!Event.IsEmpty()) { if (!Event.IsEmpty()) {
argv[argc++] = String::NewFromUtf8(isolate, "event"); argv[argc++] = String::NewFromUtf8(isolate, "event");
argv[argc++] = Handle<Object>::New(isolate, Event); argv[argc++] = Local<Object>::New(isolate, Event);
} }
} }
if (Event.IsEmpty()) { if (Event.IsEmpty()) {
@ -241,7 +241,7 @@ switch_status_t FSSession::CommonCallback(switch_core_session_t *session, void *
Event = FSDTMF::New(dtmf, "", cb_state->session_state->GetOwner()); Event = FSDTMF::New(dtmf, "", cb_state->session_state->GetOwner());
if (!Event.IsEmpty()) { if (!Event.IsEmpty()) {
argv[argc++] = String::NewFromUtf8(isolate, "dtmf"); argv[argc++] = String::NewFromUtf8(isolate, "dtmf");
argv[argc++] = Handle<Object>::New(isolate, Event); argv[argc++] = Local<Object>::New(isolate, Event);
} else { } else {
goto done; goto done;
} }
@ -251,14 +251,14 @@ switch_status_t FSSession::CommonCallback(switch_core_session_t *session, void *
} }
if (!cb_state->arg.IsEmpty()) { if (!cb_state->arg.IsEmpty()) {
argv[argc++] = Handle<Value>::New(isolate, cb_state->arg); argv[argc++] = Local<Value>::New(isolate, cb_state->arg);
} }
CheckHangupHook(cb_state->session_state, &ret); CheckHangupHook(cb_state->session_state, &ret);
if (ret) { if (ret) {
if (!cb_state->function.IsEmpty()) { if (!cb_state->function.IsEmpty()) {
Handle<Function> func = Handle<Function>::New(isolate, cb_state->function); Handle<Function> func = Local<Function>::New(isolate, cb_state->function);
if (func->IsFunction()) { if (func->IsFunction()) {
Handle<Value> res = func->Call(isolate->GetCurrentContext()->Global(), argc, argv); Handle<Value> res = func->Call(isolate->GetCurrentContext()->Global(), argc, argv);
@ -299,7 +299,7 @@ switch_status_t FSSession::StreamInputCallback(switch_core_session_t *session, v
} }
if (!cb_state->ret.IsEmpty()) { if (!cb_state->ret.IsEmpty()) {
Handle<Value> tmp = Handle<Value>::New(obj->GetOwner()->GetIsolate(), cb_state->ret); Handle<Value> tmp = Local<Value>::New(obj->GetOwner()->GetIsolate(), cb_state->ret);
String::Utf8Value str(tmp); String::Utf8Value str(tmp);
const char *ret = js_safe_str(*str); const char *ret = js_safe_str(*str);
@ -410,7 +410,7 @@ switch_status_t FSSession::RecordInputCallback(switch_core_session_t *session, v
} }
if (!cb_state->ret.IsEmpty()) { if (!cb_state->ret.IsEmpty()) {
Handle<Value> tmp = Handle<Value>::New(obj->GetOwner()->GetIsolate(), cb_state->ret); Handle<Value> tmp = Local<Value>::New(obj->GetOwner()->GetIsolate(), cb_state->ret);
String::Utf8Value str(tmp); String::Utf8Value str(tmp);
const char *ret = js_safe_str(*str); const char *ret = js_safe_str(*str);
@ -451,7 +451,7 @@ switch_status_t FSSession::CollectInputCallback(switch_core_session_t *session,
} }
if (!cb_state->ret.IsEmpty()) { if (!cb_state->ret.IsEmpty()) {
Handle<Value> tmp = Handle<Value>::New(obj->GetOwner()->GetIsolate(), cb_state->ret); Handle<Value> tmp = Local<Value>::New(obj->GetOwner()->GetIsolate(), cb_state->ret);
String::Utf8Value str(tmp); String::Utf8Value str(tmp);
ret = js_safe_str(*str); ret = js_safe_str(*str);
@ -703,7 +703,7 @@ bool FSSession::CheckHangupHook(FSSession *obj, bool *ret)
if (obj && !obj->_check_state && !obj->_on_hangup.IsEmpty() && (obj->_hook_state == CS_HANGUP || obj->_hook_state == CS_ROUTING)) { if (obj && !obj->_check_state && !obj->_on_hangup.IsEmpty() && (obj->_hook_state == CS_HANGUP || obj->_hook_state == CS_ROUTING)) {
obj->_check_state++; obj->_check_state++;
argv[argc++] = Handle<Object>::New(obj->GetOwner()->GetIsolate(), obj->GetJavaScriptObject()); argv[argc++] = Local<Object>::New(obj->GetOwner()->GetIsolate(), obj->GetJavaScriptObject());
if (obj->_hook_state == CS_HANGUP) { if (obj->_hook_state == CS_HANGUP) {
argv[argc++] = String::NewFromUtf8(isolate, "hangup"); argv[argc++] = String::NewFromUtf8(isolate, "hangup");
@ -712,7 +712,7 @@ bool FSSession::CheckHangupHook(FSSession *obj, bool *ret)
} }
// Run the hangup hook // Run the hangup hook
Handle<Function> func = Handle<Function>::New(isolate, obj->_on_hangup); Handle<Function> func = Local<Function>::New(isolate, obj->_on_hangup);
if (!func.IsEmpty() && func->IsFunction()) { if (!func.IsEmpty() && func->IsFunction()) {
Handle<Value> res = func->Call(isolate->GetCurrentContext()->Global(), argc, argv); Handle<Value> res = func->Call(isolate->GetCurrentContext()->Global(), argc, argv);

View File

@ -275,10 +275,10 @@ JS_TELETONE_FUNCTION_IMPL(Generate)
aargv[aargc++] = String::NewFromUtf8(info.GetIsolate(), dtmf); aargv[aargc++] = String::NewFromUtf8(info.GetIsolate(), dtmf);
if (!_arg.IsEmpty()) { if (!_arg.IsEmpty()) {
aargv[aargc++] = Handle<Value>::New(info.GetIsolate(), _arg); aargv[aargc++] = Local<Value>::New(info.GetIsolate(), _arg);
} }
Handle<Function> func = Handle<Function>::New(info.GetIsolate(), _function); Handle<Function> func = Local<Function>::New(info.GetIsolate(), _function);
Handle<Value> res = func->Call(info.GetIsolate()->GetCurrentContext()->Global(), aargc, aargv); Handle<Value> res = func->Call(info.GetIsolate()->GetCurrentContext()->Global(), aargc, aargv);
String::Utf8Value tmp(res); String::Utf8Value tmp(res);

View File

@ -83,7 +83,7 @@ JSBase::~JSBase(void)
Handle<Object> JSBase::GetJavaScriptObject() Handle<Object> JSBase::GetJavaScriptObject()
{ {
/* Returns the javascript object related to this C++ instance */ /* Returns the javascript object related to this C++ instance */
return Handle<Object>::New(GetIsolate(), *persistentHandle); return Local<Object>::New(GetIsolate(), *persistentHandle);
} }
void JSBase::AddInstance(Isolate *isolate, const Handle<Object>& handle, const Handle<External>& object, bool autoDestroy) void JSBase::AddInstance(Isolate *isolate, const Handle<Object>& handle, const Handle<External>& object, bool autoDestroy)

View File

@ -302,7 +302,7 @@ const string JSMain::ExecuteString(const string& scriptData, const string& fileN
TryCatch try_catch; TryCatch try_catch;
// Compile the source code. // Compile the source code.
Handle<Script> script = Script::Compile(source, Handle<Value>::New(isolate, String::NewFromUtf8(isolate, fileName.c_str()))); Handle<Script> script = Script::Compile(source, Local<Value>::New(isolate, String::NewFromUtf8(isolate, fileName.c_str())));
if (try_catch.HasCaught()) { if (try_catch.HasCaught()) {
res = JSMain::GetExceptionInfo(isolate, &try_catch); res = JSMain::GetExceptionInfo(isolate, &try_catch);