From 8b5fbb56299851896fbcf136bdcfdcd4487484b5 Mon Sep 17 00:00:00 2001 From: Lars Knoll <lars.knoll@digia.com> Date: Mon, 6 May 2013 15:57:06 +0200 Subject: [PATCH] Get rid of v8::Local The class was doing exactly the same thing as v8::Handle in our implementation. Removing it cleans up quite a bit of code. Change-Id: I37a3dcdef062fc388751e9ef0a158b5926ba2efb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> --- src/imports/localstorage/plugin.cpp | 38 +-- src/imports/testlib/main.cpp | 8 +- src/particles/qquickv8particledata.cpp | 18 +- src/qml/debugger/qv8profilerservice.cpp | 2 +- src/qml/qml/ftw/qhashedstring_p.h | 2 +- src/qml/qml/qqmlbinding.cpp | 4 +- src/qml/qml/qqmlcomponent.cpp | 40 +-- src/qml/qml/qqmlexpression.cpp | 4 +- src/qml/qml/qqmlexpression_p.h | 2 +- src/qml/qml/qqmljavascriptexpression.cpp | 36 +- src/qml/qml/qqmljavascriptexpression_p.h | 4 +- src/qml/qml/qqmllocale.cpp | 28 +- src/qml/qml/qqmlpropertycache_p.h | 2 +- src/qml/qml/qqmlvme.cpp | 6 +- src/qml/qml/qqmlvmemetaobject.cpp | 6 +- src/qml/qml/qqmlxmlhttprequest.cpp | 144 ++++---- src/qml/qml/v4/qv4v8.cpp | 318 +++++++++--------- src/qml/qml/v4/qv4v8_p.h | 226 +++++-------- src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 26 +- src/qml/qml/v8/qv4domerrors_p.h | 2 +- src/qml/qml/v8/qv8bindings.cpp | 10 +- src/qml/qml/v8/qv8contextwrapper.cpp | 30 +- src/qml/qml/v8/qv8contextwrapper_p.h | 16 +- src/qml/qml/v8/qv8engine.cpp | 30 +- src/qml/qml/v8/qv8engine_p.h | 16 +- src/qml/qml/v8/qv8include.cpp | 16 +- src/qml/qml/v8/qv8include_p.h | 2 +- src/qml/qml/v8/qv8listwrapper.cpp | 16 +- src/qml/qml/v8/qv8listwrapper_p.h | 8 +- src/qml/qml/v8/qv8qobjectwrapper.cpp | 80 ++--- src/qml/qml/v8/qv8qobjectwrapper_p.h | 10 +- src/qml/qml/v8/qv8sequencewrapper.cpp | 34 +- src/qml/qml/v8/qv8sequencewrapper_p.h | 20 +- src/qml/qml/v8/qv8sequencewrapper_p_p.h | 6 +- src/qml/qml/v8/qv8typewrapper.cpp | 16 +- src/qml/qml/v8/qv8typewrapper_p.h | 10 +- src/qml/qml/v8/qv8valuetypewrapper.cpp | 22 +- src/qml/qml/v8/qv8valuetypewrapper_p.h | 12 +- src/qml/qml/v8/qv8variantwrapper.cpp | 22 +- src/qml/qml/v8/qv8variantwrapper_p.h | 16 +- src/qml/qml/v8/qv8worker.cpp | 18 +- src/qml/types/qqmldelegatemodel.cpp | 100 +++--- src/qml/types/qqmldelegatemodel_p_p.h | 20 +- src/qml/types/qqmllistmodel.cpp | 12 +- src/qml/types/qquickworkerscript.cpp | 18 +- src/qml/util/qqmladaptormodel.cpp | 28 +- src/qmltest/quicktestresult.cpp | 4 +- src/quick/items/context2d/qquickcontext2d.cpp | 114 +++---- src/quick/items/context2d/qquickcontext2d_p.h | 4 +- src/quick/items/qquickdrag.cpp | 2 +- src/quick/items/qquickdroparea.cpp | 2 +- src/quick/items/qquickitem.cpp | 8 +- src/quick/items/qquickloader.cpp | 6 +- src/quick/items/qquicktextinput.cpp | 2 +- 54 files changed, 800 insertions(+), 846 deletions(-) diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index 66c3365375..6e96c683b8 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -59,7 +59,7 @@ #define V8THROW_SQL(error, desc) \ { \ - v8::Local<v8::Value> v = v8::Exception::Error(engine->toString(desc)); \ + v8::Handle<v8::Value> v = v8::Exception::Error(engine->toString(desc)); \ v->ToObject()->Set(v8::String::New("code"), v8::Integer::New(error)); \ v8::ThrowException(v); \ return v8::Handle<v8::Value>(); \ @@ -67,7 +67,7 @@ #define V8THROW_SQL_VOID(error, desc) \ { \ - v8::Local<v8::Value> v = v8::Exception::Error(engine->toString(desc)); \ + v8::Handle<v8::Value> v = v8::Exception::Error(engine->toString(desc)); \ v->ToObject()->Set(v8::String::New("code"), v8::Integer::New(error)); \ v8::ThrowException(v); \ return; \ @@ -120,7 +120,7 @@ public: bool forwardOnly; // type == Rows }; -static v8::Handle<v8::Value> qmlsqldatabase_version(v8::Local<v8::String> /* property */, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> qmlsqldatabase_version(v8::Handle<v8::String> /* property */, const v8::AccessorInfo& info) { QV8SqlDatabaseResource *r = v8_resource_cast<QV8SqlDatabaseResource>(info.This()); if (!r || r->type != QV8SqlDatabaseResource::Database) @@ -129,7 +129,7 @@ static v8::Handle<v8::Value> qmlsqldatabase_version(v8::Local<v8::String> /* pro return r->engine->toString(r->version); } -static v8::Handle<v8::Value> qmlsqldatabase_rows_length(v8::Local<v8::String> /* property */, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> qmlsqldatabase_rows_length(v8::Handle<v8::String> /* property */, const v8::AccessorInfo& info) { QV8SqlDatabaseResource *r = v8_resource_cast<QV8SqlDatabaseResource>(info.This()); if (!r || r->type != QV8SqlDatabaseResource::Rows) @@ -147,7 +147,7 @@ static v8::Handle<v8::Value> qmlsqldatabase_rows_length(v8::Local<v8::String> /* return v8::Integer::New(s); } -static v8::Handle<v8::Value> qmlsqldatabase_rows_forwardOnly(v8::Local<v8::String> /* property */, +static v8::Handle<v8::Value> qmlsqldatabase_rows_forwardOnly(v8::Handle<v8::String> /* property */, const v8::AccessorInfo& info) { QV8SqlDatabaseResource *r = v8_resource_cast<QV8SqlDatabaseResource>(info.This()); @@ -156,8 +156,8 @@ static v8::Handle<v8::Value> qmlsqldatabase_rows_forwardOnly(v8::Local<v8::Strin return v8::Boolean::New(r->query.isForwardOnly()); } -static void qmlsqldatabase_rows_setForwardOnly(v8::Local<v8::String> /* property */, - v8::Local<v8::Value> value, +static void qmlsqldatabase_rows_setForwardOnly(v8::Handle<v8::String> /* property */, + v8::Handle<v8::Value> value, const v8::AccessorInfo& info) { QV8SqlDatabaseResource *r = v8_resource_cast<QV8SqlDatabaseResource>(info.This()); @@ -196,7 +196,7 @@ static v8::Handle<v8::Value> qmlsqldatabase_rows_index(QV8SqlDatabaseResource *r QSqlRecord record = r->query.record(); // XXX optimize - v8::Local<v8::Object> row = v8::Object::New(); + v8::Handle<v8::Object> row = v8::Object::New(); for (int ii = 0; ii < record.count(); ++ii) { QVariant v = record.value(ii); if (v.isNull()) { @@ -256,15 +256,15 @@ static v8::Handle<v8::Value> qmlsqldatabase_executeSql(const v8::Arguments& args if (query.prepare(sql)) { if (args.Length() > 1) { - v8::Local<v8::Value> values = args[1]; + v8::Handle<v8::Value> values = args[1]; if (values->IsArray()) { - v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(values); + v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(values); uint32_t size = array->Length(); for (uint32_t ii = 0; ii < size; ++ii) query.bindValue(ii, engine->toVariant(array->Get(ii)->v4Value(), -1)); } else if (values->IsObject() && !values->ToObject()->GetExternalResource()) { - v8::Local<v8::Object> object = values->ToObject(); - v8::Local<v8::Array> names = object->GetPropertyNames(); + v8::Handle<v8::Object> object = values->ToObject(); + v8::Handle<v8::Array> names = object->GetPropertyNames(); uint32_t size = names->Length(); for (uint32_t ii = 0; ii < size; ++ii) query.bindValue(names->Get(ii)->v4Value().toQString(), @@ -281,7 +281,7 @@ static v8::Handle<v8::Value> qmlsqldatabase_executeSql(const v8::Arguments& args r->query = query; rows->SetExternalResource(r); - v8::Local<v8::Object> resultObject = v8::Object::New(); + v8::Handle<v8::Object> resultObject = v8::Object::New(); result = resultObject; // XXX optimize resultObject->Set(v8::String::New("rowsAffected"), v8::Integer::New(query.numRowsAffected())); @@ -318,7 +318,7 @@ static v8::Handle<v8::Value> qmlsqldatabase_changeVersion(const v8::Arguments& a if (from_version != r->version) V8THROW_SQL(SQLEXCEPTION_VERSION_ERR, QQmlEngine::tr("Version mismatch: expected %1, found %2").arg(from_version).arg(r->version)); - v8::Local<v8::Object> instance = databaseData(engine)->queryConstructor->NewInstance(); + v8::Handle<v8::Object> instance = databaseData(engine)->queryConstructor->NewInstance(); QV8SqlDatabaseResource *r2 = new QV8SqlDatabaseResource(engine); r2->type = QV8SqlDatabaseResource::Query; r2->database = db; @@ -374,7 +374,7 @@ static v8::Handle<v8::Value> qmlsqldatabase_transaction_shared(const v8::Argumen QSqlDatabase db = r->database; v8::Handle<v8::Function> callback = v8::Handle<v8::Function>::Cast(args[0]); - v8::Local<v8::Object> instance = databaseData(engine)->queryConstructor->NewInstance(); + v8::Handle<v8::Object> instance = databaseData(engine)->queryConstructor->NewInstance(); QV8SqlDatabaseResource *q = new QV8SqlDatabaseResource(engine); q->type = QV8SqlDatabaseResource::Query; q->database = db; @@ -413,7 +413,7 @@ static v8::Handle<v8::Value> qmlsqldatabase_read_transaction(const v8::Arguments QQmlSqlDatabaseData::QQmlSqlDatabaseData(QV8Engine *engine) { { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetHasExternalResource(true); ft->PrototypeTemplate()->Set(v8::String::New("transaction"), V8FUNCTION(qmlsqldatabase_transaction, engine)); @@ -426,14 +426,14 @@ QQmlSqlDatabaseData::QQmlSqlDatabaseData(QV8Engine *engine) } { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetHasExternalResource(true); ft->PrototypeTemplate()->Set(v8::String::New("executeSql"), V8FUNCTION(qmlsqldatabase_executeSql, engine)); queryConstructor = qPersistentNew<v8::Function>(ft->GetFunction()); } { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetHasExternalResource(true); ft->PrototypeTemplate()->Set(v8::String::New("item"), V8FUNCTION(qmlsqldatabase_rows_item, engine)); ft->PrototypeTemplate()->SetAccessor(v8::String::New("length"), qmlsqldatabase_rows_length); @@ -657,7 +657,7 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV8Function *args) database.open(); } - v8::Local<v8::Object> instance = databaseData(engine)->constructor->NewInstance(); + v8::Handle<v8::Object> instance = databaseData(engine)->constructor->NewInstance(); QV8SqlDatabaseResource *r = new QV8SqlDatabaseResource(engine); r->database = database; diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp index c0ce046fd8..bd13056dcb 100644 --- a/src/imports/testlib/main.cpp +++ b/src/imports/testlib/main.cpp @@ -106,20 +106,20 @@ public Q_SLOTS: QQmlV4Handle callerFile(int frameIndex = 0) const { - v8::Local<v8::StackTrace> stacks = v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed); + v8::Handle<v8::StackTrace> stacks = v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed); int count = stacks->GetFrameCount(); if (count >= frameIndex + 1) { - v8::Local<v8::StackFrame> frame = stacks->GetFrame(frameIndex + 1); + v8::Handle<v8::StackFrame> frame = stacks->GetFrame(frameIndex + 1); return QQmlV4Handle::fromV8Handle(frame->GetScriptNameOrSourceURL()); } return QQmlV4Handle(); } int callerLine(int frameIndex = 0) const { - v8::Local<v8::StackTrace> stacks = v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed); + v8::Handle<v8::StackTrace> stacks = v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed); int count = stacks->GetFrameCount(); if (count >= frameIndex + 1) { - v8::Local<v8::StackFrame> frame = stacks->GetFrame(frameIndex + 1); + v8::Handle<v8::StackFrame> frame = stacks->GetFrame(frameIndex + 1); return frame->GetLineNumber(); } return -1; diff --git a/src/particles/qquickv8particledata.cpp b/src/particles/qquickv8particledata.cpp index 5389d441a0..674a09f34e 100644 --- a/src/particles/qquickv8particledata.cpp +++ b/src/particles/qquickv8particledata.cpp @@ -314,7 +314,7 @@ static v8::Handle<v8::Value> particleData_curSize(const v8::Arguments &args) return v8::Number::New(r->datum->curSize()); } -#define COLOR_GETTER_AND_SETTER(VAR, NAME) static v8::Handle<v8::Value> particleData_get_ ## NAME (v8::Local<v8::String>, const v8::AccessorInfo &info) \ +#define COLOR_GETTER_AND_SETTER(VAR, NAME) static v8::Handle<v8::Value> particleData_get_ ## NAME (v8::Handle<v8::String>, const v8::AccessorInfo &info) \ { \ QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(info.This()); \ if (!r || !r->datum) \ @@ -323,7 +323,7 @@ static v8::Handle<v8::Value> particleData_curSize(const v8::Arguments &args) return v8::Number::New((r->datum->color. VAR )/255.0);\ }\ \ -static void particleData_set_ ## NAME (v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info)\ +static void particleData_set_ ## NAME (v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info)\ {\ QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(info.This());\ if (!r || !r->datum)\ @@ -333,7 +333,7 @@ static void particleData_set_ ## NAME (v8::Local<v8::String>, v8::Local<v8::Valu } -#define SEMIBOOL_GETTER_AND_SETTER(VARIABLE) static v8::Handle<v8::Value> particleData_get_ ## VARIABLE (v8::Local<v8::String>, const v8::AccessorInfo &info) \ +#define SEMIBOOL_GETTER_AND_SETTER(VARIABLE) static v8::Handle<v8::Value> particleData_get_ ## VARIABLE (v8::Handle<v8::String>, const v8::AccessorInfo &info) \ { \ QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(info.This()); \ if (!r || !r->datum) \ @@ -342,7 +342,7 @@ static void particleData_set_ ## NAME (v8::Local<v8::String>, v8::Local<v8::Valu return v8::Boolean::New(r->datum-> VARIABLE);\ }\ \ -static void particleData_set_ ## VARIABLE (v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info)\ +static void particleData_set_ ## VARIABLE (v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info)\ {\ QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(info.This());\ if (!r || !r->datum)\ @@ -351,7 +351,7 @@ static void particleData_set_ ## VARIABLE (v8::Local<v8::String>, v8::Local<v8:: r->datum-> VARIABLE = value->BooleanValue() ? 1.0 : 0.0;\ } -#define FLOAT_GETTER_AND_SETTER(VARIABLE) static v8::Handle<v8::Value> particleData_get_ ## VARIABLE (v8::Local<v8::String>, const v8::AccessorInfo &info) \ +#define FLOAT_GETTER_AND_SETTER(VARIABLE) static v8::Handle<v8::Value> particleData_get_ ## VARIABLE (v8::Handle<v8::String>, const v8::AccessorInfo &info) \ { \ QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(info.This()); \ if (!r || !r->datum) \ @@ -360,7 +360,7 @@ static void particleData_set_ ## VARIABLE (v8::Local<v8::String>, v8::Local<v8:: return v8::Number::New(r->datum-> VARIABLE);\ }\ \ -static void particleData_set_ ## VARIABLE (v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info)\ +static void particleData_set_ ## VARIABLE (v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info)\ {\ QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(info.This());\ if (!r || !r->datum)\ @@ -369,7 +369,7 @@ static void particleData_set_ ## VARIABLE (v8::Local<v8::String>, v8::Local<v8:: r->datum-> VARIABLE = value->NumberValue();\ } -#define FAKE_FLOAT_GETTER_AND_SETTER(VARIABLE, GETTER, SETTER) static v8::Handle<v8::Value> particleData_get_ ## VARIABLE (v8::Local<v8::String>, const v8::AccessorInfo &info) \ +#define FAKE_FLOAT_GETTER_AND_SETTER(VARIABLE, GETTER, SETTER) static v8::Handle<v8::Value> particleData_get_ ## VARIABLE (v8::Handle<v8::String>, const v8::AccessorInfo &info) \ { \ QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(info.This()); \ if (!r || !r->datum) \ @@ -378,7 +378,7 @@ static void particleData_set_ ## VARIABLE (v8::Local<v8::String>, v8::Local<v8:: return v8::Number::New(r->datum-> GETTER ());\ }\ \ -static void particleData_set_ ## VARIABLE (v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info)\ +static void particleData_set_ ## VARIABLE (v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info)\ {\ QV8ParticleDataResource *r = v8_resource_cast<QV8ParticleDataResource>(info.This());\ if (!r || !r->datum)\ @@ -426,7 +426,7 @@ FAKE_FLOAT_GETTER_AND_SETTER(curAY, curAY, setInstantaneousAY) QV8ParticleDataDeletable::QV8ParticleDataDeletable(QV8Engine *engine) { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetHasExternalResource(true); ft->PrototypeTemplate()->Set(v8::String::New("discard"), V8FUNCTION(particleData_discard, engine)); ft->PrototypeTemplate()->Set(v8::String::New("lifeLeft"), V8FUNCTION(particleData_lifeLeft, engine)); diff --git a/src/qml/debugger/qv8profilerservice.cpp b/src/qml/debugger/qv8profilerservice.cpp index 6055e81589..28f2aba558 100644 --- a/src/qml/debugger/qv8profilerservice.cpp +++ b/src/qml/debugger/qv8profilerservice.cpp @@ -292,7 +292,7 @@ void QV8ProfilerServicePrivate::takeSnapshot(v8::HeapSnapshot::Type snapshotType Q_Q(QV8ProfilerService); v8::HandleScope scope; - v8::Local<v8::String> title = v8::String::New(""); + v8::Handle<v8::String> title = v8::String::New(""); DebugServiceOutputStream outputStream; const v8::HeapSnapshot *snapshot = v8::HeapProfiler::TakeSnapshot(title, snapshotType); diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h index 990fbc516f..cce49709a7 100644 --- a/src/qml/qml/ftw/qhashedstring_p.h +++ b/src/qml/qml/ftw/qhashedstring_p.h @@ -263,7 +263,7 @@ public: inline uint16_t *utf16Data() const { return (uint16_t *)strData->data(); } inline bool equals(v8::Handle<v8::String> string) const { - v8::Local<v8::String> data = isQString() ? v8::String::New(utf16Data(), length) + v8::Handle<v8::String> data = isQString() ? v8::String::New(utf16Data(), length) : v8::String::New(cStrData(), length); return string->Equals(data); } diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index 284a0afdcc..4aebec4d60 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -278,7 +278,7 @@ void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags) bool isUndefined = false; - v8::Local<v8::Value> result = + v8::Handle<v8::Value> result = QQmlJavaScriptExpression::evaluate(context(), **v4function, &isUndefined); trace.event("writing binding result"); @@ -319,7 +319,7 @@ QVariant QQmlBinding::evaluate() bool isUndefined = false; - v8::Local<v8::Value> result = + v8::Handle<v8::Value> result = QQmlJavaScriptExpression::evaluate(context(), **v4function, &isUndefined); ep->dereferenceScarceResources(); diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index cdca8049ed..75da534bc7 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1086,17 +1086,17 @@ V8_RESOURCE_TYPE(IncubatorType) public: QV8IncubatorResource(QV8Engine *engine, IncubationMode = Asynchronous); - static v8::Handle<v8::Value> StatusChangedGetter(v8::Local<v8::String>, + static v8::Handle<v8::Value> StatusChangedGetter(v8::Handle<v8::String>, const v8::AccessorInfo& info); - static v8::Handle<v8::Value> StatusGetter(v8::Local<v8::String>, + static v8::Handle<v8::Value> StatusGetter(v8::Handle<v8::String>, const v8::AccessorInfo& info); - static v8::Handle<v8::Value> ObjectGetter(v8::Local<v8::String>, + static v8::Handle<v8::Value> ObjectGetter(v8::Handle<v8::String>, const v8::AccessorInfo& info); - static v8::Handle<v8::Value> ForceCompletionGetter(v8::Local<v8::String>, + static v8::Handle<v8::Value> ForceCompletionGetter(v8::Handle<v8::String>, const v8::AccessorInfo& info); static v8::Handle<v8::Value> ForceCompletion(const v8::Arguments &args); - static void StatusChangedSetter(v8::Local<v8::String>, v8::Local<v8::Value> value, + static void StatusChangedSetter(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo& info); void dispose(); @@ -1184,19 +1184,19 @@ void QQmlComponent::createObject(QQmlV8Function *args) Q_ASSERT(args); QObject *parent = 0; - v8::Local<v8::Object> valuemap; + v8::Handle<v8::Object> valuemap; if (args->Length() >= 1) parent = args->engine()->toQObject((*args)[0]->v4Value()); if (args->Length() >= 2) { - v8::Local<v8::Value> v = (*args)[1]; + v8::Handle<v8::Value> v = (*args)[1]; if (!v->IsObject() || v->IsArray()) { qmlInfo(this) << tr("createObject: value is not an object"); args->returnValue(v8::Null()); return; } - valuemap = v8::Local<v8::Object>::Cast(v); + valuemap = v8::Handle<v8::Object>::Cast(v); } QV8Engine *v8engine = args->engine(); @@ -1304,21 +1304,21 @@ void QQmlComponent::incubateObject(QQmlV8Function *args) Q_ASSERT(args); QObject *parent = 0; - v8::Local<v8::Object> valuemap; + v8::Handle<v8::Object> valuemap; QQmlIncubator::IncubationMode mode = QQmlIncubator::Asynchronous; if (args->Length() >= 1) parent = args->engine()->toQObject((*args)[0]->v4Value()); if (args->Length() >= 2) { - v8::Local<v8::Value> v = (*args)[1]; + v8::Handle<v8::Value> v = (*args)[1]; if (v->IsNull()) { } else if (!v->IsObject() || v->IsArray()) { qmlInfo(this) << tr("createObject: value is not an object"); args->returnValue(v8::Null()); return; } else { - valuemap = v8::Local<v8::Object>::Cast(v); + valuemap = v8::Handle<v8::Object>::Cast(v); } } @@ -1333,7 +1333,7 @@ void QQmlComponent::incubateObject(QQmlV8Function *args) QQmlComponentExtension *e = componentExtension(args->engine()); QV8IncubatorResource *r = new QV8IncubatorResource(args->engine(), mode); - v8::Local<v8::Object> o = e->incubationConstructor->NewInstance(); + v8::Handle<v8::Object> o = e->incubationConstructor->NewInstance(); o->SetExternalResource(r); if (!valuemap.IsEmpty()) { @@ -1378,7 +1378,7 @@ QQmlComponentExtension::QQmlComponentExtension(QV8Engine *engine) forceCompletion = qPersistentNew(V8FUNCTION(QV8IncubatorResource::ForceCompletion, engine)); { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetHasExternalResource(true); ft->InstanceTemplate()->SetInternalFieldCount(1); ft->InstanceTemplate()->SetAccessor(v8::String::New("onStatusChanged"), @@ -1394,14 +1394,14 @@ QQmlComponentExtension::QQmlComponentExtension(QV8Engine *engine) } } -v8::Handle<v8::Value> QV8IncubatorResource::ObjectGetter(v8::Local<v8::String>, +v8::Handle<v8::Value> QV8IncubatorResource::ObjectGetter(v8::Handle<v8::String>, const v8::AccessorInfo& info) { QV8IncubatorResource *r = v8_resource_check<QV8IncubatorResource>(info.This()); return r->engine->newQObject(r->object()); } -v8::Handle<v8::Value> QV8IncubatorResource::ForceCompletionGetter(v8::Local<v8::String>, +v8::Handle<v8::Value> QV8IncubatorResource::ForceCompletionGetter(v8::Handle<v8::String>, const v8::AccessorInfo& info) { QV8IncubatorResource *r = v8_resource_check<QV8IncubatorResource>(info.This()); @@ -1419,20 +1419,20 @@ v8::Handle<v8::Value> QV8IncubatorResource::ForceCompletion(const v8::Arguments return v8::Undefined(); } -v8::Handle<v8::Value> QV8IncubatorResource::StatusGetter(v8::Local<v8::String>, +v8::Handle<v8::Value> QV8IncubatorResource::StatusGetter(v8::Handle<v8::String>, const v8::AccessorInfo& info) { QV8IncubatorResource *r = v8_resource_check<QV8IncubatorResource>(info.This()); return v8::Integer::NewFromUnsigned(r->status()); } -v8::Handle<v8::Value> QV8IncubatorResource::StatusChangedGetter(v8::Local<v8::String>, +v8::Handle<v8::Value> QV8IncubatorResource::StatusChangedGetter(v8::Handle<v8::String>, const v8::AccessorInfo& info) { return info.This()->GetInternalField(0); } -void QV8IncubatorResource::StatusChangedSetter(v8::Local<v8::String>, v8::Local<v8::Value> value, +void QV8IncubatorResource::StatusChangedSetter(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo& info) { info.This()->SetInternalField(0, value); @@ -1481,12 +1481,12 @@ void QV8IncubatorResource::statusChanged(Status s) } if (!me.IsEmpty()) { // Will be false in synchronous mode - v8::Local<v8::Value> callback = me->GetInternalField(0); + v8::Handle<v8::Value> callback = me->GetInternalField(0); if (!callback.IsEmpty() && !callback->IsUndefined()) { if (callback->IsFunction()) { - v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(callback); + v8::Handle<v8::Function> f = v8::Handle<v8::Function>::Cast(callback); v8::Handle<v8::Value> args[] = { v8::Integer::NewFromUnsigned(s) }; v8::TryCatch tc; f->Call(me, 1, args); diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp index 5a51cd10da..29f53f3372 100644 --- a/src/qml/qml/qqmlexpression.cpp +++ b/src/qml/qml/qqmlexpression.cpp @@ -340,7 +340,7 @@ void QQmlExpression::setExpression(const QString &expression) } // Must be called with a valid handle scope -v8::Local<v8::Value> QQmlExpressionPrivate::v8value(bool *isUndefined) +v8::Handle<v8::Value> QQmlExpressionPrivate::v8value(bool *isUndefined) { if (!expressionFunctionValid) { bool ok = true; @@ -376,7 +376,7 @@ QVariant QQmlExpressionPrivate::value(bool *isUndefined) ep->referenceScarceResources(); // "hold" scarce resources in memory during evaluation. { - v8::Local<v8::Value> result = v8value(isUndefined); + v8::Handle<v8::Value> result = v8value(isUndefined); rv = ep->v8engine()->toVariant(result->v4Value(), -1); } diff --git a/src/qml/qml/qqmlexpression_p.h b/src/qml/qml/qqmlexpression_p.h index 5efb21b9ff..e31d189d6d 100644 --- a/src/qml/qml/qqmlexpression_p.h +++ b/src/qml/qml/qqmlexpression_p.h @@ -84,7 +84,7 @@ public: QVariant value(bool *isUndefined = 0); - v8::Local<v8::Value> v8value(bool *isUndefined = 0); + v8::Handle<v8::Value> v8value(bool *isUndefined = 0); static inline QQmlExpressionPrivate *get(QQmlExpression *expr); static inline QQmlExpression *get(QQmlExpressionPrivate *expr); diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 031a20b8a7..05c6c242ba 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -119,14 +119,14 @@ void QQmlJavaScriptExpression::resetNotifyOnValueChanged() clearGuards(); } -v8::Local<v8::Value> +v8::Handle<v8::Value> QQmlJavaScriptExpression::evaluate(QQmlContextData *context, v8::Handle<v8::Function> function, bool *isUndefined) { return evaluate(context, function, 0, 0, isUndefined); } -v8::Local<v8::Value> +v8::Handle<v8::Value> QQmlJavaScriptExpression::evaluate(QQmlContextData *context, v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> args[], @@ -136,7 +136,7 @@ QQmlJavaScriptExpression::evaluate(QQmlContextData *context, if (function.IsEmpty() || function->IsUndefined()) { if (isUndefined) *isUndefined = true; - return v8::Local<v8::Value>(); + return v8::Handle<v8::Value>(); } QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context->engine); @@ -167,7 +167,7 @@ QQmlJavaScriptExpression::evaluate(QQmlContextData *context, ep->sharedScope = scopeObject(); } - v8::Local<v8::Value> result; + v8::Handle<v8::Value> result; { v8::TryCatch try_catch; v8::Handle<v8::Object> This = v8::Value::fromV4Value(ep->v8engine()->global()); @@ -183,7 +183,7 @@ QQmlJavaScriptExpression::evaluate(QQmlContextData *context, if (watcher.wasDeleted()) { } else if (try_catch.HasCaught()) { - v8::Local<v8::Message> message = try_catch.Message(); + v8::Handle<v8::Message> message = try_catch.Message(); if (!message.IsEmpty()) { delayedError()->setMessage(message); } else { @@ -309,7 +309,7 @@ void QQmlJavaScriptExpression::exceptionToError(v8::Handle<v8::Message> message, v8::Handle<v8::String> description = message->Get(); int lineNumber = message->GetLineNumber(); - v8::Local<v8::String> file = name->IsString()?name->ToString():v8::Local<v8::String>(); + v8::Handle<v8::String> file = name->IsString()?name->ToString():v8::Handle<v8::String>(); if (file.IsEmpty() || file->Length() == 0) error.setUrl(QUrl()); else @@ -336,33 +336,33 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scope, QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine); v8::TryCatch tc; - v8::Local<v8::Object> scopeobject = ep->v8engine()->qmlScope(ctxt, scope); - v8::Local<v8::Script> script = ep->v8engine()->qmlModeCompile(code, codeLength, filename, line); + v8::Handle<v8::Object> scopeobject = ep->v8engine()->qmlScope(ctxt, scope); + v8::Handle<v8::Script> script = ep->v8engine()->qmlModeCompile(code, codeLength, filename, line); if (tc.HasCaught()) { QQmlError error; error.setDescription(QLatin1String("Exception occurred during function compilation")); error.setLine(line); error.setUrl(QUrl::fromLocalFile(filename)); - v8::Local<v8::Message> message = tc.Message(); + v8::Handle<v8::Message> message = tc.Message(); if (!message.IsEmpty()) QQmlExpressionPrivate::exceptionToError(message, error); ep->warning(error); return v8::Persistent<v8::Function>(); } - v8::Local<v8::Value> result = script->Run(scopeobject); + v8::Handle<v8::Value> result = script->Run(scopeobject); if (tc.HasCaught()) { QQmlError error; error.setDescription(QLatin1String("Exception occurred during function evaluation")); error.setLine(line); error.setUrl(QUrl::fromLocalFile(filename)); - v8::Local<v8::Message> message = tc.Message(); + v8::Handle<v8::Message> message = tc.Message(); if (!message.IsEmpty()) QQmlExpressionPrivate::exceptionToError(message, error); ep->warning(error); return v8::Persistent<v8::Function>(); } if (qmlscope) *qmlscope = qPersistentNew<v8::Object>(scopeobject); - return qPersistentNew<v8::Function>(v8::Local<v8::Function>::Cast(result)); + return qPersistentNew<v8::Function>(v8::Handle<v8::Function>::Cast(result)); } // Callee owns the persistent handle @@ -375,33 +375,33 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scope, QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine); v8::TryCatch tc; - v8::Local<v8::Object> scopeobject = ep->v8engine()->qmlScope(ctxt, scope); - v8::Local<v8::Script> script = ep->v8engine()->qmlModeCompile(code, filename, line); + v8::Handle<v8::Object> scopeobject = ep->v8engine()->qmlScope(ctxt, scope); + v8::Handle<v8::Script> script = ep->v8engine()->qmlModeCompile(code, filename, line); if (tc.HasCaught()) { QQmlError error; error.setDescription(QLatin1String("Exception occurred during function compilation")); error.setLine(line); error.setUrl(QUrl::fromLocalFile(filename)); - v8::Local<v8::Message> message = tc.Message(); + v8::Handle<v8::Message> message = tc.Message(); if (!message.IsEmpty()) QQmlExpressionPrivate::exceptionToError(message, error); ep->warning(error); return v8::Persistent<v8::Function>(); } - v8::Local<v8::Value> result = script->Run(scopeobject); + v8::Handle<v8::Value> result = script->Run(scopeobject); if (tc.HasCaught()) { QQmlError error; error.setDescription(QLatin1String("Exception occurred during function evaluation")); error.setLine(line); error.setUrl(QUrl::fromLocalFile(filename)); - v8::Local<v8::Message> message = tc.Message(); + v8::Handle<v8::Message> message = tc.Message(); if (!message.IsEmpty()) QQmlExpressionPrivate::exceptionToError(message, error); ep->warning(error); return v8::Persistent<v8::Function>(); } if (qmlscope) *qmlscope = qPersistentNew<v8::Object>(scopeobject); - return qPersistentNew<v8::Function>(v8::Local<v8::Function>::Cast(result)); + return qPersistentNew<v8::Function>(v8::Handle<v8::Function>::Cast(result)); } void QQmlJavaScriptExpression::clearGuards() diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h index c48972e6a1..c1d3d1395f 100644 --- a/src/qml/qml/qqmljavascriptexpression_p.h +++ b/src/qml/qml/qqmljavascriptexpression_p.h @@ -110,9 +110,9 @@ public: QQmlJavaScriptExpression(VTable *vtable); - v8::Local<v8::Value> evaluate(QQmlContextData *, v8::Handle<v8::Function>, + v8::Handle<v8::Value> evaluate(QQmlContextData *, v8::Handle<v8::Function>, bool *isUndefined); - v8::Local<v8::Value> evaluate(QQmlContextData *, v8::Handle<v8::Function>, + v8::Handle<v8::Value> evaluate(QQmlContextData *, v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> args[], bool *isUndefined); diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index 3cc811c8a6..0d50977fae 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -142,12 +142,12 @@ static const char dateTimeZoneUpdatedFunction[] = static void registerFunction(QV8Engine *engine, const char *script, v8::InvocationCallback func) { - v8::Local<v8::Script> registerScript = v8::Script::New(v8::String::New(script), 0, 0, v8::Handle<v8::String>(), v8::Script::NativeMode); - v8::Local<v8::Value> result = registerScript->Run(); + v8::Handle<v8::Script> registerScript = v8::Script::New(v8::String::New(script), 0, 0, v8::Handle<v8::String>(), v8::Script::NativeMode); + v8::Handle<v8::Value> result = registerScript->Run(); Q_ASSERT(result->IsFunction()); - v8::Local<v8::Function> registerFunc = v8::Local<v8::Function>::Cast(result); + v8::Handle<v8::Function> registerFunc = v8::Handle<v8::Function>::Cast(result); v8::Handle<v8::Value> args = V8FUNCTION(func, engine); - registerFunc->Call(v8::Local<v8::Object>::Cast(registerFunc), 1, &args); + registerFunc->Call(v8::Handle<v8::Object>::Cast(registerFunc), 1, &args); } void QQmlDateExtension::registerExtension(QV8Engine *engine) @@ -469,7 +469,7 @@ v8::Handle<v8::Value> QQmlNumberExtension::toLocaleString(const v8::Arguments& a if (args.Length() > 1) { if (!args[1]->IsString()) V8THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments"); - v8::Local<v8::String> fs = args[1]->ToString(); + v8::Handle<v8::String> fs = args[1]->ToString(); if (!fs.IsEmpty() && fs->Length()) { v8::String::Value value(fs); Q_ASSERT(*value != NULL); @@ -532,7 +532,7 @@ v8::Handle<v8::Value> QQmlNumberExtension::fromLocaleString(const v8::Arguments& numberIdx = 1; } - v8::Local<v8::String> ns = args[numberIdx]->ToString(); + v8::Handle<v8::String> ns = args[numberIdx]->ToString(); if (ns.IsEmpty() || ns->Length() == 0) return v8::Number::New(Q_QNAN); @@ -548,7 +548,7 @@ v8::Handle<v8::Value> QQmlNumberExtension::fromLocaleString(const v8::Arguments& //-------------- // Locale object -static v8::Handle<v8::Value> locale_get_firstDayOfWeek(v8::Local<v8::String>, const v8::AccessorInfo &info) +static v8::Handle<v8::Value> locale_get_firstDayOfWeek(v8::Handle<v8::String>, const v8::AccessorInfo &info) { GET_LOCALE_DATA_RESOURCE(info.This()); int fdow = int(r->locale.firstDayOfWeek()); @@ -557,19 +557,19 @@ static v8::Handle<v8::Value> locale_get_firstDayOfWeek(v8::Local<v8::String>, co return v8::Integer::New(fdow); } -static v8::Handle<v8::Value> locale_get_measurementSystem(v8::Local<v8::String>, const v8::AccessorInfo &info) +static v8::Handle<v8::Value> locale_get_measurementSystem(v8::Handle<v8::String>, const v8::AccessorInfo &info) { GET_LOCALE_DATA_RESOURCE(info.This()); return v8::Integer::New(r->locale.measurementSystem()); } -static v8::Handle<v8::Value> locale_get_textDirection(v8::Local<v8::String>, const v8::AccessorInfo &info) +static v8::Handle<v8::Value> locale_get_textDirection(v8::Handle<v8::String>, const v8::AccessorInfo &info) { GET_LOCALE_DATA_RESOURCE(info.This()); return v8::Integer::New(r->locale.textDirection()); } -static v8::Handle<v8::Value> locale_get_weekDays(v8::Local<v8::String>, const v8::AccessorInfo &info) +static v8::Handle<v8::Value> locale_get_weekDays(v8::Handle<v8::String>, const v8::AccessorInfo &info) { GET_LOCALE_DATA_RESOURCE(info.This()); @@ -586,7 +586,7 @@ static v8::Handle<v8::Value> locale_get_weekDays(v8::Local<v8::String>, const v8 return result; } -static v8::Handle<v8::Value> locale_get_uiLanguages(v8::Local<v8::String>, const v8::AccessorInfo &info) +static v8::Handle<v8::Value> locale_get_uiLanguages(v8::Handle<v8::String>, const v8::AccessorInfo &info) { GET_LOCALE_DATA_RESOURCE(info.This()); @@ -692,7 +692,7 @@ LOCALE_FORMATTED_MONTHNAME(standaloneMonthName) LOCALE_FORMATTED_DAYNAME(dayName) LOCALE_FORMATTED_DAYNAME(standaloneDayName) -#define LOCALE_STRING_PROPERTY(VARIABLE) static v8::Handle<v8::Value> locale_get_ ## VARIABLE (v8::Local<v8::String>, const v8::AccessorInfo &info) \ +#define LOCALE_STRING_PROPERTY(VARIABLE) static v8::Handle<v8::Value> locale_get_ ## VARIABLE (v8::Handle<v8::String>, const v8::AccessorInfo &info) \ { \ GET_LOCALE_DATA_RESOURCE(info.This()); \ return r->engine->toString(r->locale. VARIABLE());\ @@ -726,7 +726,7 @@ public: QV8LocaleDataDeletable::QV8LocaleDataDeletable(QV8Engine *engine) { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetHasExternalResource(true); LOCALE_REGISTER_STRING_ACCESSOR(ft, name); @@ -874,7 +874,7 @@ QQmlLocale::~QQmlLocale() v8::Handle<v8::Value> QQmlLocale::locale(QV8Engine *v8engine, const QString &locale) { QV8LocaleDataDeletable *d = localeV8Data(v8engine); - v8::Local<v8::Object> v8Value = d->constructor->NewInstance(); + v8::Handle<v8::Object> v8Value = d->constructor->NewInstance(); QV8LocaleDataResource *r = new QV8LocaleDataResource(v8engine); if (locale.isEmpty()) r->locale = QLocale(); diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index c1c7cc236f..4f608e1d56 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -348,7 +348,7 @@ private: QQmlPropertyData::Flag signalFlags = QQmlPropertyData::NoFlags); // Implemented in v8/qv8qobjectwrapper.cpp - v8::Local<v8::Object> newQObject(QObject *, QV8Engine *); + v8::Handle<v8::Object> newQObject(QObject *, QV8Engine *); QQmlPropertyCacheMethodArguments *createArgumentsObject(int count, const QList<QByteArray> &names = QList<QByteArray>()); diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index 4c24547a7f..8b8237614d 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -1168,7 +1168,7 @@ void QQmlScriptData::initialize(QQmlEngine *engine) QV8Engine *v8engine = ep->v8engine(); // If compilation throws an error, a surrounding v8::TryCatch will record it. - v8::Local<v8::Script> program = v8engine->qmlModeCompile(m_programSource.constData(), + v8::Handle<v8::Script> program = v8engine->qmlModeCompile(m_programSource.constData(), m_programSource.length(), urlString, 1); if (program.IsEmpty()) return; @@ -1243,7 +1243,7 @@ v8::Persistent<v8::Object> QQmlVME::run(QQmlContextData *parentCtxt, QQmlScriptD if (!script->isInitialized()) script->initialize(parentCtxt->engine); - v8::Local<v8::Object> qmlglobal = v8engine->qmlScope(ctxt, 0); + v8::Handle<v8::Object> qmlglobal = v8engine->qmlScope(ctxt, 0); v8engine->contextWrapper()->takeContextOwnership(qmlglobal); if (!script->m_program.IsEmpty()) { @@ -1254,7 +1254,7 @@ v8::Persistent<v8::Object> QQmlVME::run(QQmlContextData *parentCtxt, QQmlScriptD } if (try_catch.HasCaught()) { - v8::Local<v8::Message> message = try_catch.Message(); + v8::Handle<v8::Message> message = try_catch.Message(); if (!message.IsEmpty()) { QQmlError error; QQmlExpressionPrivate::exceptionToError(message, error); diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index db742830ce..1f5d88e9b5 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -940,7 +940,7 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) v8::TryCatch try_catch; - v8::Local<v8::Value> result = function->Call(v8::Value::fromV4Value(ep->v8engine()->global()), data->parameterCount, args); + v8::Handle<v8::Value> result = function->Call(v8::Value::fromV4Value(ep->v8engine()->global()), data->parameterCount, args); QVariant rv; if (try_catch.HasCaught()) { @@ -1026,7 +1026,7 @@ void QQmlVMEMetaObject::writeVarProperty(int id, v8::Handle<v8::Value> value) // Importantly, if the current value is a scarce resource, we need to ensure that it // gets automatically released by the engine if no other references to it exist. - v8::Local<v8::Value> oldv = varProperties->Get(id - firstVarPropertyIndex); + v8::Handle<v8::Value> oldv = varProperties->Get(id - firstVarPropertyIndex); if (oldv->IsObject()) { QV8VariantResource *r = v8_resource_cast<QV8VariantResource>(v8::Handle<v8::Object>::Cast(oldv)); if (r) { @@ -1071,7 +1071,7 @@ void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value) // Importantly, if the current value is a scarce resource, we need to ensure that it // gets automatically released by the engine if no other references to it exist. - v8::Local<v8::Value> oldv = varProperties->Get(id - firstVarPropertyIndex); + v8::Handle<v8::Value> oldv = varProperties->Get(id - firstVarPropertyIndex); if (oldv->IsObject()) { QV8VariantResource *r = v8_resource_cast<QV8VariantResource>(v8::Handle<v8::Object>::Cast(oldv)); if (r) { diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index f23d066341..ac5783320f 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -90,7 +90,7 @@ struct QQmlXMLHttpRequestData { v8::Persistent<v8::Object> cdataPrototype; v8::Persistent<v8::Object> documentPrototype; - v8::Local<v8::Object> newNode(); + v8::Handle<v8::Object> newNode(); }; static inline QQmlXMLHttpRequestData *xhrdata(QV8Engine *engine) @@ -98,9 +98,9 @@ static inline QQmlXMLHttpRequestData *xhrdata(QV8Engine *engine) return (QQmlXMLHttpRequestData *)engine->xmlHttpRequestData(); } -static v8::Local<v8::Object> constructMeObject(v8::Handle<v8::Object> thisObj, QV8Engine *e) +static v8::Handle<v8::Object> constructMeObject(v8::Handle<v8::Object> thisObj, QV8Engine *e) { - v8::Local<v8::Object> meObj = v8::Object::New(); + v8::Handle<v8::Object> meObj = v8::Object::New(); meObj->Set(v8::String::New("ThisObject"), thisObj); meObj->Set(v8::String::New("ActivationObject"), e->qmlScope(e->callingContext(), 0)); return meObj; @@ -124,10 +124,10 @@ QQmlXMLHttpRequestData::~QQmlXMLHttpRequestData() qPersistentDispose(documentPrototype); } -v8::Local<v8::Object> QQmlXMLHttpRequestData::newNode() +v8::Handle<v8::Object> QQmlXMLHttpRequestData::newNode() { if (nodeFunction.IsEmpty()) { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetHasExternalResource(true); nodeFunction = qPersistentNew<v8::Function>(ft->GetFunction()); } @@ -203,9 +203,9 @@ class NamedNodeMap { public: // JS API - static v8::Handle<v8::Value> length(v8::Local<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> length(v8::Handle<v8::String>, const v8::AccessorInfo& args); static v8::Handle<v8::Value> indexed(uint32_t index, const v8::AccessorInfo& info); - static v8::Handle<v8::Value> named(v8::Local<v8::String> property, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> named(v8::Handle<v8::String> property, const v8::AccessorInfo& args); // C++ API static v8::Handle<v8::Object> prototype(QV8Engine *); @@ -216,7 +216,7 @@ class NodeList { public: // JS API - static v8::Handle<v8::Value> length(v8::Local<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> length(v8::Handle<v8::String>, const v8::AccessorInfo& args); static v8::Handle<v8::Value> indexed(uint32_t index, const v8::AccessorInfo& info); // C++ API @@ -228,17 +228,17 @@ class Node { public: // JS API - static v8::Handle<v8::Value> nodeName(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> nodeValue(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> nodeType(v8::Local<v8::String>, const v8::AccessorInfo& args); - - static v8::Handle<v8::Value> parentNode(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> childNodes(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> firstChild(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> lastChild(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> previousSibling(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> nextSibling(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> attributes(v8::Local<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> nodeName(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> nodeValue(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> nodeType(v8::Handle<v8::String>, const v8::AccessorInfo& args); + + static v8::Handle<v8::Value> parentNode(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> childNodes(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> firstChild(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> lastChild(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> previousSibling(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> nextSibling(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> attributes(v8::Handle<v8::String>, const v8::AccessorInfo& args); //static v8::Handle<v8::Value> ownerDocument(v8::Local<v8::String>, const v8::AccessorInfo& args); //static v8::Handle<v8::Value> namespaceURI(v8::Local<v8::String>, const v8::AccessorInfo& args); @@ -273,12 +273,12 @@ class Attr : public Node { public: // JS API - static v8::Handle<v8::Value> name(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> specified(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> value(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> ownerElement(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> schemaTypeInfo(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> isId(v8::Local<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> name(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> specified(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> value(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> ownerElement(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> schemaTypeInfo(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> isId(v8::Handle<v8::String>, const v8::AccessorInfo& args); // C++ API static v8::Handle<v8::Object> prototype(QV8Engine *); @@ -288,7 +288,7 @@ class CharacterData : public Node { public: // JS API - static v8::Handle<v8::Value> length(v8::Local<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> length(v8::Handle<v8::String>, const v8::AccessorInfo& args); // C++ API static v8::Handle<v8::Object> prototype(QV8Engine *); @@ -298,8 +298,8 @@ class Text : public CharacterData { public: // JS API - static v8::Handle<v8::Value> isElementContentWhitespace(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> wholeText(v8::Local<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> isElementContentWhitespace(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> wholeText(v8::Handle<v8::String>, const v8::AccessorInfo& args); // C++ API static v8::Handle<v8::Object> prototype(QV8Engine *); @@ -316,10 +316,10 @@ class Document : public Node { public: // JS API - static v8::Handle<v8::Value> xmlVersion(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> xmlEncoding(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> xmlStandalone(v8::Local<v8::String>, const v8::AccessorInfo& args); - static v8::Handle<v8::Value> documentElement(v8::Local<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> xmlVersion(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> xmlEncoding(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> xmlStandalone(v8::Handle<v8::String>, const v8::AccessorInfo& args); + static v8::Handle<v8::Value> documentElement(v8::Handle<v8::String>, const v8::AccessorInfo& args); // C++ API static v8::Handle<v8::Object> prototype(QV8Engine *); @@ -360,7 +360,7 @@ void NodeImpl::release() D(document); } -v8::Handle<v8::Value> Node::nodeName(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Node::nodeName(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -378,7 +378,7 @@ v8::Handle<v8::Value> Node::nodeName(v8::Local<v8::String>, const v8::AccessorIn } } -v8::Handle<v8::Value> Node::nodeValue(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Node::nodeValue(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -396,14 +396,14 @@ v8::Handle<v8::Value> Node::nodeValue(v8::Local<v8::String>, const v8::AccessorI return engine->toString(r->d->data); } -v8::Handle<v8::Value> Node::nodeType(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Node::nodeType(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); return v8::Integer::New(r->d->type); } -v8::Handle<v8::Value> Node::parentNode(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Node::parentNode(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -413,7 +413,7 @@ v8::Handle<v8::Value> Node::parentNode(v8::Local<v8::String>, const v8::Accessor else return v8::Null(); } -v8::Handle<v8::Value> Node::childNodes(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Node::childNodes(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -422,7 +422,7 @@ v8::Handle<v8::Value> Node::childNodes(v8::Local<v8::String>, const v8::Accessor return NodeList::create(engine, r->d); } -v8::Handle<v8::Value> Node::firstChild(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Node::firstChild(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -432,7 +432,7 @@ v8::Handle<v8::Value> Node::firstChild(v8::Local<v8::String>, const v8::Accessor else return Node::create(engine, r->d->children.first()); } -v8::Handle<v8::Value> Node::lastChild(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Node::lastChild(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -442,7 +442,7 @@ v8::Handle<v8::Value> Node::lastChild(v8::Local<v8::String>, const v8::AccessorI else return Node::create(engine, r->d->children.last()); } -v8::Handle<v8::Value> Node::previousSibling(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Node::previousSibling(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -460,7 +460,7 @@ v8::Handle<v8::Value> Node::previousSibling(v8::Local<v8::String>, const v8::Acc return v8::Null(); } -v8::Handle<v8::Value> Node::nextSibling(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Node::nextSibling(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -478,7 +478,7 @@ v8::Handle<v8::Value> Node::nextSibling(v8::Local<v8::String>, const v8::Accesso return v8::Null(); } -v8::Handle<v8::Value> Node::attributes(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Node::attributes(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -523,7 +523,7 @@ v8::Handle<v8::Object> Node::prototype(QV8Engine *engine) v8::Handle<v8::Value> Node::create(QV8Engine *engine, NodeImpl *data) { QQmlXMLHttpRequestData *d = xhrdata(engine); - v8::Local<v8::Object> instance = d->newNode(); + v8::Handle<v8::Object> instance = d->newNode(); switch (data->type) { case NodeImpl::Attr: @@ -587,7 +587,7 @@ v8::Handle<v8::Object> Attr::prototype(QV8Engine *engine) return d->attrPrototype; } -v8::Handle<v8::Value> Attr::name(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Attr::name(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -596,7 +596,7 @@ v8::Handle<v8::Value> Attr::name(v8::Local<v8::String>, const v8::AccessorInfo & return engine->toString(r->d->name); } -v8::Handle<v8::Value> Attr::value(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Attr::value(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -605,7 +605,7 @@ v8::Handle<v8::Value> Attr::value(v8::Local<v8::String>, const v8::AccessorInfo return engine->toString(r->d->data); } -v8::Handle<v8::Value> Attr::ownerElement(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Attr::ownerElement(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -614,7 +614,7 @@ v8::Handle<v8::Value> Attr::ownerElement(v8::Local<v8::String>, const v8::Access return Node::create(engine, r->d->parent); } -v8::Handle<v8::Value> CharacterData::length(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> CharacterData::length(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -638,7 +638,7 @@ v8::Handle<v8::Object> CharacterData::prototype(QV8Engine *engine) return d->characterDataPrototype; } -v8::Handle<v8::Value> Text::isElementContentWhitespace(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Text::isElementContentWhitespace(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -647,7 +647,7 @@ v8::Handle<v8::Value> Text::isElementContentWhitespace(v8::Local<v8::String>, co return v8::Boolean::New(r->d->data.trimmed().isEmpty()); } -v8::Handle<v8::Value> Text::wholeText(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> Text::wholeText(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -782,7 +782,7 @@ v8::Handle<v8::Value> Document::load(QV8Engine *engine, const QByteArray &data) return v8::Null(); } - v8::Local<v8::Object> instance = xhrdata(engine)->newNode(); + v8::Handle<v8::Object> instance = xhrdata(engine)->newNode(); QQmlDOMNodeResource *r = new QQmlDOMNodeResource(engine); r->d = document; instance->SetExternalResource(r); @@ -811,7 +811,7 @@ bool Node::isNull() const return d == 0; } -v8::Handle<v8::Value> NamedNodeMap::length(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> NamedNodeMap::length(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -833,7 +833,7 @@ v8::Handle<v8::Value> NamedNodeMap::indexed(uint32_t index, const v8::AccessorIn } } -v8::Handle<v8::Value> NamedNodeMap::named(v8::Local<v8::String> property, const v8::AccessorInfo& args) +v8::Handle<v8::Value> NamedNodeMap::named(v8::Handle<v8::String> property, const v8::AccessorInfo& args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r || !r->list) return v8::Undefined(); @@ -853,7 +853,7 @@ v8::Handle<v8::Object> NamedNodeMap::prototype(QV8Engine *engine) { QQmlXMLHttpRequestData *d = xhrdata(engine); if (d->namedNodeMapPrototype.IsEmpty()) { - v8::Local<v8::ObjectTemplate> ot = v8::ObjectTemplate::New(); + v8::Handle<v8::ObjectTemplate> ot = v8::ObjectTemplate::New(); ot->SetAccessor(v8::String::New("length"), length, 0, v8::External::New(engine)); ot->SetIndexedPropertyHandler(indexed, 0, 0, 0, 0, v8::External::New(engine)); ot->SetFallbackPropertyHandler(named, 0, 0, 0, 0, v8::External::New(engine)); @@ -866,7 +866,7 @@ v8::Handle<v8::Object> NamedNodeMap::prototype(QV8Engine *engine) v8::Handle<v8::Value> NamedNodeMap::create(QV8Engine *engine, NodeImpl *data, QList<NodeImpl *> *list) { QQmlXMLHttpRequestData *d = xhrdata(engine); - v8::Local<v8::Object> instance = d->newNode(); + v8::Handle<v8::Object> instance = d->newNode(); instance->SetPrototype(NamedNodeMap::prototype(engine)); QQmlDOMNodeResource *r = new QQmlDOMNodeResource(engine); r->d = data; @@ -889,7 +889,7 @@ v8::Handle<v8::Value> NodeList::indexed(uint32_t index, const v8::AccessorInfo& } } -v8::Handle<v8::Value> NodeList::length(v8::Local<v8::String>, const v8::AccessorInfo& args) +v8::Handle<v8::Value> NodeList::length(v8::Handle<v8::String>, const v8::AccessorInfo& args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r) return v8::Undefined(); @@ -902,7 +902,7 @@ v8::Handle<v8::Object> NodeList::prototype(QV8Engine *engine) { QQmlXMLHttpRequestData *d = xhrdata(engine); if (d->nodeListPrototype.IsEmpty()) { - v8::Local<v8::ObjectTemplate> ot = v8::ObjectTemplate::New(); + v8::Handle<v8::ObjectTemplate> ot = v8::ObjectTemplate::New(); ot->SetAccessor(v8::String::New("length"), length, 0, v8::External::New(engine)); ot->SetIndexedPropertyHandler(indexed, 0, 0, 0, 0, v8::External::New(engine)); d->nodeListPrototype = qPersistentNew<v8::Object>(ot->NewInstance()); @@ -914,7 +914,7 @@ v8::Handle<v8::Object> NodeList::prototype(QV8Engine *engine) v8::Handle<v8::Value> NodeList::create(QV8Engine *engine, NodeImpl *data) { QQmlXMLHttpRequestData *d = xhrdata(engine); - v8::Local<v8::Object> instance = d->newNode(); + v8::Handle<v8::Object> instance = d->newNode(); instance->SetPrototype(NodeList::prototype(engine)); QQmlDOMNodeResource *r = new QQmlDOMNodeResource(engine); r->d = data; @@ -923,7 +923,7 @@ v8::Handle<v8::Value> NodeList::create(QV8Engine *engine, NodeImpl *data) return instance; } -v8::Handle<v8::Value> Document::documentElement(v8::Local<v8::String>, const v8::AccessorInfo& args) +v8::Handle<v8::Value> Document::documentElement(v8::Handle<v8::String>, const v8::AccessorInfo& args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r || r->d->type != NodeImpl::Document) return v8::Undefined(); @@ -932,7 +932,7 @@ v8::Handle<v8::Value> Document::documentElement(v8::Local<v8::String>, const v8: return Node::create(engine, static_cast<DocumentImpl *>(r->d)->root); } -v8::Handle<v8::Value> Document::xmlStandalone(v8::Local<v8::String>, const v8::AccessorInfo& args) +v8::Handle<v8::Value> Document::xmlStandalone(v8::Handle<v8::String>, const v8::AccessorInfo& args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r || r->d->type != NodeImpl::Document) return v8::Undefined(); @@ -941,7 +941,7 @@ v8::Handle<v8::Value> Document::xmlStandalone(v8::Local<v8::String>, const v8::A return v8::Boolean::New(static_cast<DocumentImpl *>(r->d)->isStandalone); } -v8::Handle<v8::Value> Document::xmlVersion(v8::Local<v8::String>, const v8::AccessorInfo& args) +v8::Handle<v8::Value> Document::xmlVersion(v8::Handle<v8::String>, const v8::AccessorInfo& args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r || r->d->type != NodeImpl::Document) return v8::Undefined(); @@ -950,7 +950,7 @@ v8::Handle<v8::Value> Document::xmlVersion(v8::Local<v8::String>, const v8::Acce return engine->toString(static_cast<DocumentImpl *>(r->d)->version); } -v8::Handle<v8::Value> Document::xmlEncoding(v8::Local<v8::String>, const v8::AccessorInfo& args) +v8::Handle<v8::Value> Document::xmlEncoding(v8::Handle<v8::String>, const v8::AccessorInfo& args) { QQmlDOMNodeResource *r = v8_resource_cast<QQmlDOMNodeResource>(args.This()); if (!r || r->d->type != NodeImpl::Document) return v8::Undefined(); @@ -1468,8 +1468,8 @@ void QQmlXMLHttpRequest::dispatchCallback(v8::Handle<v8::Object> me) return; } - v8::Local<v8::Object> thisObj = me->Get(v8::String::New("ThisObject"))->ToObject(); - v8::Local<v8::Value> callback = thisObj->Get(v8::String::New("onreadystatechange")); + v8::Handle<v8::Object> thisObj = me->Get(v8::String::New("ThisObject"))->ToObject(); + v8::Handle<v8::Value> callback = thisObj->Get(v8::String::New("onreadystatechange")); if (!callback->IsFunction()) { // not an error, but no onreadystatechange function to call. return; @@ -1480,10 +1480,10 @@ void QQmlXMLHttpRequest::dispatchCallback(v8::Handle<v8::Object> me) return; } - v8::Local<v8::Object> activationObject = me->Get(v8::String::New("ActivationObject"))->ToObject(); + v8::Handle<v8::Object> activationObject = me->Get(v8::String::New("ActivationObject"))->ToObject(); QQmlContextData *callingContext = engine->contextWrapper()->context(activationObject); if (callingContext) { - v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(callback); + v8::Handle<v8::Function> f = v8::Handle<v8::Function>::Cast(callback); f->Call(activationObject, 0, 0); // valid activation object. } @@ -1672,7 +1672,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_getAllResponseHeaders(const v8::A } // XMLHttpRequest properties -static v8::Handle<v8::Value> qmlxmlhttprequest_readyState(v8::Local<v8::String> /* property */, +static v8::Handle<v8::Value> qmlxmlhttprequest_readyState(v8::Handle<v8::String> /* property */, const v8::AccessorInfo& info) { QQmlXMLHttpRequest *r = v8_resource_cast<QQmlXMLHttpRequest>(info.This()); @@ -1682,7 +1682,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_readyState(v8::Local<v8::String> return v8::Integer::NewFromUnsigned(r->readyState()); } -static v8::Handle<v8::Value> qmlxmlhttprequest_status(v8::Local<v8::String> /* property */, +static v8::Handle<v8::Value> qmlxmlhttprequest_status(v8::Handle<v8::String> /* property */, const v8::AccessorInfo& info) { QQmlXMLHttpRequest *r = v8_resource_cast<QQmlXMLHttpRequest>(info.This()); @@ -1699,7 +1699,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_status(v8::Local<v8::String> /* p return v8::Integer::New(r->replyStatus()); } -static v8::Handle<v8::Value> qmlxmlhttprequest_statusText(v8::Local<v8::String> /* property */, +static v8::Handle<v8::Value> qmlxmlhttprequest_statusText(v8::Handle<v8::String> /* property */, const v8::AccessorInfo& info) { QQmlXMLHttpRequest *r = v8_resource_cast<QQmlXMLHttpRequest>(info.This()); @@ -1718,7 +1718,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_statusText(v8::Local<v8::String> return engine->toString(r->replyStatusText()); } -static v8::Handle<v8::Value> qmlxmlhttprequest_responseText(v8::Local<v8::String> /* property */, +static v8::Handle<v8::Value> qmlxmlhttprequest_responseText(v8::Handle<v8::String> /* property */, const v8::AccessorInfo& info) { QQmlXMLHttpRequest *r = v8_resource_cast<QQmlXMLHttpRequest>(info.This()); @@ -1734,7 +1734,7 @@ static v8::Handle<v8::Value> qmlxmlhttprequest_responseText(v8::Local<v8::String return engine->toString(r->responseBody()); } -static v8::Handle<v8::Value> qmlxmlhttprequest_responseXML(v8::Local<v8::String> /* property */, +static v8::Handle<v8::Value> qmlxmlhttprequest_responseXML(v8::Handle<v8::String> /* property */, const v8::AccessorInfo& info) { QQmlXMLHttpRequest *r = v8_resource_cast<QQmlXMLHttpRequest>(info.This()); @@ -1778,7 +1778,7 @@ void *qt_add_qmlxmlhttprequest(QV8Engine *engine) v8::PropertyAttribute attributes = (v8::PropertyAttribute)(v8::ReadOnly | v8::DontEnum | v8::DontDelete); // XMLHttpRequest - v8::Local<v8::FunctionTemplate> xmlhttprequest = v8::FunctionTemplate::New(qmlxmlhttprequest_new, + v8::Handle<v8::FunctionTemplate> xmlhttprequest = v8::FunctionTemplate::New(qmlxmlhttprequest_new, v8::External::New(engine)); xmlhttprequest->InstanceTemplate()->SetHasExternalResource(true); @@ -1810,7 +1810,7 @@ void *qt_add_qmlxmlhttprequest(QV8Engine *engine) xmlhttprequest->Set(v8::String::New("HEADERS_RECEIVED"), v8::Integer::New(2), attributes); xmlhttprequest->Set(v8::String::New("LOADING"), v8::Integer::New(3), attributes); xmlhttprequest->Set(v8::String::New("DONE"), v8::Integer::New(4), attributes); - v8::Local<v8::Object>::New(v8::Value::fromV4Value(engine->global()))->Set(v8::String::New("XMLHttpRequest"), xmlhttprequest->GetFunction()); + v8::Handle<v8::Object>(engine->global())->Set(v8::String::New("XMLHttpRequest"), xmlhttprequest->GetFunction()); QQmlXMLHttpRequestData *data = new QQmlXMLHttpRequestData; return data; diff --git a/src/qml/qml/v4/qv4v8.cpp b/src/qml/qml/v4/qv4v8.cpp index 4d15adc28f..16121826da 100644 --- a/src/qml/qml/v4/qv4v8.cpp +++ b/src/qml/qml/v4/qv4v8.cpp @@ -121,7 +121,7 @@ struct V8AccessorGetter: FunctionObject { AccessorInfo info(thisObject, getter->data); QV4::Value result = QV4::Value::undefinedValue(); try { - result = getter->getter(Local<String>::New(getter->name), info)->v4Value(); + result = getter->getter(getter->name, info)->v4Value(); } catch (QV4::Exception &e) { Isolate::GetCurrent()->setException(e.value()); e.accept(context); @@ -158,7 +158,7 @@ struct V8AccessorSetter: FunctionObject { V8AccessorSetter *setter = static_cast<V8AccessorSetter*>(that); AccessorInfo info(thisObject, setter->data); try { - setter->setter(Local<String>::New(setter->name), Local<Value>::New(Value::fromV4Value(args[0])), info); + setter->setter(setter->name, args[0], info); } catch (QV4::Exception &e) { Isolate::GetCurrent()->setException(e.value()); e.accept(context); @@ -195,7 +195,7 @@ Handle<Integer> ScriptOrigin::ResourceColumnOffset() const } -Local<Script> Script::New(Handle<String> source, +Handle<Script> Script::New(Handle<String> source, ScriptOrigin* origin, ScriptData* pre_data, Handle<String> script_data, @@ -206,11 +206,11 @@ Local<Script> Script::New(Handle<String> source, if (origin) s->m_origin = *origin; s->m_flags = flags; - return Local<Script>::New(Handle<Script>(s)); + return Handle<Script>(s); } -Local<Script> Script::New(Handle<String> source, +Handle<Script> Script::New(Handle<String> source, Handle<Value> file_name, CompileFlags flags) { @@ -218,17 +218,17 @@ Local<Script> Script::New(Handle<String> source, return New(source, &origin, 0, Handle<String>(), flags); } -Local<Script> Script::Compile(Handle<String> source, ScriptOrigin *origin, ScriptData *pre_data, Handle<String> script_data, Script::CompileFlags flags) +Handle<Script> Script::Compile(Handle<String> source, ScriptOrigin *origin, ScriptData *pre_data, Handle<String> script_data, Script::CompileFlags flags) { Script *s = new Script; s->m_script = source->ToString()->asQString(); if (origin) s->m_origin = *origin; s->m_flags = flags; - return Local<Script>::New(Handle<Script>(s)); + return Handle<Script>(s); } -Local<Script> Script::Compile(Handle<String> source, +Handle<Script> Script::Compile(Handle<String> source, Handle<Value> file_name, Handle<String> script_data, CompileFlags flags) @@ -237,7 +237,7 @@ Local<Script> Script::Compile(Handle<String> source, return Compile(source, &origin, 0, script_data, flags); } -Local<Value> Script::Run() +Handle<Value> Script::Run() { QV4::ExecutionEngine *engine = Isolate::GetCurrent()->GetEngine(); QV4::ExecutionContext *ctx = engine->current; @@ -253,13 +253,13 @@ Local<Value> Script::Run() } catch (QV4::Exception &e) { Isolate::GetCurrent()->setException(e.value()); e.accept(ctx); - return Local<Value>(); + return Handle<Value>(); } - return Local<Value>::New(Value::fromV4Value(result)); + return result; } -Local<Value> Script::Run(Handle<Object> qml) +Handle<Value> Script::Run(Handle<Object> qml) { QV4::ExecutionEngine *engine = Isolate::GetCurrent()->GetEngine(); QV4::ExecutionContext *ctx = engine->current; @@ -276,12 +276,12 @@ Local<Value> Script::Run(Handle<Object> qml) } catch (QV4::Exception &e) { Isolate::GetCurrent()->setException(e.value()); e.accept(ctx); - return Local<Value>(); + return Handle<Value>(); } - return Local<Value>::New(Value::fromV4Value(result)); + return result; } -Local<Value> Script::Id() +Handle<Value> Script::Id() { Q_UNIMPLEMENTED(); Q_UNREACHABLE(); @@ -293,9 +293,9 @@ void Script::SetData(Handle<String> data) } -Local<String> Message::Get() const +Handle<String> Message::Get() const { - return Local<String>::New(Value::fromV4Value(QV4::Value::fromString(currentEngine()->current, m_message))); + return QV4::Value::fromString(currentEngine()->current, m_message); } Handle<Value> Message::GetScriptResourceName() const @@ -309,10 +309,10 @@ int Message::GetLineNumber() const } -Local<StackFrame> StackTrace::GetFrame(uint32_t index) const +Handle<StackFrame> StackTrace::GetFrame(uint32_t index) const { if (index >= (uint)frames.size()) - return Local<StackFrame>(); + return Handle<StackFrame>(); return frames.at(index); } @@ -321,13 +321,13 @@ int StackTrace::GetFrameCount() const return frames.size(); } -Local<Array> StackTrace::AsArray() +Handle<Array> StackTrace::AsArray() { Q_UNIMPLEMENTED(); - return Local<Array>(); + return Handle<Array>(); } -Local<StackTrace> StackTrace::CurrentStackTrace(int frame_limit, StackTrace::StackTraceOptions options) +Handle<StackTrace> StackTrace::CurrentStackTrace(int frame_limit, StackTrace::StackTraceOptions options) { StackTrace *trace = new StackTrace; QV4::ExecutionEngine *engine = currentEngine(); @@ -337,13 +337,13 @@ Local<StackTrace> StackTrace::CurrentStackTrace(int frame_limit, StackTrace::Sta StackFrame *frame = new StackFrame(Value::fromV4Value(QV4::Value::fromString(engine->id_null)), Value::fromV4Value(QV4::Value::fromString(c->function->name)), 0, 0); - trace->frames.append(frame); + trace->frames.append(v8::Handle<v8::StackFrame>(frame)); --frame_limit; } current = current->parent; } - return Local<StackTrace>::New(Handle<StackTrace>(trace)); + return Handle<StackTrace>(trace); } @@ -357,19 +357,19 @@ int StackFrame::GetColumn() const return m_columnNumber; } -Local<String> StackFrame::GetScriptName() const +Handle<String> StackFrame::GetScriptName() const { - return Local<String>::New(m_scriptName); + return m_scriptName; } -Local<String> StackFrame::GetScriptNameOrSourceURL() const +Handle<String> StackFrame::GetScriptNameOrSourceURL() const { - return Local<String>::New(m_scriptName); + return m_scriptName; } -Local<String> StackFrame::GetFunctionName() const +Handle<String> StackFrame::GetFunctionName() const { - return Local<String>::New(m_functionName); + return m_functionName; } StackFrame::StackFrame(Handle<String> script, Handle<String> function, int line, int column) @@ -477,44 +477,44 @@ bool Value::IsError() const return ConstValuePtr(this)->asErrorObject(); } -Local<Boolean> Value::ToBoolean() const +Handle<Boolean> Value::ToBoolean() const { - return Local<Boolean>::New(Value::fromV4Value(QV4::Value::fromBoolean(ConstValuePtr(this)->toBoolean()))); + return QV4::Value::fromBoolean(ConstValuePtr(this)->toBoolean()); } -Local<Number> Value::ToNumber() const +Handle<Number> Value::ToNumber() const { - return Local<Number>::New(Value::fromV4Value(QV4::Value::fromDouble(ConstValuePtr(this)->toNumber()))); + return QV4::Value::fromDouble(ConstValuePtr(this)->toNumber()); } -Local<String> Value::ToString() const +Handle<String> Value::ToString() const { - return Local<String>::New(Value::fromV4Value(QV4::Value::fromString(ConstValuePtr(this)->toString(currentEngine()->current)))); + return QV4::Value::fromString(ConstValuePtr(this)->toString(currentEngine()->current)); } -Local<Object> Value::ToObject() const +Handle<Object> Value::ToObject() const { - return Local<Object>::New(Value::fromV4Value(QV4::Value::fromObject(ConstValuePtr(this)->toObject(currentEngine()->current)))); + return QV4::Value::fromObject(ConstValuePtr(this)->toObject(currentEngine()->current)); } -Local<Integer> Value::ToInteger() const +Handle<Integer> Value::ToInteger() const { - return Local<Integer>::New(Value::fromV4Value(QV4::Value::fromDouble(ConstValuePtr(this)->toInteger()))); + return QV4::Value::fromDouble(ConstValuePtr(this)->toInteger()); } -Local<Uint32> Value::ToUint32() const +Handle<Uint32> Value::ToUint32() const { - return Local<Uint32>::New(Value::fromV4Value(QV4::Value::fromUInt32(ConstValuePtr(this)->toUInt32()))); + return QV4::Value::fromUInt32(ConstValuePtr(this)->toUInt32()); } -Local<Int32> Value::ToInt32() const +Handle<Int32> Value::ToInt32() const { - return Local<Int32>::New(Value::fromV4Value(QV4::Value::fromInt32(ConstValuePtr(this)->toInt32()))); + return QV4::Value::fromInt32(ConstValuePtr(this)->toInt32()); } -Local<Uint32> Value::ToArrayIndex() const +Handle<Uint32> Value::ToArrayIndex() const { - return Local<Uint32>::New(Value::fromV4Value(QV4::Value::fromUInt32(ConstValuePtr(this)->asArrayIndex()))); + return QV4::Value::fromUInt32(ConstValuePtr(this)->asArrayIndex()); } bool Value::BooleanValue() const @@ -640,31 +640,31 @@ String *String::Cast(v8::Value *obj) } -Local<String> String::New(const char *data, int length) +Handle<String> String::New(const char *data, int length) { QV4::Value v = QV4::Value::fromString(currentEngine()->current, QString::fromLatin1(data, length)); - return Local<String>::New(v8::Value::fromV4Value(v)); + return v; } -Local<String> String::New(const uint16_t *data, int length) +Handle<String> String::New(const uint16_t *data, int length) { QV4::Value v = QV4::Value::fromString(currentEngine()->current, QString((const QChar *)data, length)); - return Local<String>::New(v8::Value::fromV4Value(v)); + return v; } -Local<String> String::NewSymbol(const char *data, int length) +Handle<String> String::NewSymbol(const char *data, int length) { QString str = QString::fromLatin1(data, length); QV4::String *vmString = currentEngine()->newIdentifier(str); return New(vmString); } -Local<String> String::New(QV4::String *s) +Handle<String> String::New(QV4::String *s) { - return Local<String>::New(v8::Value::fromV4Value(QV4::Value::fromString(s))); + return QV4::Value::fromString(s); } -Local<String> String::NewExternal(String::ExternalStringResource *resource) +Handle<String> String::NewExternal(String::ExternalStringResource *resource) { Q_UNIMPLEMENTED(); Q_UNREACHABLE(); @@ -700,9 +700,9 @@ double Number::Value() const return v->asDouble(); } -Local<Number> Number::New(double value) +Handle<Number> Number::New(double value) { - return Local<Number>::New(Value::fromV4Value(QV4::Value::fromDouble(value))); + return QV4::Value::fromDouble(value); } Number *Number::Cast(v8::Value *obj) @@ -710,14 +710,14 @@ Number *Number::Cast(v8::Value *obj) return static_cast<Number *>(obj); } -Local<Integer> Integer::New(int32_t value) +Handle<Integer> Integer::New(int32_t value) { - return Local<Integer>::New(Value::fromV4Value(QV4::Value::fromInt32(value))); + return QV4::Value::fromInt32(value); } -Local<Integer> Integer::NewFromUnsigned(uint32_t value) +Handle<Integer> Integer::NewFromUnsigned(uint32_t value) { - return Local<Integer>::New(Value::fromV4Value(QV4::Value::fromUInt32(value))); + return QV4::Value::fromUInt32(value); } int64_t Integer::Value() const @@ -797,7 +797,7 @@ bool Object::Set(uint32_t index, Handle<Value> value) return result; } -Local<Value> Object::Get(Handle<Value> key) +Handle<Value> Object::Get(Handle<Value> key) { QV4::Object *o = ConstValuePtr(this)->asObject(); assert(o); @@ -808,12 +808,12 @@ Local<Value> Object::Get(Handle<Value> key) } catch (QV4::Exception &e) { Isolate::GetCurrent()->setException(e.value()); e.accept(ctx); - return Local<Value>(); + return Handle<Value>(); } - return Local<Value>::New(Value::fromV4Value(prop)); + return prop; } -Local<Value> Object::Get(uint32_t key) +Handle<Value> Object::Get(uint32_t key) { QV4::Object *o = ConstValuePtr(this)->asObject(); assert(o); @@ -824,9 +824,9 @@ Local<Value> Object::Get(uint32_t key) } catch (QV4::Exception &e) { Isolate::GetCurrent()->setException(e.value()); e.accept(ctx); - return Local<Value>(); + return Handle<Value>(); } - return Local<Value>::New(Value::fromV4Value(prop)); + return prop; } bool Object::Has(Handle<String> key) @@ -898,7 +898,7 @@ bool Object::SetAccessor(Handle<String> name, AccessorGetter getter, AccessorSet return true; } -Local<Array> Object::GetPropertyNames() +Handle<Array> Object::GetPropertyNames() { QV4::Object *o = ConstValuePtr(this)->asObject(); assert(o); @@ -911,10 +911,10 @@ Local<Array> Object::GetPropertyNames() break; array->push_back(v); } - return Local<Array>::New(Value::fromV4Value(QV4::Value::fromObject(array))); + return QV4::Value::fromObject(array); } -Local<Array> Object::GetOwnPropertyNames() +Handle<Array> Object::GetOwnPropertyNames() { QV4::Object *o = ConstValuePtr(this)->asObject(); assert(o); @@ -927,16 +927,16 @@ Local<Array> Object::GetOwnPropertyNames() break; array->push_back(v); } - return Local<Array>::New(Value::fromV4Value(QV4::Value::fromObject(array))); + return QV4::Value::fromObject(array); } -Local<Value> Object::GetPrototype() +Handle<Value> Object::GetPrototype() { - Local<Value> result; + Handle<Value> result; QV4::Object *o = ConstValuePtr(this)->asObject(); if (!o) - return Local<Value>(); - return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o->prototype))); + return Handle<Value>(); + return QV4::Value::fromObject(o->prototype); } bool Object::SetPrototype(Handle<Value> prototype) @@ -952,7 +952,7 @@ bool Object::SetPrototype(Handle<Value> prototype) return true; } -Local<Value> Object::GetInternalField(int index) +Handle<Value> Object::GetInternalField(int index) { Q_UNIMPLEMENTED(); Q_UNREACHABLE(); @@ -998,13 +998,13 @@ bool Object::SetHiddenValue(Handle<String> key, Handle<Value> value) Q_UNREACHABLE(); } -Local<Value> Object::GetHiddenValue(Handle<String> key) +Handle<Value> Object::GetHiddenValue(Handle<String> key) { Q_UNIMPLEMENTED(); Q_UNREACHABLE(); } -Local<Object> Object::Clone() +Handle<Object> Object::Clone() { Q_UNIMPLEMENTED(); Q_UNREACHABLE(); @@ -1015,46 +1015,46 @@ bool Object::IsCallable() return ConstValuePtr(this)->asFunctionObject(); } -Local<Value> Object::CallAsFunction(Handle<Object> recv, int argc, Handle<Value> argv[]) +Handle<Value> Object::CallAsFunction(Handle<Object> recv, int argc, Handle<Value> argv[]) { QV4::FunctionObject *f = ConstValuePtr(this)->asFunctionObject(); if (!f) - return Local<Value>(); + return Handle<Value>(); ExecutionContext *context = currentEngine()->current; try { QV4::Value retval = f->call(context, recv->v4Value(), reinterpret_cast<QV4::Value*>(argv), argc); - return Local<Value>::New(Value::fromV4Value(retval)); + return retval; } catch (QV4::Exception &e) { Isolate::GetCurrent()->setException(e.value()); e.accept(context); } - return Local<Object>(); + return Handle<Object>(); } -Local<Value> Object::CallAsConstructor(int argc, Handle<Value> argv[]) +Handle<Value> Object::CallAsConstructor(int argc, Handle<Value> argv[]) { QV4::FunctionObject *f = ConstValuePtr(this)->asFunctionObject(); if (!f) - return Local<Value>(); + return Handle<Value>(); ExecutionContext *context = currentEngine()->current; try { QV4::Value retval = f->construct(context, reinterpret_cast<QV4::Value*>(argv), argc); - return Local<Value>::New(Value::fromV4Value(retval)); + return retval; } catch (QV4::Exception &e) { Isolate::GetCurrent()->setException(e.value()); e.accept(context); } - return Local<Object>(); + return Handle<Object>(); } -Local<Object> Object::New() +Handle<Object> Object::New() { QV4::Object *o = currentEngine()->newObject(); - return Local<Object>::New(Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } Object *Object::Cast(Value *obj) @@ -1071,7 +1071,7 @@ uint32_t Array::Length() const return a->arrayLength(); } -Local<Array> Array::New(int length) +Handle<Array> Array::New(int length) { if (length < 0) length = 0; @@ -1079,7 +1079,7 @@ Local<Array> Array::New(int length) if (length < 0x1000) a->arrayReserve(length); - return Local<Array>::New(Value::fromV4Value(QV4::Value::fromObject(a))); + return QV4::Value::fromObject(a); } Array *Array::Cast(Value *obj) @@ -1088,7 +1088,7 @@ Array *Array::Cast(Value *obj) } -Local<Object> Function::NewInstance() const +Handle<Object> Function::NewInstance() const { QV4::FunctionObject *f = ConstValuePtr(this)->asFunctionObject(); assert(f); @@ -1099,12 +1099,12 @@ Local<Object> Function::NewInstance() const } catch (QV4::Exception &e) { Isolate::GetCurrent()->setException(e.value()); e.accept(context); - return Local<Object>(); + return Handle<Object>(); } - return Local<Object>::New(Value::fromV4Value(result)); + return result; } -Local<Object> Function::NewInstance(int argc, Handle<Value> argv[]) const +Handle<Object> Function::NewInstance(int argc, Handle<Value> argv[]) const { QV4::FunctionObject *f = ConstValuePtr(this)->asFunctionObject(); assert(f); @@ -1115,16 +1115,16 @@ Local<Object> Function::NewInstance(int argc, Handle<Value> argv[]) const } catch (QV4::Exception &e) { Isolate::GetCurrent()->setException(e.value()); e.accept(context); - return Local<Object>(); + return Handle<Object>(); } - return Local<Object>::New(Value::fromV4Value(result)); + return result; } -Local<Value> Function::Call(Handle<Object> thisObj, int argc, Handle<Value> argv[]) +Handle<Value> Function::Call(Handle<Object> thisObj, int argc, Handle<Value> argv[]) { QV4::FunctionObject *f = ConstValuePtr(this)->asFunctionObject(); if (!f) - return Local<Value>(); + return Handle<Value>(); QV4::ExecutionContext *context = currentEngine()->current; QV4::Value result = QV4::Value::undefinedValue(); try { @@ -1133,9 +1133,9 @@ Local<Value> Function::Call(Handle<Object> thisObj, int argc, Handle<Value> argv } catch (QV4::Exception &e) { Isolate::GetCurrent()->setException(e.value()); e.accept(context); - return Local<Value>(); + return Handle<Value>(); } - return Local<Value>::New(Value::fromV4Value(result)); + return result; } Handle<Value> Function::GetName() const @@ -1158,10 +1158,10 @@ Function *Function::Cast(Value *obj) } -Local<Value> Date::New(double time) +Handle<Value> Date::New(double time) { QV4::Object *o = currentEngine()->newDateObject(QV4::Value::fromDouble(time)); - return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } double Date::NumberValue() const @@ -1182,10 +1182,10 @@ void Date::DateTimeConfigurationChangeNotification() } -Local<Value> NumberObject::New(double value) +Handle<Value> NumberObject::New(double value) { QV4::Object *o = currentEngine()->newNumberObject(QV4::Value::fromDouble(value)); - return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } double NumberObject::NumberValue() const @@ -1200,10 +1200,10 @@ NumberObject *NumberObject::Cast(Value *obj) return static_cast<NumberObject *>(obj); } -Local<Value> BooleanObject::New(bool value) +Handle<Value> BooleanObject::New(bool value) { QV4::Object *o = currentEngine()->newBooleanObject(QV4::Value::fromBoolean(value)); - return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } bool BooleanObject::BooleanValue() const @@ -1218,17 +1218,17 @@ BooleanObject *BooleanObject::Cast(Value *obj) return static_cast<BooleanObject *>(obj); } -Local<Value> StringObject::New(Handle<String> value) +Handle<Value> StringObject::New(Handle<String> value) { QV4::Object *o = currentEngine()->newStringObject(QV4::Value::fromString(value->v4Value().asString())); - return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } -Local<String> StringObject::StringValue() const +Handle<String> StringObject::StringValue() const { QV4::StringObject *s = ConstValuePtr(this)->asStringObject(); assert(s); - return Local<String>::New(Value::fromV4Value(s->value)); + return s->value; } StringObject *StringObject::Cast(Value *obj) @@ -1236,7 +1236,7 @@ StringObject *StringObject::Cast(Value *obj) return static_cast<StringObject *>(obj); } -Local<RegExp> RegExp::New(Handle<String> pattern, RegExp::Flags flags) +Handle<RegExp> RegExp::New(Handle<String> pattern, RegExp::Flags flags) { int f = 0; if (flags & kGlobal) @@ -1246,14 +1246,14 @@ Local<RegExp> RegExp::New(Handle<String> pattern, RegExp::Flags flags) if (flags & kMultiline) f |= V4IR::RegExp::RegExp_Multiline; QV4::Object *o = currentEngine()->newRegExpObject(pattern->asQString(), f); - return Local<RegExp>::New(Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } -Local<String> RegExp::GetSource() const +Handle<String> RegExp::GetSource() const { RegExpObject *re = ConstValuePtr(this)->asRegExpObject(); assert(re); - return Local<String>::New(Value::fromV4Value(QV4::Value::fromString(currentEngine()->current, re->value->pattern()))); + return QV4::Value::fromString(currentEngine()->current, re->value->pattern()); } RegExp::Flags RegExp::GetFlags() const @@ -1282,7 +1282,7 @@ struct VoidStarWrapper : public QV4::Object::ExternalResource void *data; }; -Local<Value> External::Wrap(void *data) +Handle<Value> External::Wrap(void *data) { return New(data); } @@ -1292,13 +1292,13 @@ void *External::Unwrap(Handle<v8::Value> obj) return obj.As<External>()->Value(); } -Local<External> External::New(void *value) +Handle<External> External::New(void *value) { QV4::Object *o = currentEngine()->newObject(); VoidStarWrapper *wrapper = new VoidStarWrapper; wrapper->data = value; o->externalResource = wrapper; - return Local<v8::External>::New(v8::Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } External *External::Cast(v8::Value *obj) @@ -1344,20 +1344,20 @@ int Arguments::Length() const return m_args.size(); } -Local<Value> Arguments::operator [](int i) const +Handle<Value> Arguments::operator [](int i) const { - return Local<Value>::New(m_args.at(i)); + return m_args.at(i); } -Local<Object> Arguments::This() const +Handle<Object> Arguments::This() const { - return Local<Object>::New(m_thisObject); + return m_thisObject; } -Local<Object> Arguments::Holder() const +Handle<Object> Arguments::Holder() const { // ### FIXME. - return Local<Object>::New(m_thisObject); + return m_thisObject; } bool Arguments::IsConstructCall() const @@ -1365,9 +1365,9 @@ bool Arguments::IsConstructCall() const return m_isConstructor; } -Local<Value> Arguments::Data() const +Handle<Value> Arguments::Data() const { - return Local<Value>::New(m_data); + return m_data; } Isolate *Arguments::GetIsolate() const @@ -1387,20 +1387,20 @@ Isolate *AccessorInfo::GetIsolate() const return Isolate::GetCurrent(); } -Local<Value> AccessorInfo::Data() const +Handle<Value> AccessorInfo::Data() const { - return Local<Value>::New(m_data); + return m_data; } -Local<Object> AccessorInfo::This() const +Handle<Object> AccessorInfo::This() const { - return Local<Object>::New(m_this); + return m_this; } -Local<Object> AccessorInfo::Holder() const +Handle<Object> AccessorInfo::Holder() const { // ### FIXME - return Local<Object>::New(m_this); + return m_this; } template <typename BaseClass> @@ -1505,7 +1505,7 @@ protected: static void put(QV4::Managed *m, ExecutionContext *ctx, QV4::String *name, const QV4::Value &value) { - Local<Value> v8Value = Local<Value>::New(Value::fromV4Value(value)); + Handle<Value> v8Value = value; V4V8Object *that = static_cast<V4V8Object*>(m); if (that->m_template->m_namedPropertySetter) { Handle<Value> result = that->m_template->m_namedPropertySetter(String::New(name), v8Value, that->namedAccessorInfo()); @@ -1526,7 +1526,7 @@ protected: { V4V8Object *that = static_cast<V4V8Object*>(m); if (that->m_template->m_indexedPropertySetter) { - Handle<Value> result = that->m_template->m_indexedPropertySetter(index, Local<Value>::New(Value::fromV4Value(value)), that->indexedAccessorInfo()); + Handle<Value> result = that->m_template->m_indexedPropertySetter(index, value, that->indexedAccessorInfo()); if (!result.IsEmpty()) return; } @@ -1672,34 +1672,34 @@ DEFINE_MANAGED_VTABLE(V4V8Function); FunctionTemplate::FunctionTemplate(InvocationCallback callback, Handle<Value> data) : m_callback(callback) { - m_instanceTemplate = Local<ObjectTemplate>(); - m_prototypeTemplate = Local<ObjectTemplate>(); + m_instanceTemplate = Handle<ObjectTemplate>(); + m_prototypeTemplate = Handle<ObjectTemplate>(); m_data = Persistent<Value>::New(data); } -Local<FunctionTemplate> FunctionTemplate::New(InvocationCallback callback, Handle<Value> data) +Handle<FunctionTemplate> FunctionTemplate::New(InvocationCallback callback, Handle<Value> data) { FunctionTemplate *ft = new FunctionTemplate(callback, data); - return Local<FunctionTemplate>::New(Handle<FunctionTemplate>(ft)); + return Handle<FunctionTemplate>(ft); } -Local<Function> FunctionTemplate::GetFunction() +Handle<Function> FunctionTemplate::GetFunction() { QV4::ExecutionEngine *engine = currentEngine(); QV4::Object *o = new (engine->memoryManager) V4V8Function(engine, this); QV4::Object *proto = new (engine->memoryManager) V4V8Object<QV4::FunctionPrototype>(engine, m_prototypeTemplate.get()); o->put(engine->current, engine->id_prototype, QV4::Value::fromObject(proto)); - return Local<Function>::New(Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } -Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() +Handle<ObjectTemplate> FunctionTemplate::InstanceTemplate() { if (m_instanceTemplate.IsEmpty()) m_instanceTemplate = ObjectTemplate::New(); return m_instanceTemplate; } -Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() +Handle<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { if (m_prototypeTemplate.IsEmpty()) m_prototypeTemplate = ObjectTemplate::New(); @@ -1707,20 +1707,20 @@ Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() } -Local<ObjectTemplate> ObjectTemplate::New() +Handle<ObjectTemplate> ObjectTemplate::New() { ObjectTemplate *ot = new ObjectTemplate; - return Local<ObjectTemplate>::New(Handle<ObjectTemplate>(ot)); + return Handle<ObjectTemplate>(ot); } -Local<Object> ObjectTemplate::NewInstance() +Handle<Object> ObjectTemplate::NewInstance() { QV4::ExecutionEngine *engine = currentEngine(); QV4::Object *o = new (engine->memoryManager) V4V8Object<QV4::Object>(engine, this); o->prototype = engine->objectPrototype; o->externalComparison = m_useUserComparison; - return Local<Object>::New(Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } void ObjectTemplate::SetAccessor(Handle<String> name, AccessorGetter getter, AccessorSetter setter, Handle<Value> data, AccessControl settings, PropertyAttribute attribute) @@ -1858,32 +1858,32 @@ Handle<Value> ThrowException(Handle<Value> exception) } -Local<Value> Exception::ReferenceError(Handle<String> message) +Handle<Value> Exception::ReferenceError(Handle<String> message) { Q_UNUSED(message); QV4::Object *o = currentEngine()->newReferenceErrorObject(message->ToString()->asQString()); - return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } -Local<Value> Exception::SyntaxError(Handle<String> message) +Handle<Value> Exception::SyntaxError(Handle<String> message) { Q_UNUSED(message); QV4::Object *o = currentEngine()->newSyntaxErrorObject(currentEngine()->current, 0); - return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } -Local<Value> Exception::TypeError(Handle<String> message) +Handle<Value> Exception::TypeError(Handle<String> message) { Q_UNUSED(message); QV4::Object *o = currentEngine()->newTypeErrorObject(message->ToString()->asQString()); - return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } -Local<Value> Exception::Error(Handle<String> message) +Handle<Value> Exception::Error(Handle<String> message) { Q_UNUSED(message); QV4::Object *o = currentEngine()->newErrorObject(QV4::Value::fromString(currentEngine()->current, message->ToString()->asQString())); - return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o))); + return QV4::Value::fromObject(o); } @@ -1902,7 +1902,7 @@ void Isolate::setException(const QV4::Value &ex) { if (tryCatch) { tryCatch->hasCaughtException = true; - tryCatch->exception = Local<Value>::New(Value::fromV4Value(ex)); + tryCatch->exception = ex; } } @@ -1934,8 +1934,8 @@ static bool v8ExternalResourceComparison(const QV4::Value &a, const QV4::Value & { if (!userObjectComparisonCallback) return false; - Local<Object> la = Local<Object>::New(Value::fromV4Value(a)); - Local<Object> lb = Local<Object>::New(Value::fromV4Value(b)); + Handle<Object> la = a; + Handle<Object> lb = b; return userObjectComparisonCallback(la, lb); } @@ -1990,15 +1990,15 @@ Handle<Value> TryCatch::ReThrow() Q_UNREACHABLE(); } -Local<Value> TryCatch::Exception() const +Handle<Value> TryCatch::Exception() const { return exception; } -Local<Message> TryCatch::Message() const +Handle<Message> TryCatch::Message() const { Q_UNIMPLEMENTED(); - return Local<v8::Message>::New(Handle<v8::Message>(new v8::Message(QString(), QString(), 0))); + return Handle<v8::Message>(new v8::Message(QString(), QString(), 0)); } void TryCatch::Reset() @@ -2007,7 +2007,7 @@ void TryCatch::Reset() } -Local<Value> Context::GetCallingScriptData() +Handle<Value> Context::GetCallingScriptData() { Q_UNIMPLEMENTED(); Q_UNREACHABLE(); diff --git a/src/qml/qml/v4/qv4v8_p.h b/src/qml/qml/v4/qv4v8_p.h index 2b695e6454..6e96687310 100644 --- a/src/qml/qml/v4/qv4v8_p.h +++ b/src/qml/qml/v4/qv4v8_p.h @@ -123,7 +123,7 @@ class ImplementationUtilities; class Signature; class AccessorSignature; template <class T> struct Handle; -template <class T> class Local; +template <class T> class Handle; template <class T> class Persistent; class FunctionTemplate; class ObjectTemplate; @@ -413,52 +413,6 @@ struct Handle { }; -/** - * A light-weight stack-allocated object handle. All operations - * that return objects from within v8 return them in local handles. They - * are created within HandleScopes, and all local handles allocated within a - * handle scope are destroyed when the handle scope is destroyed. Hence it - * is not necessary to explicitly deallocate local handles. - */ -template <class T> class Local : public Handle<T> { - public: - Local() {} - template <class S> Local(Local<S> that) - : Handle<T>(Handle<T>::Cast(that)) { - /** - * This check fails when trying to convert between incompatible - * handles. For example, converting from a Handle<String> to a - * Handle<Number>. - */ - TYPE_CHECK(T, S); - } - template <class S> Local(S* that) : Handle<T>(that) { } - template <class S> static Local<T> Cast(Local<S> that) { -#ifdef V8_ENABLE_CHECKS - // If we're going to perform the type check then we have to check - // that the handle isn't empty before doing the checked cast. - if (that.IsEmpty()) return Local<T>(); -#endif - return Local<T>::New(Handle<T>::Cast(that)); - } - - template <class S> Local<S> As() { - return Local<S>::Cast(*this); - } - - /** Create a local handle for the content of another handle. - * The referee is kept alive by the local handle even when - * the original handle is destroyed/disposed. - */ - static Local<T> New(Handle<T> that) - { - Local<T> result; - result.Handle<T>::operator =(that); - return result; - } -}; - - /** * An object reference that is independent of any handle scope. Where * a Local handle only lives as long as the HandleScope in which it was @@ -641,7 +595,7 @@ class V8EXPORT Script : public QSharedData { * \return Compiled script object (context independent; when run it * will use the currently entered context). */ - static Local<Script> New(Handle<String> source, + static Handle<Script> New(Handle<String> source, ScriptOrigin* origin = NULL, ScriptData* pre_data = NULL, Handle<String> script_data = Handle<String>(), @@ -657,7 +611,7 @@ class V8EXPORT Script : public QSharedData { * \return Compiled script object (context independent; when run it * will use the currently entered context). */ - static Local<Script> New(Handle<String> source, + static Handle<Script> New(Handle<String> source, Handle<Value> file_name, CompileFlags = Default); @@ -677,7 +631,7 @@ class V8EXPORT Script : public QSharedData { * when this function was called. When run it will always use this * context. */ - static Local<Script> Compile(Handle<String> source, + static Handle<Script> Compile(Handle<String> source, ScriptOrigin* origin = NULL, ScriptData* pre_data = NULL, Handle<String> script_data = Handle<String>(), @@ -696,7 +650,7 @@ class V8EXPORT Script : public QSharedData { * when this function was called. When run it will always use this * context. */ - static Local<Script> Compile(Handle<String> source, + static Handle<Script> Compile(Handle<String> source, Handle<Value> file_name, Handle<String> script_data = Handle<String>(), CompileFlags = Default); @@ -708,13 +662,13 @@ class V8EXPORT Script : public QSharedData { * using ::Compile) it will be run in the context in which it was * compiled. */ - Local<Value> Run(); - Local<Value> Run(Handle<Object> qml); + Handle<Value> Run(); + Handle<Value> Run(Handle<Object> qml); /** * Returns the script id value. */ - Local<Value> Id(); + Handle<Value> Id(); /** * Associate an additional data object with the script. This is mainly used @@ -739,7 +693,7 @@ class V8EXPORT Message : public QSharedData { Message(const QString &message, const QString &resourceName, int lineNumber) : m_message(message), m_resourceName(resourceName), m_lineNumber(lineNumber) {} - Local<String> Get() const; + Handle<String> Get() const; /** * Returns the resource name for the script from where the function causing * the error originates. @@ -786,7 +740,7 @@ class V8EXPORT StackTrace : public QSharedData /** * Returns a StackFrame at a particular index. */ - Local<StackFrame> GetFrame(uint32_t index) const; + Handle<StackFrame> GetFrame(uint32_t index) const; /** * Returns the number of StackFrames. @@ -796,7 +750,7 @@ class V8EXPORT StackTrace : public QSharedData /** * Returns StackTrace as a v8::Array that contains StackFrame objects. */ - Local<Array> AsArray(); + Handle<Array> AsArray(); /** * Grab a snapshot of the current JavaScript execution stack. @@ -805,12 +759,12 @@ class V8EXPORT StackTrace : public QSharedData * \param options Enumerates the set of things we will capture for each * StackFrame. */ - static Local<StackTrace> CurrentStackTrace( + static Handle<StackTrace> CurrentStackTrace( int frame_limit, StackTraceOptions options = kOverview); private: - QVector<Local<StackFrame> > frames; + QVector<Handle<StackFrame> > frames; }; DEFINE_REFCOUNTED_HANDLE_OPERATIONS(StackTrace) @@ -842,19 +796,19 @@ class V8EXPORT StackFrame : public QSharedData { * Returns the name of the resource that contains the script for the * function for this StackFrame. */ - Local<String> GetScriptName() const; + Handle<String> GetScriptName() const; /** * Returns the name of the resource that contains the script for the * function for this StackFrame or sourceURL value if the script name * is undefined and its source ends with //@ sourceURL=... string. */ - Local<String> GetScriptNameOrSourceURL() const; + Handle<String> GetScriptNameOrSourceURL() const; /** * Returns the name of the function associated with this stack frame. */ - Local<String> GetFunctionName() const; + Handle<String> GetFunctionName() const; private: friend class StackTrace; @@ -973,19 +927,19 @@ class V8EXPORT Value { */ bool IsError() const; - Local<Boolean> ToBoolean() const; - Local<Number> ToNumber() const; - Local<String> ToString() const; - Local<Object> ToObject() const; - Local<Integer> ToInteger() const; - Local<Uint32> ToUint32() const; - Local<Int32> ToInt32() const; + Handle<Boolean> ToBoolean() const; + Handle<Number> ToNumber() const; + Handle<String> ToString() const; + Handle<Object> ToObject() const; + Handle<Integer> ToInteger() const; + Handle<Uint32> ToUint32() const; + Handle<Int32> ToInt32() const; /** * Attempts to convert a string to an array index. * Returns an empty handle if the conversion fails. */ - Local<Uint32> ToArrayIndex() const; + Handle<Uint32> ToArrayIndex() const; bool BooleanValue() const; double NumberValue() const; @@ -1155,15 +1109,15 @@ class V8EXPORT String : public Primitive { * 'strlen' to determine the buffer length, it might be * wrong if 'data' contains a null character. */ - static Local<String> New(const char* data, int length = -1); + static Handle<String> New(const char* data, int length = -1); /** Allocates a new string from 16-bit character codes.*/ - static Local<String> New(const uint16_t* data, int length = -1); + static Handle<String> New(const uint16_t* data, int length = -1); /** Creates a symbol. Returns one if it exists already.*/ - static Local<String> NewSymbol(const char* data, int length = -1); + static Handle<String> NewSymbol(const char* data, int length = -1); - static Local<String> New(QV4::String *s); + static Handle<String> New(QV4::String *s); /** * Creates a new external string using the data defined in the given @@ -1173,7 +1127,7 @@ class V8EXPORT String : public Primitive { * should the underlying buffer be deallocated or modified except through the * destructor of the external string resource. */ - static Local<String> NewExternal(ExternalStringResource* resource); + static Handle<String> NewExternal(ExternalStringResource* resource); /** * Converts an object to an ASCII string. @@ -1229,7 +1183,7 @@ class V8EXPORT String : public Primitive { class V8EXPORT Number : public Primitive { public: double Value() const; - static Local<Number> New(double value); + static Handle<Number> New(double value); static Number* Cast(v8::Value* obj); }; @@ -1239,8 +1193,8 @@ class V8EXPORT Number : public Primitive { */ class V8EXPORT Integer : public Number { public: - static Local<Integer> New(int32_t value); - static Local<Integer> NewFromUnsigned(uint32_t value); + static Handle<Integer> New(int32_t value); + static Handle<Integer> NewFromUnsigned(uint32_t value); int64_t Value() const; static Integer* Cast(v8::Value* obj); }; @@ -1280,12 +1234,12 @@ enum PropertyAttribute { * setting|getting a particular property. See Object and ObjectTemplate's * method SetAccessor. */ -typedef Handle<Value> (*AccessorGetter)(Local<String> property, +typedef Handle<Value> (*AccessorGetter)(Handle<String> property, const AccessorInfo& info); -typedef void (*AccessorSetter)(Local<String> property, - Local<Value> value, +typedef void (*AccessorSetter)(Handle<String> property, + Handle<Value> value, const AccessorInfo& info); @@ -1322,9 +1276,9 @@ class V8EXPORT Object : public Value { bool Set(uint32_t index, Handle<Value> value); - Local<Value> Get(Handle<Value> key); + Handle<Value> Get(Handle<Value> key); - Local<Value> Get(uint32_t index); + Handle<Value> Get(uint32_t index); // TODO(1245389): Replace the type-specific versions of these // functions with generic ones that accept a Handle<Value> key. @@ -1349,21 +1303,21 @@ class V8EXPORT Object : public Value { * array returned by this method contains the same values as would * be enumerated by a for-in statement over this object. */ - Local<Array> GetPropertyNames(); + Handle<Array> GetPropertyNames(); /** * This function has the same functionality as GetPropertyNames but * the returned array doesn't contain the names of properties from * prototype objects. */ - Local<Array> GetOwnPropertyNames(); + Handle<Array> GetOwnPropertyNames(); /** * Get the prototype object. This does not skip objects marked to * be skipped by __proto__ and it does not consult the security * handler. */ - Local<Value> GetPrototype(); + Handle<Value> GetPrototype(); /** * Set the prototype object. This does not skip objects marked to @@ -1373,7 +1327,7 @@ class V8EXPORT Object : public Value { bool SetPrototype(Handle<Value> prototype); /** Gets the value in an internal field. */ - Local<Value> GetInternalField(int index); + Handle<Value> GetInternalField(int index); /** Sets the value in an internal field. */ void SetInternalField(int index, Handle<Value> value); @@ -1412,13 +1366,13 @@ class V8EXPORT Object : public Value { * identity hash) are prefixed with "v8::". */ bool SetHiddenValue(Handle<String> key, Handle<Value> value); - Local<Value> GetHiddenValue(Handle<String> key); + Handle<Value> GetHiddenValue(Handle<String> key); /** * Clone this object with a fast but shallow copy. Values will point * to the same values as the original object. */ - Local<Object> Clone(); + Handle<Object> Clone(); /** @@ -1432,7 +1386,7 @@ class V8EXPORT Object : public Value { * Call an Object as a function if a callback is set by the * ObjectTemplate::SetCallAsFunctionHandler method. */ - Local<Value> CallAsFunction(Handle<Object> recv, + Handle<Value> CallAsFunction(Handle<Object> recv, int argc, Handle<Value> argv[]); @@ -1441,10 +1395,10 @@ class V8EXPORT Object : public Value { * ObjectTemplate::SetCallAsFunctionHandler method. * Note: This method behaves like the Function::NewInstance method. */ - Local<Value> CallAsConstructor(int argc, + Handle<Value> CallAsConstructor(int argc, Handle<Value> argv[]); - static Local<Object> New(); + static Handle<Object> New(); static Object* Cast(Value* obj); }; @@ -1460,7 +1414,7 @@ class V8EXPORT Array : public Object { * Creates a JavaScript array with the given length. If the length * is negative the returned array will have length 0. */ - static Local<Array> New(int length = 0); + static Handle<Array> New(int length = 0); static Array* Cast(Value* obj); }; @@ -1471,9 +1425,9 @@ class V8EXPORT Array : public Object { */ class V8EXPORT Function : public Object { public: - Local<Object> NewInstance() const; - Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; - Local<Value> Call(Handle<Object> recv, + Handle<Object> NewInstance() const; + Handle<Object> NewInstance(int argc, Handle<Value> argv[]) const; + Handle<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); Handle<Value> GetName() const; @@ -1488,7 +1442,7 @@ class V8EXPORT Function : public Object { */ class V8EXPORT Date : public Object { public: - static Local<Value> New(double time); + static Handle<Value> New(double time); /** * A specialization of Value::NumberValue that is more efficient @@ -1520,7 +1474,7 @@ class V8EXPORT Date : public Object { */ class V8EXPORT NumberObject : public Object { public: - static Local<Value> New(double value); + static Handle<Value> New(double value); /** * Returns the Number held by the object. @@ -1537,7 +1491,7 @@ class V8EXPORT NumberObject : public Object { */ class V8EXPORT BooleanObject : public Object { public: - static Local<Value> New(bool value); + static Handle<Value> New(bool value); /** * Returns the Boolean held by the object. @@ -1554,12 +1508,12 @@ class V8EXPORT BooleanObject : public Object { */ class V8EXPORT StringObject : public Object { public: - static Local<Value> New(Handle<String> value); + static Handle<Value> New(Handle<String> value); /** * Returns the String held by the object. */ - Local<String> StringValue() const; + Handle<String> StringValue() const; static StringObject* Cast(v8::Value* obj); @@ -1592,14 +1546,14 @@ class V8EXPORT RegExp : public Object { * static_cast<RegExp::Flags>(kGlobal | kMultiline)) * is equivalent to evaluating "/foo/gm". */ - static Local<RegExp> New(Handle<String> pattern, + static Handle<RegExp> New(Handle<String> pattern, Flags flags); /** * Returns the value of the source property: a string representing * the regular expression. */ - Local<String> GetSource() const; + Handle<String> GetSource() const; /** * Returns the flags bit field. @@ -1624,10 +1578,10 @@ class V8EXPORT RegExp : public Object { */ class V8EXPORT External : public Value { public: - static Local<Value> Wrap(void* data); + static Handle<Value> Wrap(void* data); static void* Unwrap(Handle<Value> obj); - static Local<External> New(void* value); + static Handle<External> New(void* value); static External* Cast(Value* obj); void* Value() const; }; @@ -1667,11 +1621,11 @@ class V8EXPORT Arguments { Arguments(const QV4::Value *args, int argc, const QV4::Value &thisObject, bool isConstructor, const Persistent<Value> &data); int Length() const; - Local<Value> operator[](int i) const; - Local<Object> This() const; - Local<Object> Holder() const; + Handle<Value> operator[](int i) const; + Handle<Object> This() const; + Handle<Object> Holder() const; bool IsConstructCall() const; - Local<Value> Data() const; + Handle<Value> Data() const; Isolate* GetIsolate() const; private: @@ -1690,9 +1644,9 @@ class V8EXPORT AccessorInfo { public: AccessorInfo(const QV4::Value &thisObject, const Persistent<Value> &data); Isolate* GetIsolate() const; - Local<Value> Data() const; - Local<Object> This() const; - Local<Object> Holder() const; + Handle<Value> Data() const; + Handle<Object> This() const; + Handle<Object> Holder() const; private: Persistent<Value> m_this; Persistent<Value> m_data; @@ -1705,7 +1659,7 @@ typedef Handle<Value> (*InvocationCallback)(const Arguments& args); * NamedProperty[Getter|Setter] are used as interceptors on object. * See ObjectTemplate::SetNamedPropertyHandler. */ -typedef Handle<Value> (*NamedPropertyGetter)(Local<String> property, +typedef Handle<Value> (*NamedPropertyGetter)(Handle<String> property, const AccessorInfo& info); @@ -1713,8 +1667,8 @@ typedef Handle<Value> (*NamedPropertyGetter)(Local<String> property, * Returns the value if the setter intercepts the request. * Otherwise, returns an empty handle. */ -typedef Handle<Value> (*NamedPropertySetter)(Local<String> property, - Local<Value> value, +typedef Handle<Value> (*NamedPropertySetter)(Handle<String> property, + Handle<Value> value, const AccessorInfo& info); /** @@ -1722,7 +1676,7 @@ typedef Handle<Value> (*NamedPropertySetter)(Local<String> property, * The result is an integer encoding property attributes (like v8::None, * v8::DontEnum, etc.) */ -typedef Handle<Integer> (*NamedPropertyQuery)(Local<String> property, +typedef Handle<Integer> (*NamedPropertyQuery)(Handle<String> property, const AccessorInfo& info); @@ -1731,7 +1685,7 @@ typedef Handle<Integer> (*NamedPropertyQuery)(Local<String> property, * The return value is true if the property could be deleted and false * otherwise. */ -typedef Handle<Boolean> (*NamedPropertyDeleter)(Local<String> property, +typedef Handle<Boolean> (*NamedPropertyDeleter)(Handle<String> property, const AccessorInfo& info); /** @@ -1754,7 +1708,7 @@ typedef Handle<Value> (*IndexedPropertyGetter)(uint32_t index, * Otherwise, returns an empty handle. */ typedef Handle<Value> (*IndexedPropertySetter)(uint32_t index, - Local<Value> value, + Handle<Value> value, const AccessorInfo& info); @@ -1875,28 +1829,28 @@ typedef Handle<Array> (*IndexedPropertyEnumerator)(const AccessorInfo& info); class V8EXPORT FunctionTemplate : public Template { public: /** Creates a function template.*/ - static Local<FunctionTemplate> New( + static Handle<FunctionTemplate> New( InvocationCallback callback = 0, Handle<Value> data = Handle<Value>()); /** Returns the unique function instance in the current execution context.*/ - Local<Function> GetFunction(); + Handle<Function> GetFunction(); /** Get the InstanceTemplate. */ - Local<ObjectTemplate> InstanceTemplate(); + Handle<ObjectTemplate> InstanceTemplate(); /** * A PrototypeTemplate is the template used to create the prototype object * of the function created by this template. */ - Local<ObjectTemplate> PrototypeTemplate(); + Handle<ObjectTemplate> PrototypeTemplate(); private: FunctionTemplate(InvocationCallback callback, Handle<Value> data); friend class V4V8Function; InvocationCallback m_callback; Persistent<Value> m_data; - Local<ObjectTemplate> m_instanceTemplate; - Local<ObjectTemplate> m_prototypeTemplate; + Handle<ObjectTemplate> m_instanceTemplate; + Handle<ObjectTemplate> m_prototypeTemplate; }; DEFINE_REFCOUNTED_HANDLE_OPERATIONS(FunctionTemplate) @@ -1911,10 +1865,10 @@ DEFINE_REFCOUNTED_HANDLE_OPERATIONS(FunctionTemplate) class V8EXPORT ObjectTemplate : public Template { public: /** Creates an ObjectTemplate. */ - static Local<ObjectTemplate> New(); + static Handle<ObjectTemplate> New(); /** Creates a new instance of this template.*/ - Local<Object> NewInstance(); + Handle<Object> NewInstance(); /** * Sets an accessor on the object template. @@ -2091,16 +2045,16 @@ Handle<Value> V8EXPORT ThrowException(Handle<Value> exception); */ class V8EXPORT Exception { public: - static Local<Value> ReferenceError(Handle<String> message); - static Local<Value> SyntaxError(Handle<String> message); - static Local<Value> TypeError(Handle<String> message); - static Local<Value> Error(Handle<String> message); + static Handle<Value> ReferenceError(Handle<String> message); + static Handle<Value> SyntaxError(Handle<String> message); + static Handle<Value> TypeError(Handle<String> message); + static Handle<Value> Error(Handle<String> message); }; // --- User Object Comparison Callback --- -typedef bool (*UserObjectComparisonCallback)(Local<Object> lhs, - Local<Object> rhs); +typedef bool (*UserObjectComparisonCallback)(Handle<Object> lhs, + Handle<Object> rhs); // --- Garbage Collection Callbacks --- @@ -2236,7 +2190,7 @@ class V8EXPORT TryCatch { * * The returned handle is valid until this TryCatch block has been destroyed. */ - Local<Value> Exception() const; + Handle<Value> Exception() const; /** * Returns the message associated with this exception. If there is @@ -2245,7 +2199,7 @@ class V8EXPORT TryCatch { * The returned handle is valid until this TryCatch block has been * destroyed. */ - Local<v8::Message> Message() const; + Handle<v8::Message> Message() const; /** * Clears any exceptions that may have been caught by this try/catch block. @@ -2262,7 +2216,7 @@ private: friend class Isolate; TryCatch *parent; bool hasCaughtException; - Local<Value> exception; + Handle<Value> exception; }; @@ -2277,7 +2231,7 @@ public: * context of the top-most JavaScript frame. If there are no * JavaScript frames an empty handle is returned. */ - static Local<Value> GetCallingScriptData(); + static Handle<Value> GetCallingScriptData(); private: Context() {} diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index 038006569e..636725000d 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -73,9 +73,9 @@ enum ConsoleLogTypes { }; static void jsContext(v8::Handle<v8::Value> *file, int *line, v8::Handle<v8::Value> *function) { - v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(1); + v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(1); if (stackTrace->GetFrameCount()) { - v8::Local<v8::StackFrame> frame = stackTrace->GetFrame(0); + v8::Handle<v8::StackFrame> frame = stackTrace->GetFrame(0); *file = frame->GetScriptName(); *line = frame->GetLineNumber(); *function = frame->GetFunctionName(); @@ -91,7 +91,7 @@ static QString jsStack() { int stackCount = stackTrace->GetFrameCount(); for (int i = 0; i < stackCount; i++) { - v8::Local<v8::StackFrame> frame = stackTrace->GetFrame(i); + v8::Handle<v8::StackFrame> frame = stackTrace->GetFrame(i); v8::Handle<v8::String> function(frame->GetFunctionName()); v8::Handle<v8::String> script(frame->GetScriptName()); int lineNumber = frame->GetLineNumber(); @@ -116,10 +116,10 @@ v8::Handle<v8::Value> console(ConsoleLogTypes logType, const v8::Arguments &args if (i != 0) result.append(QLatin1Char(' ')); - v8::Local<v8::Value> value = args[i]; + v8::Handle<v8::Value> value = args[i]; v8::TryCatch tryCatch; - v8::Local<v8::String> toString = value->ToString(); + v8::Handle<v8::String> toString = value->ToString(); if (tryCatch.HasCaught()) { // toString() threw Exception // Is it possible for value to be anything other than Object? @@ -286,7 +286,7 @@ v8::Handle<v8::Value> consoleCount(const v8::Arguments &args) v8::StackTrace::CurrentStackTrace(1, v8::StackTrace::kOverview); if (stackTrace->GetFrameCount()) { - v8::Local<v8::StackFrame> frame = stackTrace->GetFrame(0); + v8::Handle<v8::StackFrame> frame = stackTrace->GetFrame(0); QString scriptName = frame->GetScriptName()->v4Value().toQString(); QString functionName = frame->GetFunctionName()->v4Value().toQString(); @@ -336,7 +336,7 @@ v8::Handle<v8::Value> consoleAssert(const v8::Arguments &args) if (i != 1) message.append(QLatin1Char(' ')); - v8::Local<v8::Value> value = args[i]; + v8::Handle<v8::Value> value = args[i]; message.append(value->v4Value().toQString()); } @@ -1146,14 +1146,14 @@ v8::Handle<v8::Value> createQmlObject(const v8::Arguments &args) V8THROW_ERROR("Qt.createQmlObject(): Invalid arguments"); struct Error { - static v8::Local<v8::Value> create(QV8Engine *engine, const QList<QQmlError> &errors) { + static v8::Handle<v8::Value> create(QV8Engine *engine, const QList<QQmlError> &errors) { QString errorstr = QLatin1String("Qt.createQmlObject(): failed to create object: "); - v8::Local<v8::Array> qmlerrors = v8::Array::New(errors.count()); + v8::Handle<v8::Array> qmlerrors = v8::Array::New(errors.count()); for (int ii = 0; ii < errors.count(); ++ii) { const QQmlError &error = errors.at(ii); errorstr += QLatin1String("\n ") + error.toString(); - v8::Local<v8::Object> qmlerror = v8::Object::New(); + v8::Handle<v8::Object> qmlerror = v8::Object::New(); qmlerror->Set(v8::String::New("lineNumber"), v8::Integer::New(error.line())); qmlerror->Set(v8::String::New("columnNumber"), v8::Integer::New(error.column())); qmlerror->Set(v8::String::New("fileName"), engine->toString(error.url().toString())); @@ -1161,8 +1161,8 @@ v8::Handle<v8::Value> createQmlObject(const v8::Arguments &args) qmlerrors->Set(ii, qmlerror); } - v8::Local<v8::Value> error = v8::Exception::Error(engine->toString(errorstr)); - v8::Local<v8::Object> errorObject = error->ToObject(); + v8::Handle<v8::Value> error = v8::Exception::Error(engine->toString(errorstr)); + v8::Handle<v8::Object> errorObject = error->ToObject(); errorObject->Set(v8::String::New("qmlErrors"), qmlerrors); return error; } @@ -1289,7 +1289,7 @@ v8::Handle<v8::Value> createComponent(const v8::Arguments &args) int consumedCount = 1; if (args.Length() > 1) { - const v8::Local<v8::Value> &lastArg = args[args.Length()-1]; + const v8::Handle<v8::Value> &lastArg = args[args.Length()-1]; // The second argument could be the mode enum if (args[1]->IsInt32()) { diff --git a/src/qml/qml/v8/qv4domerrors_p.h b/src/qml/qml/v8/qv4domerrors_p.h index 7a589ba042..434f9c5846 100644 --- a/src/qml/qml/v8/qv4domerrors_p.h +++ b/src/qml/qml/v8/qv4domerrors_p.h @@ -77,7 +77,7 @@ QT_BEGIN_NAMESPACE #define DOMEXCEPTION_TYPE_MISMATCH_ERR 17 #define V8THROW_DOM(error, string) { \ - v8::Local<v8::Value> v = v8::Exception::Error(v8::String::New(string)); \ + v8::Handle<v8::Value> v = v8::Exception::Error(v8::String::New(string)); \ v->ToObject()->Set(v8::String::New("code"), v8::Integer::New(error)); \ v8::ThrowException(v); \ return v8::Handle<v8::Value>(); \ diff --git a/src/qml/qml/v8/qv8bindings.cpp b/src/qml/qml/v8/qv8bindings.cpp index f471a65bd4..ebd3451958 100644 --- a/src/qml/qml/v8/qv8bindings.cpp +++ b/src/qml/qml/v8/qv8bindings.cpp @@ -174,11 +174,11 @@ void QV8Bindings::Binding::update(QQmlPropertyPrivate::WriteFlags flags) ep->referenceScarceResources(); QV4::ArrayObject *f = parent->functions(); - v8::Local<v8::Value> result = f ? + v8::Handle<v8::Value> result = f ? evaluate(context, f->getIndexed(f->internalClass->engine->current, instruction->value), &isUndefined) - : v8::Local<v8::Value>::New(QV4::Value::undefinedValue()); + : v8::Handle<v8::Value>(QV4::Value::undefinedValue()); trace.event("writing V8 result"); bool needsErrorLocationData = false; @@ -246,7 +246,7 @@ QV8Bindings::QV8Bindings(QQmlCompiledData::V8Program *program, QV8Engine *engine = QQmlEnginePrivate::getV8Engine(context->engine); if (program->bindings->isDeleted()) { - v8::Local<v8::Script> script; + v8::Handle<v8::Script> script; bool compileFailed = false; { v8::TryCatch try_catch; @@ -261,7 +261,7 @@ QV8Bindings::QV8Bindings(QQmlCompiledData::V8Program *program, compileFailed = true; QQmlError error; error.setDescription(QString(QLatin1String("Exception occurred during compilation of binding at line: %1")).arg(line)); - v8::Local<v8::Message> message = try_catch.Message(); + v8::Handle<v8::Message> message = try_catch.Message(); if (!message.IsEmpty()) QQmlExpressionPrivate::exceptionToError(message, error); QQmlEnginePrivate::get(engine->engine())->warning(error); @@ -270,7 +270,7 @@ QV8Bindings::QV8Bindings(QQmlCompiledData::V8Program *program, } if (!compileFailed) { - v8::Local<v8::Value> result = script->Run(engine->contextWrapper()->sharedContext()); + v8::Handle<v8::Value> result = script->Run(engine->contextWrapper()->sharedContext()); if (result->IsArray()) { program->bindings = result->v4Value(); program->program.clear(); // We don't need the source anymore diff --git a/src/qml/qml/v8/qv8contextwrapper.cpp b/src/qml/qml/v8/qv8contextwrapper.cpp index 7676f96b66..5e84082d8c 100644 --- a/src/qml/qml/v8/qv8contextwrapper.cpp +++ b/src/qml/qml/v8/qv8contextwrapper.cpp @@ -120,11 +120,11 @@ QQmlContextData *QV8ContextResource::getContext() const if (!hasSubContexts) return context; - v8::Local<v8::Value> callingdata = v8::Context::GetCallingScriptData(); + v8::Handle<v8::Value> callingdata = v8::Context::GetCallingScriptData(); if (callingdata.IsEmpty() || !callingdata->IsString()) return context; - v8::Local<v8::String> callingstring = callingdata->ToString(); + v8::Handle<v8::String> callingstring = callingdata->ToString(); Q_ASSERT(callingstring->IsExternal()); Q_ASSERT(callingstring->GetExternalStringResource()); @@ -152,19 +152,19 @@ void QV8ContextWrapper::init(QV8Engine *engine) { m_engine = engine; { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetHasExternalResource(true); ft->InstanceTemplate()->SetFallbackPropertyHandler(Getter, Setter); m_constructor = qPersistentNew<v8::Function>(ft->GetFunction()); } { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetHasExternalResource(true); ft->InstanceTemplate()->SetFallbackPropertyHandler(NullGetter, NullSetter); m_urlConstructor = qPersistentNew<v8::Function>(ft->GetFunction()); } { - v8::Local<v8::Object> sharedContext = m_constructor->NewInstance(); + v8::Handle<v8::Object> sharedContext = m_constructor->NewInstance(); QV8ContextResource *r = new QV8ContextResource(engine, 0, 0); r->isSharedContext = true; sharedContext->SetExternalResource(r); @@ -172,16 +172,16 @@ void QV8ContextWrapper::init(QV8Engine *engine) } } -v8::Local<v8::Object> QV8ContextWrapper::qmlScope(QQmlContextData *ctxt, QObject *scope) +v8::Handle<v8::Object> QV8ContextWrapper::qmlScope(QQmlContextData *ctxt, QObject *scope) { // XXX NewInstance() should be optimized - v8::Local<v8::Object> rv = m_constructor->NewInstance(); + v8::Handle<v8::Object> rv = m_constructor->NewInstance(); QV8ContextResource *r = new QV8ContextResource(m_engine, ctxt, scope); rv->SetExternalResource(r); return rv; } -v8::Local<v8::Object> QV8ContextWrapper::urlScope(const QUrl &url) +v8::Handle<v8::Object> QV8ContextWrapper::urlScope(const QUrl &url) { QQmlContextData *context = new QQmlContextData; context->url = url; @@ -189,7 +189,7 @@ v8::Local<v8::Object> QV8ContextWrapper::urlScope(const QUrl &url) context->isJSContext = true; // XXX NewInstance() should be optimized - v8::Local<v8::Object> rv = m_urlConstructor->NewInstance(); + v8::Handle<v8::Object> rv = m_urlConstructor->NewInstance(); QV8ContextResource *r = new QV8ContextResource(m_engine, context, 0, true); rv->SetExternalResource(r); return rv; @@ -237,14 +237,14 @@ void QV8ContextWrapper::takeContextOwnership(v8::Handle<v8::Object> qmlglobal) r->ownsContext = true; } -v8::Handle<v8::Value> QV8ContextWrapper::NullGetter(v8::Local<v8::String>, +v8::Handle<v8::Value> QV8ContextWrapper::NullGetter(v8::Handle<v8::String>, const v8::AccessorInfo &) { // V8 will throw a ReferenceError if appropriate ("typeof" should not throw) return v8::Handle<v8::Value>(); } -v8::Handle<v8::Value> QV8ContextWrapper::Getter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8ContextWrapper::Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { QV8ContextResource *resource = v8_resource_check<QV8ContextResource>(info.This()); @@ -355,8 +355,8 @@ v8::Handle<v8::Value> QV8ContextWrapper::Getter(v8::Local<v8::String> property, return v8::Handle<v8::Value>(); } -v8::Handle<v8::Value> QV8ContextWrapper::NullSetter(v8::Local<v8::String> property, - v8::Local<v8::Value>, +v8::Handle<v8::Value> QV8ContextWrapper::NullSetter(v8::Handle<v8::String> property, + v8::Handle<v8::Value>, const v8::AccessorInfo &info) { QV8ContextResource *resource = v8_resource_check<QV8ContextResource>(info.This()); @@ -373,8 +373,8 @@ v8::Handle<v8::Value> QV8ContextWrapper::NullSetter(v8::Local<v8::String> proper } } -v8::Handle<v8::Value> QV8ContextWrapper::Setter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, +v8::Handle<v8::Value> QV8ContextWrapper::Setter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8ContextResource *resource = v8_resource_check<QV8ContextResource>(info.This()); diff --git a/src/qml/qml/v8/qv8contextwrapper_p.h b/src/qml/qml/v8/qv8contextwrapper_p.h index 3e14a019a7..8a0fbae891 100644 --- a/src/qml/qml/v8/qv8contextwrapper_p.h +++ b/src/qml/qml/v8/qv8contextwrapper_p.h @@ -72,8 +72,8 @@ public: void init(QV8Engine *); void destroy(); - v8::Local<v8::Object> qmlScope(QQmlContextData *ctxt, QObject *scope); - v8::Local<v8::Object> urlScope(const QUrl &); + v8::Handle<v8::Object> qmlScope(QQmlContextData *ctxt, QObject *scope); + v8::Handle<v8::Object> urlScope(const QUrl &); void setReadOnly(v8::Handle<v8::Object>, bool); @@ -88,15 +88,15 @@ public: void takeContextOwnership(v8::Handle<v8::Object> qmlglobal); private: - static v8::Handle<v8::Value> NullGetter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> NullGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> NullSetter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, + static v8::Handle<v8::Value> NullSetter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> Setter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, + static v8::Handle<v8::Value> Setter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info); QV8Engine *m_engine; diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 96e4e17671..6b6fe7b94c 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -80,7 +80,7 @@ Q_DECLARE_METATYPE(QList<int>) // QQmlEngine is not available QT_BEGIN_NAMESPACE -static bool ObjectComparisonCallback(v8::Local<v8::Object> lhs, v8::Local<v8::Object> rhs) +static bool ObjectComparisonCallback(v8::Handle<v8::Object> lhs, v8::Handle<v8::Object> rhs) { if (lhs == rhs) return true; @@ -421,7 +421,7 @@ QV4::Value QV8Engine::fromVariant(const QVariant &variant) } // A handle scope and context must be entered -v8::Local<v8::Script> QV8Engine::qmlModeCompile(const QString &source, +v8::Handle<v8::Script> QV8Engine::qmlModeCompile(const QString &source, const QString &fileName, quint16 lineNumber) { @@ -430,7 +430,7 @@ v8::Local<v8::Script> QV8Engine::qmlModeCompile(const QString &source, v8::ScriptOrigin origin(v8fileName, v8::Integer::New(lineNumber - 1)); - v8::Local<v8::Script> script = v8::Script::Compile(v8source, &origin, 0, v8::Handle<v8::String>(), + v8::Handle<v8::Script> script = v8::Script::Compile(v8source, &origin, 0, v8::Handle<v8::String>(), v8::Script::QmlMode); return script; @@ -438,7 +438,7 @@ v8::Local<v8::Script> QV8Engine::qmlModeCompile(const QString &source, // A handle scope and context must be entered. // source can be either ascii or utf8. -v8::Local<v8::Script> QV8Engine::qmlModeCompile(const char *source, int sourceLength, +v8::Handle<v8::Script> QV8Engine::qmlModeCompile(const char *source, int sourceLength, const QString &fileName, quint16 lineNumber) { @@ -450,7 +450,7 @@ v8::Local<v8::Script> QV8Engine::qmlModeCompile(const char *source, int sourceLe v8::ScriptOrigin origin(v8fileName, v8::Integer::New(lineNumber - 1)); - v8::Local<v8::Script> script = v8::Script::Compile(v8source, &origin, 0, v8::Handle<v8::String>(), + v8::Handle<v8::Script> script = v8::Script::Compile(v8source, &origin, 0, v8::Handle<v8::String>(), v8::Script::QmlMode); return script; @@ -541,8 +541,8 @@ void QV8Engine::initializeGlobal(v8::Handle<v8::Object> global) { using namespace QQmlBuiltinFunctions; - v8::Local<v8::Object> console = v8::Object::New(); - v8::Local<v8::Function> consoleLogFn = V8FUNCTION(consoleLog, this); + v8::Handle<v8::Object> console = v8::Object::New(); + v8::Handle<v8::Function> consoleLogFn = V8FUNCTION(consoleLog, this); console->Set(v8::String::New("debug"), consoleLogFn); console->Set(v8::String::New("log"), consoleLogFn); @@ -559,7 +559,7 @@ void QV8Engine::initializeGlobal(v8::Handle<v8::Object> global) console->Set(v8::String::New("trace"), V8FUNCTION(consoleTrace, this)); console->Set(v8::String::New("exception"), V8FUNCTION(consoleException, this)); - v8::Local<v8::Object> qt = v8::Object::New(); + v8::Handle<v8::Object> qt = v8::Object::New(); // Set all the enums from the "Qt" namespace const QMetaObject *qtMetaObject = StaticQtMetaObject::get(); @@ -636,12 +636,12 @@ void QV8Engine::initializeGlobal(v8::Handle<v8::Object> global) " })"\ "})" - v8::Local<v8::Script> registerArg = v8::Script::New(v8::String::New(STRING_ARG), 0, 0, v8::Handle<v8::String>(), v8::Script::NativeMode); - v8::Local<v8::Value> result = registerArg->Run(); + v8::Handle<v8::Script> registerArg = v8::Script::New(v8::String::New(STRING_ARG), 0, 0, v8::Handle<v8::String>(), v8::Script::NativeMode); + v8::Handle<v8::Value> result = registerArg->Run(); Q_ASSERT(result->IsFunction()); - v8::Local<v8::Function> registerArgFunc = v8::Local<v8::Function>::Cast(result); + v8::Handle<v8::Function> registerArgFunc = v8::Handle<v8::Function>::Cast(result); v8::Handle<v8::Value> args = V8FUNCTION(stringArg, this); - registerArgFunc->Call(v8::Local<v8::Object>::Cast(registerArgFunc), 1, &args); + registerArgFunc->Call(v8::Handle<v8::Object>::Cast(registerArgFunc), 1, &args); #undef STRING_ARG } @@ -1386,7 +1386,7 @@ int QV8Engine::consoleCountHelper(const QString &file, quint16 line, quint16 col return number; } -v8::Handle<v8::Value> QV8Engine::getPlatform(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> QV8Engine::getPlatform(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Engine *engine = reinterpret_cast<QV8Engine*>(v8::External::Cast(info.Data().get())->Value()); if (!engine->m_platform) { @@ -1396,7 +1396,7 @@ v8::Handle<v8::Value> QV8Engine::getPlatform(v8::Local<v8::String>, const v8::Ac return engine->newQObject(engine->m_platform); } -v8::Handle<v8::Value> QV8Engine::getApplication(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> QV8Engine::getApplication(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Engine *engine = reinterpret_cast<QV8Engine*>(v8::External::Cast(info.Data().get())->Value()); if (!engine->m_application) { @@ -1407,7 +1407,7 @@ v8::Handle<v8::Value> QV8Engine::getApplication(v8::Local<v8::String>, const v8: } #ifndef QT_NO_IM -v8::Handle<v8::Value> QV8Engine::getInputMethod(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> QV8Engine::getInputMethod(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Engine *engine = reinterpret_cast<QV8Engine*>(v8::External::Cast(info.Data().get())->Value()); return engine->newQObject(QQml_guiProvider()->inputMethod(), CppOwnership); diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index e871cd464a..d8f6e1bb39 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -184,7 +184,7 @@ class QQmlV8Function { public: int Length() const { return _ac; } - v8::Local<v8::Value> operator[](int idx) { return (*_a)->Get(idx); } + v8::Handle<v8::Value> operator[](int idx) { return (*_a)->Get(idx); } QQmlContextData *context() { return _c; } v8::Handle<v8::Object> qmlGlobal() { return *_g; } void returnValue(v8::Handle<v8::Value> rv) { *_r = rv; } @@ -306,15 +306,15 @@ public: inline bool isVariant(const QV4::Value &); // Compile \a source (from \a fileName at \a lineNumber) in QML mode - v8::Local<v8::Script> qmlModeCompile(const QString &source, + v8::Handle<v8::Script> qmlModeCompile(const QString &source, const QString &fileName = QString(), quint16 lineNumber = 1); - v8::Local<v8::Script> qmlModeCompile(const char *source, int sourceLength = -1, + v8::Handle<v8::Script> qmlModeCompile(const char *source, int sourceLength = -1, const QString &fileName = QString(), quint16 lineNumber = 1); // Return the QML global "scope" object for the \a ctxt context and \a scope object. - inline v8::Local<v8::Object> qmlScope(QQmlContextData *ctxt, QObject *scope); + inline v8::Handle<v8::Object> qmlScope(QQmlContextData *ctxt, QObject *scope); // Return a JS wrapper for the given QObject \a object inline QV4::Value newQObject(QObject *object); @@ -406,10 +406,10 @@ public: void addRelationshipForGC(QObject *object, v8::Persistent<v8::Value> handle); void addRelationshipForGC(QObject *object, QObject *other); - static v8::Handle<v8::Value> getPlatform(v8::Local<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> getApplication(v8::Local<v8::String> property, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> getPlatform(v8::Handle<v8::String> property, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> getApplication(v8::Handle<v8::String> property, const v8::AccessorInfo &info); #ifndef QT_NO_IM - static v8::Handle<v8::Value> getInputMethod(v8::Local<v8::String> property, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> getInputMethod(v8::Handle<v8::String> property, const v8::AccessorInfo &info); #endif struct ThreadData { @@ -514,7 +514,7 @@ bool QV8Engine::isVariant(const QV4::Value &value) return m_variantWrapper.isVariant(value); } -v8::Local<v8::Object> QV8Engine::qmlScope(QQmlContextData *ctxt, QObject *scope) +v8::Handle<v8::Object> QV8Engine::qmlScope(QQmlContextData *ctxt, QObject *scope) { return m_contextWrapper.qmlScope(ctxt, scope); } diff --git a/src/qml/qml/v8/qv8include.cpp b/src/qml/qml/v8/qv8include.cpp index fc59093a0f..f37ed73ee5 100644 --- a/src/qml/qml/v8/qv8include.cpp +++ b/src/qml/qml/v8/qv8include.cpp @@ -78,10 +78,10 @@ QV8Include::~QV8Include() qPersistentDispose(m_resultObject); } -v8::Local<v8::Object> QV8Include::resultValue(Status status) +v8::Handle<v8::Object> QV8Include::resultValue(Status status) { // XXX It seems inefficient to create this object from scratch each time. - v8::Local<v8::Object> result = v8::Object::New(); + v8::Handle<v8::Object> result = v8::Object::New(); result->Set(v8::String::New("OK"), v8::Integer::New(Ok)); result->Set(v8::String::New("LOADING"), v8::Integer::New(Loading)); result->Set(v8::String::New("NETWORK_ERROR"), v8::Integer::New(NetworkError)); @@ -141,7 +141,7 @@ void QV8Include::finished() v8::TryCatch try_catch; - v8::Local<v8::Script> script = m_engine->qmlModeCompile(code, m_url.toString()); + v8::Handle<v8::Script> script = m_engine->qmlModeCompile(code, m_url.toString()); if (!try_catch.HasCaught()) { m_engine->contextWrapper()->addSubContext(m_qmlglobal, script, importContext); @@ -180,20 +180,20 @@ v8::Handle<v8::Value> QV8Include::include(const v8::Arguments &args) QUrl url(context->resolvedUrl(QUrl(args[0]->v4Value().toQString()))); - v8::Local<v8::Function> callbackFunction; + v8::Handle<v8::Function> callbackFunction; if (args.Length() >= 2 && args[1]->IsFunction()) - callbackFunction = v8::Local<v8::Function>::Cast(args[1]); + callbackFunction = v8::Handle<v8::Function>::Cast(args[1]); QString localFile = QQmlFile::urlToLocalFileOrQrc(url); - v8::Local<v8::Object> result; + v8::Handle<v8::Object> result; if (localFile.isEmpty()) { QV8Include *i = new QV8Include(url, engine, context, QV4::Value::fromObject(args.GetIsolate()->GetEngine()->qmlContextObject()), callbackFunction); - result = v8::Local<v8::Object>::New(i->result()); + result = i->result(); } else { @@ -212,7 +212,7 @@ v8::Handle<v8::Value> QV8Include::include(const v8::Arguments &args) v8::TryCatch try_catch; - v8::Local<v8::Script> script = engine->qmlModeCompile(code, url.toString()); + v8::Handle<v8::Script> script = engine->qmlModeCompile(code, url.toString()); if (!try_catch.HasCaught()) { v8::Handle<v8::Object> qmlglobal = QV4::Value::fromObject(args.GetIsolate()->GetEngine()->qmlContextObject()); diff --git a/src/qml/qml/v8/qv8include_p.h b/src/qml/qml/v8/qv8include_p.h index 9f850e82b6..36a322e33a 100644 --- a/src/qml/qml/v8/qv8include_p.h +++ b/src/qml/qml/v8/qv8include_p.h @@ -90,7 +90,7 @@ private: v8::Handle<v8::Object> result(); - static v8::Local<v8::Object> resultValue(Status status = Loading); + static v8::Handle<v8::Object> resultValue(Status status = Loading); static void callback(QV8Engine *engine, v8::Handle<v8::Function> callback, v8::Handle<v8::Object> status); QV8Engine *m_engine; diff --git a/src/qml/qml/v8/qv8listwrapper.cpp b/src/qml/qml/v8/qv8listwrapper.cpp index 58635c7c78..37b5de739f 100644 --- a/src/qml/qml/v8/qv8listwrapper.cpp +++ b/src/qml/qml/v8/qv8listwrapper.cpp @@ -68,7 +68,7 @@ QV8ListWrapper::~QV8ListWrapper() void QV8ListWrapper::init(QV8Engine *engine) { m_engine = engine; - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetFallbackPropertyHandler(Getter, Setter, 0, 0, Enumerator); ft->InstanceTemplate()->SetIndexedPropertyHandler(IndexedGetter); ft->InstanceTemplate()->SetAccessor(v8::String::New("length"), LengthGetter, 0, @@ -89,7 +89,7 @@ v8::Handle<v8::Value> QV8ListWrapper::newList(QObject *object, int propId, int p return v8::Null(); // XXX NewInstance() should be optimized - v8::Local<v8::Object> rv = m_constructor->NewInstance(); + v8::Handle<v8::Object> rv = m_constructor->NewInstance(); QV8ListResource *r = new QV8ListResource(m_engine); r->object = object; r->propertyType = propType; @@ -102,7 +102,7 @@ v8::Handle<v8::Value> QV8ListWrapper::newList(QObject *object, int propId, int p v8::Handle<v8::Value> QV8ListWrapper::newList(const QQmlListProperty<QObject> &prop, int propType) { // XXX NewInstance() should be optimized - v8::Local<v8::Object> rv = m_constructor->NewInstance(); + v8::Handle<v8::Object> rv = m_constructor->NewInstance(); QV8ListResource *r = new QV8ListResource(m_engine); r->object = prop.object; r->property = prop; @@ -130,7 +130,7 @@ QVariant QV8ListWrapper::toVariant(QV8ObjectResource *r) m_engine->engine())); } -v8::Handle<v8::Value> QV8ListWrapper::Getter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8ListWrapper::Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { Q_UNUSED(property); @@ -138,8 +138,8 @@ v8::Handle<v8::Value> QV8ListWrapper::Getter(v8::Local<v8::String> property, return v8::Handle<v8::Value>(); } -v8::Handle<v8::Value> QV8ListWrapper::Setter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, +v8::Handle<v8::Value> QV8ListWrapper::Setter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { Q_UNUSED(property); @@ -161,7 +161,7 @@ v8::Handle<v8::Value> QV8ListWrapper::IndexedGetter(uint32_t index, const v8::Ac } } -v8::Handle<v8::Value> QV8ListWrapper::LengthGetter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8ListWrapper::LengthGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { Q_UNUSED(property); @@ -183,7 +183,7 @@ v8::Handle<v8::Array> QV8ListWrapper::Enumerator(const v8::AccessorInfo &info) quint32 count = resource->property.count?resource->property.count(&resource->property):0; - v8::Local<v8::Array> rv = v8::Array::New(count); + v8::Handle<v8::Array> rv = v8::Array::New(count); for (uint ii = 0; ii < count; ++ii) rv->Set(ii, v8::Number::New(ii)); diff --git a/src/qml/qml/v8/qv8listwrapper_p.h b/src/qml/qml/v8/qv8listwrapper_p.h index 3d780dc12c..e2ec535abc 100644 --- a/src/qml/qml/v8/qv8listwrapper_p.h +++ b/src/qml/qml/v8/qv8listwrapper_p.h @@ -76,14 +76,14 @@ public: QVariant toVariant(QV8ObjectResource *); private: - static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> Setter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, + static v8::Handle<v8::Value> Setter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info); static v8::Handle<v8::Value> IndexedGetter(uint32_t index, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> LengthGetter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> LengthGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); static v8::Handle<v8::Array> Enumerator(const v8::AccessorInfo &info); diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp index e7f87ade35..f669d20de6 100644 --- a/src/qml/qml/v8/qv8qobjectwrapper.cpp +++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp @@ -269,7 +269,7 @@ static inline v8::Handle<v8::Value> valueToHandle(QV8Engine *e, QObject *v) template<typename T, void (*ReadFunction)(QObject *, const QQmlPropertyData &, void *, QQmlNotifier **)> -static v8::Handle<v8::Value> GenericValueGetter(v8::Local<v8::String>, const v8::AccessorInfo &info) +static v8::Handle<v8::Value> GenericValueGetter(v8::Handle<v8::String>, const v8::AccessorInfo &info) { v8::Handle<v8::Object> This = info.This(); QV8QObjectResource *resource = v8_resource_check<QV8QObjectResource>(This); @@ -324,7 +324,7 @@ void QV8QObjectWrapper::init(QV8Engine *engine) destroyHash = m_destroyString.hash(); { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetFallbackPropertyHandler(Getter, Setter, Query, 0, Enumerator); ft->InstanceTemplate()->SetHasExternalResource(true); m_constructor = qPersistentNew<v8::Function>(ft->GetFunction()); @@ -339,21 +339,21 @@ void QV8QObjectWrapper::init(QV8Engine *engine) "});"\ "});"\ "})" - v8::Local<v8::Script> script = v8::Script::New(v8::String::New(CREATE_FUNCTION_SOURCE), &origin, 0, + v8::Handle<v8::Script> script = v8::Script::New(v8::String::New(CREATE_FUNCTION_SOURCE), &origin, 0, v8::Handle<v8::String>(), v8::Script::NativeMode); #undef CREATE_FUNCTION_SOURCE - v8::Local<v8::Function> fn = v8::Local<v8::Function>::Cast(script->Run()); + v8::Handle<v8::Function> fn = v8::Handle<v8::Function>::Cast(script->Run()); v8::Handle<v8::Value> invokeFn = v8::FunctionTemplate::New(Invoke)->GetFunction(); v8::Handle<v8::Value> args[] = { invokeFn }; - v8::Local<v8::Function> createFn = v8::Local<v8::Function>::Cast(fn->Call(v8::Value::fromV4Value(engine->global()), 1, args)); + v8::Handle<v8::Function> createFn = v8::Handle<v8::Function>::Cast(fn->Call(v8::Value::fromV4Value(engine->global()), 1, args)); m_methodConstructor = qPersistentNew<v8::Function>(createFn); } - v8::Local<v8::Function> connect = V8FUNCTION(Connect, engine); - v8::Local<v8::Function> disconnect = V8FUNCTION(Disconnect, engine); + v8::Handle<v8::Function> connect = V8FUNCTION(Connect, engine); + v8::Handle<v8::Function> disconnect = V8FUNCTION(Disconnect, engine); { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetHasExternalResource(true); ft->PrototypeTemplate()->Set(v8::String::New("connect"), connect, v8::DontEnum); ft->PrototypeTemplate()->Set(v8::String::New("disconnect"), disconnect, v8::DontEnum); @@ -361,7 +361,7 @@ void QV8QObjectWrapper::init(QV8Engine *engine) } { - v8::Local<v8::Object> prototype = v8::Local<v8::Object>::New(v8::Value::fromV4Value(engine->global())) + v8::Handle<v8::Object> prototype = v8::Handle<v8::Object>(engine->global()) ->Get(v8::String::New("Function"))->ToObject()->Get(v8::String::New("prototype"))->ToObject(); prototype->Set(v8::String::New("connect"), connect, v8::DontEnum); prototype->Set(v8::String::New("disconnect"), disconnect, v8::DontEnum); @@ -549,7 +549,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::GetProperty(QV8Engine *engine, QObject } else if (result->isV8Function()) { return MethodClosure::createWithGlobal(engine, object, objectHandle, result->coreIndex); } else if (result->isSignalHandler()) { - v8::Local<v8::Object> handler = engine->qobjectWrapper()->m_signalHandlerConstructor->NewInstance(); + v8::Handle<v8::Object> handler = engine->qobjectWrapper()->m_signalHandlerConstructor->NewInstance(); QV8SignalHandlerResource *r = new QV8SignalHandlerResource(engine, object, result->coreIndex); handler->SetExternalResource(r); return handler; @@ -615,10 +615,10 @@ static inline void StoreProperty(QV8Engine *engine, QObject *object, QQmlPropert QQmlContextData *context = engine->callingContext(); v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(value); - v8::Local<v8::StackTrace> trace = + v8::Handle<v8::StackTrace> trace = v8::StackTrace::CurrentStackTrace(1, (v8::StackTrace::StackTraceOptions)(v8::StackTrace::kLineNumber | v8::StackTrace::kScriptName)); - v8::Local<v8::StackFrame> frame = trace->GetFrame(0); + v8::Handle<v8::StackFrame> frame = trace->GetFrame(0); int lineNumber = frame->GetLineNumber(); int columnNumber = frame->GetColumn(); QString url = frame->GetScriptName()->v4Value().toQString(); @@ -745,7 +745,7 @@ bool QV8QObjectWrapper::SetProperty(QV8Engine *engine, QObject *object, const QH return true; } -v8::Handle<v8::Value> QV8QObjectWrapper::Getter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8QObjectWrapper::Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { QV8QObjectResource *resource = v8_resource_check<QV8QObjectResource>(info.This()); @@ -788,8 +788,8 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Getter(v8::Local<v8::String> property, return v8::Handle<v8::Value>(); } -v8::Handle<v8::Value> QV8QObjectWrapper::Setter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, +v8::Handle<v8::Value> QV8QObjectWrapper::Setter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8QObjectResource *resource = v8_resource_check<QV8QObjectResource>(info.This()); @@ -815,7 +815,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Setter(v8::Local<v8::String> property, return value; } -v8::Handle<v8::Integer> QV8QObjectWrapper::Query(v8::Local<v8::String> property, +v8::Handle<v8::Integer> QV8QObjectWrapper::Query(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { QV8QObjectResource *resource = v8_resource_check<QV8QObjectResource>(info.This()); @@ -877,7 +877,7 @@ v8::Handle<v8::Array> QV8QObjectWrapper::Enumerator(const v8::AccessorInfo &info result = cache->propertyNames(); } - v8::Local<v8::Array> rv = v8::Array::New(result.count()); + v8::Handle<v8::Array> rv = v8::Array::New(result.count()); for (int ii = 0; ii < result.count(); ++ii) rv->Set(ii, resource->engine->toString(result.at(ii))); @@ -885,7 +885,7 @@ v8::Handle<v8::Array> QV8QObjectWrapper::Enumerator(const v8::AccessorInfo &info return rv; } -static void FastValueSetter(v8::Local<v8::String>, v8::Local<v8::Value> value, +static void FastValueSetter(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo& info) { QV8QObjectResource *resource = v8_resource_check<QV8QObjectResource>(info.This()); @@ -912,7 +912,7 @@ static void FastValueSetter(v8::Local<v8::String>, v8::Local<v8::Value> value, StoreProperty(resource->engine, object, pdata, value); } -static void FastValueSetterReadOnly(v8::Local<v8::String> property, v8::Local<v8::Value>, +static void FastValueSetterReadOnly(v8::Handle<v8::String> property, v8::Handle<v8::Value>, const v8::AccessorInfo& info) { QV8QObjectResource *resource = v8_resource_check<QV8QObjectResource>(info.This()); @@ -952,7 +952,7 @@ static void WeakQObjectInstanceCallback(v8::Persistent<v8::Value> handle, void * qPersistentDispose(handle); } -v8::Local<v8::Object> QQmlPropertyCache::newQObject(QObject *object, QV8Engine *engine) +v8::Handle<v8::Object> QQmlPropertyCache::newQObject(QObject *object, QV8Engine *engine) { Q_ASSERT(object); Q_ASSERT(this->engine); @@ -962,7 +962,7 @@ v8::Local<v8::Object> QQmlPropertyCache::newQObject(QObject *object, QV8Engine * // Setup constructor if (constructor->isDeleted()) { - v8::Local<v8::FunctionTemplate> ft; + v8::Handle<v8::FunctionTemplate> ft; const QHashedString toString(QStringLiteral("toString")); const QHashedString destroy(QStringLiteral("destroy")); @@ -1050,15 +1050,15 @@ v8::Local<v8::Object> QQmlPropertyCache::newQObject(QObject *object, QV8Engine * QQmlCleanup::addToEngine(this->engine); } - v8::Local<v8::Object> result = v8::Local<v8::Object>::New(constructor->asFunctionObject()->newInstance()); + v8::Handle<v8::Object> result = constructor->asFunctionObject()->newInstance(); QV8QObjectResource *r = new QV8QObjectResource(engine, object); result->SetExternalResource(r); return result; } -v8::Local<v8::Object> QV8QObjectWrapper::newQObject(QObject *object, QQmlData *ddata, QV8Engine *engine) +v8::Handle<v8::Object> QV8QObjectWrapper::newQObject(QObject *object, QQmlData *ddata, QV8Engine *engine) { - v8::Local<v8::Object> rv; + v8::Handle<v8::Object> rv; if (!ddata->propertyCache && engine->engine()) { ddata->propertyCache = QQmlEnginePrivate::get(engine->engine())->cache(object); @@ -1103,13 +1103,13 @@ v8::Handle<v8::Value> QV8QObjectWrapper::newQObject(QObject *object) if (ddata->v8objectid == m_id && !ddata->v8object.IsEmpty()) { // We own the v8object - return v8::Local<v8::Object>::New(ddata->v8object); + return ddata->v8object; } else if (ddata->v8object.IsEmpty() && (ddata->v8objectid == m_id || // We own the QObject ddata->v8objectid == 0 || // No one owns the QObject !ddata->hasTaintedV8Object)) { // Someone else has used the QObject, but it isn't tainted - v8::Local<v8::Object> rv = newQObject(object, ddata, m_engine); + v8::Handle<v8::Object> rv = newQObject(object, ddata, m_engine); ddata->v8object = qPersistentNew<v8::Object>(rv); ddata->v8object.MakeWeak(this, WeakQObjectReferenceCallback); ddata->v8objectid = m_id; @@ -1127,7 +1127,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::newQObject(QObject *object) // If our tainted handle doesn't exist or has been collected, and there isn't // a handle in the ddata, we can assume ownership of the ddata->v8object if ((!found || (*iter)->v8object.IsEmpty()) && ddata->v8object.IsEmpty()) { - v8::Local<v8::Object> rv = newQObject(object, ddata, m_engine); + v8::Handle<v8::Object> rv = newQObject(object, ddata, m_engine); ddata->v8object = qPersistentNew<v8::Object>(rv); ddata->v8object.MakeWeak(this, WeakQObjectReferenceCallback); ddata->v8objectid = m_id; @@ -1147,12 +1147,12 @@ v8::Handle<v8::Value> QV8QObjectWrapper::newQObject(QObject *object) } if ((*iter)->v8object.IsEmpty()) { - v8::Local<v8::Object> rv = newQObject(object, ddata, m_engine); + v8::Handle<v8::Object> rv = newQObject(object, ddata, m_engine); (*iter)->v8object = qPersistentNew<v8::Object>(rv); (*iter)->v8object.MakeWeak((*iter), WeakQObjectInstanceCallback); } - return v8::Local<v8::Object>::New((*iter)->v8object); + return (*iter)->v8object; } } @@ -1206,10 +1206,10 @@ QPair<QObject *, int> QV8QObjectWrapper::ExtractQtMethod(QV8Engine *engine, v8:: // This is one of our special QObject method wrappers v8::Handle<v8::Value> args[] = { engine->qobjectWrapper()->m_hiddenObject }; - v8::Local<v8::Value> data = function->Call(v8::Value::fromV4Value(engine->global()), 1, args); + v8::Handle<v8::Value> data = function->Call(v8::Value::fromV4Value(engine->global()), 1, args); if (data->IsArray()) { - v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(data); + v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(data); return qMakePair(engine->toQObject(array->Get(0)->v4Value()), array->Get(1)->Int32Value()); } @@ -1338,7 +1338,7 @@ int QV8QObjectConnectionList::qt_metacall(QMetaObject::Call method, int index, v if (try_catch.HasCaught()) { QQmlError error; error.setDescription(QString(QLatin1String("Unknown exception occurred during evaluation of connected function: %1")).arg(connection.function->GetName()->v4Value().toQString())); - v8::Local<v8::Message> message = try_catch.Message(); + v8::Handle<v8::Message> message = try_catch.Message(); if (!message.IsEmpty()) QQmlExpressionPrivate::exceptionToError(message, error); QQmlEnginePrivate::get(engine->engine())->warning(error); @@ -1386,8 +1386,8 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Connect(const v8::Arguments &args) if (signalObject->metaObject()->method(signalIndex).methodType() != QMetaMethod::Signal) V8THROW_ERROR("Function.prototype.connect: this object is not a signal"); - v8::Local<v8::Value> functionValue; - v8::Local<v8::Value> functionThisValue; + v8::Handle<v8::Value> functionValue; + v8::Handle<v8::Value> functionThisValue; if (args.Length() == 1) { functionValue = args[0]; @@ -1445,8 +1445,8 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Disconnect(const v8::Arguments &args) if (signalIndex < 0 || signalObject->metaObject()->method(signalIndex).methodType() != QMetaMethod::Signal) V8THROW_ERROR("Function.prototype.disconnect: this object is not a signal"); - v8::Local<v8::Value> functionValue; - v8::Local<v8::Value> functionThisValue; + v8::Handle<v8::Value> functionValue; + v8::Handle<v8::Value> functionThisValue; if (args.Length() == 1) { functionValue = args[0]; @@ -1474,7 +1474,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Disconnect(const v8::Arguments &args) QV8QObjectConnectionList::ConnectionList &connections = *slotIter; - v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(functionValue); + v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(functionValue); QPair<QObject *, int> functionData = ExtractQtMethod(engine, function); if (functionData.second != -1) { @@ -1547,7 +1547,7 @@ struct CallArgs { CallArgs(int length, v8::Handle<v8::Object> *args) : _length(length), _args(args) {} int Length() const { return _length; } - v8::Local<v8::Value> operator[](int idx) { return (*_args)->Get(idx); } + v8::Handle<v8::Value> operator[](int idx) { return (*_args)->Get(idx); } private: int _length; @@ -1989,7 +1989,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::Invoke(const v8::Arguments &args) // Special hack to return info about this closure. if (argCount == 1 && arguments->Get(0)->StrictEquals(resource->engine->qobjectWrapper()->m_hiddenObject)) { - v8::Local<v8::Array> data = v8::Array::New(2); + v8::Handle<v8::Array> data = v8::Array::New(2); data->Set(0, args[0]); data->Set(1, args[1]); return data; @@ -2254,7 +2254,7 @@ v8::Handle<v8::Value> CallArgument::toValue(QV8Engine *engine) // XXX Can this be made more by using Array as a prototype and implementing // directly against QList<QObject*>? QList<QObject *> &list = *qlistPtr; - v8::Local<v8::Array> array = v8::Array::New(list.count()); + v8::Handle<v8::Array> array = v8::Array::New(list.count()); for (int ii = 0; ii < list.count(); ++ii) array->Set(ii, engine->newQObject(list.at(ii))); return array; diff --git a/src/qml/qml/v8/qv8qobjectwrapper_p.h b/src/qml/qml/v8/qv8qobjectwrapper_p.h index d89a3c518f..b0358cc1a7 100644 --- a/src/qml/qml/v8/qv8qobjectwrapper_p.h +++ b/src/qml/qml/v8/qv8qobjectwrapper_p.h @@ -118,18 +118,18 @@ private: friend class QV8QObjectConnectionList; friend class QV8QObjectInstance; - v8::Local<v8::Object> newQObject(QObject *, QQmlData *, QV8Engine *); + v8::Handle<v8::Object> newQObject(QObject *, QQmlData *, QV8Engine *); bool deleteWeakQObject(QV8QObjectResource *resource, bool calledFromEngineDtor = false); static v8::Handle<v8::Value> GetProperty(QV8Engine *, QObject *, v8::Handle<v8::Value> *, const QHashedV8String &, QQmlContextData *, QV8QObjectWrapper::RevisionMode); static bool SetProperty(QV8Engine *, QObject *, const QHashedV8String &, QQmlContextData *, v8::Handle<v8::Value>, QV8QObjectWrapper::RevisionMode); - static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> Setter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, + static v8::Handle<v8::Value> Setter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info); - static v8::Handle<v8::Integer> Query(v8::Local<v8::String> property, + static v8::Handle<v8::Integer> Query(v8::Handle<v8::String> property, const v8::AccessorInfo &info); static v8::Handle<v8::Array> Enumerator(const v8::AccessorInfo &info); static v8::Handle<v8::Value> Connect(const v8::Arguments &args); diff --git a/src/qml/qml/v8/qv8sequencewrapper.cpp b/src/qml/qml/v8/qv8sequencewrapper.cpp index a30af7d75a..3f72697d9a 100644 --- a/src/qml/qml/v8/qv8sequencewrapper.cpp +++ b/src/qml/qml/v8/qv8sequencewrapper.cpp @@ -76,10 +76,10 @@ void QV8SequenceWrapper::init(QV8Engine *engine) m_sort = qPersistentNew<v8::Function>(v8::FunctionTemplate::New(Sort)->GetFunction()); m_arrayPrototype = qPersistentNew<v8::Value>(v8::Array::New(1)->GetPrototype()); - v8::Local<v8::Script> defaultSortCompareScript = v8::Script::Compile(engine->toString(defaultSortString)); + v8::Handle<v8::Script> defaultSortCompareScript = v8::Script::Compile(engine->toString(defaultSortString)); m_defaultSortComparer = qPersistentNew<v8::Function>(v8::Handle<v8::Function>(v8::Function::Cast(defaultSortCompareScript->Run().get()))); - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetFallbackPropertyHandler(Getter, Setter); ft->InstanceTemplate()->SetIndexedPropertyHandler(IndexedGetter, IndexedSetter, 0, IndexedDeleter, IndexedEnumerator); ft->InstanceTemplate()->SetAccessor(v8::String::New("length"), LengthGetter, LengthSetter, @@ -142,7 +142,7 @@ quint32 QV8SequenceWrapper::sequenceLength(QV8ObjectResource *r) r = new QV8##ElementTypeName##SequenceResource(m_engine, object, propertyIndex); \ } else -v8::Local<v8::Object> QV8SequenceWrapper::newSequence(int sequenceType, QObject *object, int propertyIndex, bool *succeeded) +v8::Handle<v8::Object> QV8SequenceWrapper::newSequence(int sequenceType, QObject *object, int propertyIndex, bool *succeeded) { // This function is called when the property is a QObject Q_PROPERTY of // the given sequence type. Internally we store a typed-sequence @@ -150,9 +150,9 @@ v8::Local<v8::Object> QV8SequenceWrapper::newSequence(int sequenceType, QObject // and so access/mutate avoids variant conversion. *succeeded = true; QV8SequenceResource *r = 0; - FOREACH_QML_SEQUENCE_TYPE(NEW_REFERENCE_SEQUENCE) { /* else */ *succeeded = false; return v8::Local<v8::Object>(); } + FOREACH_QML_SEQUENCE_TYPE(NEW_REFERENCE_SEQUENCE) { /* else */ *succeeded = false; return v8::Handle<v8::Object>(); } - v8::Local<v8::Object> rv = m_constructor->NewInstance(); + v8::Handle<v8::Object> rv = m_constructor->NewInstance(); rv->SetExternalResource(r); rv->SetPrototype(m_arrayPrototype); return rv; @@ -164,7 +164,7 @@ v8::Local<v8::Object> QV8SequenceWrapper::newSequence(int sequenceType, QObject r = new QV8##ElementTypeName##SequenceResource(m_engine, v.value<SequenceType>()); \ } else -v8::Local<v8::Object> QV8SequenceWrapper::fromVariant(const QVariant& v, bool *succeeded) +v8::Handle<v8::Object> QV8SequenceWrapper::fromVariant(const QVariant& v, bool *succeeded) { // This function is called when assigning a sequence value to a normal JS var // in a JS block. Internally, we store a sequence of the specified type. @@ -173,9 +173,9 @@ v8::Local<v8::Object> QV8SequenceWrapper::fromVariant(const QVariant& v, bool *s int sequenceType = v.userType(); *succeeded = true; QV8SequenceResource *r = 0; - FOREACH_QML_SEQUENCE_TYPE(NEW_COPY_SEQUENCE) { /* else */ *succeeded = false; return v8::Local<v8::Object>(); } + FOREACH_QML_SEQUENCE_TYPE(NEW_COPY_SEQUENCE) { /* else */ *succeeded = false; return v8::Handle<v8::Object>(); } - v8::Local<v8::Object> rv = m_constructor->NewInstance(); + v8::Handle<v8::Object> rv = m_constructor->NewInstance(); rv->SetExternalResource(r); rv->SetPrototype(m_arrayPrototype); return rv; @@ -202,7 +202,7 @@ QVariant QV8SequenceWrapper::toVariant(v8::Handle<v8::Array> array, int typeHint } #undef SEQUENCE_TO_VARIANT -v8::Handle<v8::Value> QV8SequenceWrapper::IndexedSetter(quint32 index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +v8::Handle<v8::Value> QV8SequenceWrapper::IndexedSetter(quint32 index, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8SequenceResource *sr = v8_resource_cast<QV8SequenceResource>(info.This()); Q_ASSERT(sr); @@ -230,7 +230,7 @@ v8::Handle<v8::Array> QV8SequenceWrapper::IndexedEnumerator(const v8::AccessorIn return sr->indexedEnumerator(); } -v8::Handle<v8::Value> QV8SequenceWrapper::LengthGetter(v8::Local<v8::String> property, const v8::AccessorInfo &info) +v8::Handle<v8::Value> QV8SequenceWrapper::LengthGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { Q_UNUSED(property); QV8SequenceResource *sr = v8_resource_cast<QV8SequenceResource>(info.This()); @@ -238,7 +238,7 @@ v8::Handle<v8::Value> QV8SequenceWrapper::LengthGetter(v8::Local<v8::String> pro return v8::Integer::NewFromUnsigned(sr->lengthGetter()); } -void QV8SequenceWrapper::LengthSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +void QV8SequenceWrapper::LengthSetter(v8::Handle<v8::String> property, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { Q_UNUSED(property); QV8SequenceResource *sr = v8_resource_cast<QV8SequenceResource>(info.This()); @@ -246,20 +246,20 @@ void QV8SequenceWrapper::LengthSetter(v8::Local<v8::String> property, v8::Local< sr->lengthSetter(value); } -v8::Handle<v8::Value> QV8SequenceWrapper::ToStringGetter(v8::Local<v8::String> property, const v8::AccessorInfo &info) +v8::Handle<v8::Value> QV8SequenceWrapper::ToStringGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { Q_UNUSED(property); return info.Data(); } -v8::Handle<v8::Value> QV8SequenceWrapper::ValueOfGetter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8SequenceWrapper::ValueOfGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { Q_UNUSED(property); return info.Data(); } -v8::Handle<v8::Value> QV8SequenceWrapper::SortGetter(v8::Local<v8::String> property, const v8::AccessorInfo &info) +v8::Handle<v8::Value> QV8SequenceWrapper::SortGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { Q_UNUSED(property); return info.Data(); @@ -303,7 +303,7 @@ v8::Handle<v8::Value> QV8SequenceWrapper::ValueOf(const v8::Arguments &args) return v8::Integer::NewFromUnsigned(sr->lengthGetter()); } -v8::Handle<v8::Value> QV8SequenceWrapper::Getter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8SequenceWrapper::Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { Q_UNUSED(property); @@ -311,8 +311,8 @@ v8::Handle<v8::Value> QV8SequenceWrapper::Getter(v8::Local<v8::String> property, return v8::Handle<v8::Value>(); } -v8::Handle<v8::Value> QV8SequenceWrapper::Setter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, +v8::Handle<v8::Value> QV8SequenceWrapper::Setter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { Q_UNUSED(property); diff --git a/src/qml/qml/v8/qv8sequencewrapper_p.h b/src/qml/qml/v8/qv8sequencewrapper_p.h index c403abc6b6..e63d7af8c4 100644 --- a/src/qml/qml/v8/qv8sequencewrapper_p.h +++ b/src/qml/qml/v8/qv8sequencewrapper_p.h @@ -77,8 +77,8 @@ public: bool isEqual(QV8ObjectResource *lhs, QV8ObjectResource *rhs); quint32 sequenceLength(QV8ObjectResource *); - v8::Local<v8::Object> newSequence(int sequenceTypeId, QObject *object, int propertyIndex, bool *succeeded); - v8::Local<v8::Object> fromVariant(const QVariant& v, bool *succeeded); + v8::Handle<v8::Object> newSequence(int sequenceTypeId, QObject *object, int propertyIndex, bool *succeeded); + v8::Handle<v8::Object> fromVariant(const QVariant& v, bool *succeeded); QVariant toVariant(QV8ObjectResource *); QVariant toVariant(v8::Handle<v8::Array> array, int typeHint, bool *succeeded); @@ -93,18 +93,18 @@ private: v8::Persistent<v8::Function> m_defaultSortComparer; static v8::Handle<v8::Value> IndexedGetter(quint32 index, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> IndexedSetter(quint32 index, v8::Local<v8::Value> value, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> IndexedSetter(quint32 index, v8::Handle<v8::Value> value, const v8::AccessorInfo &info); static v8::Handle<v8::Boolean> IndexedDeleter(quint32 index, const v8::AccessorInfo &info); static v8::Handle<v8::Array> IndexedEnumerator(const v8::AccessorInfo &info); - static v8::Handle<v8::Value> LengthGetter(v8::Local<v8::String> property, const v8::AccessorInfo &info); - static void LengthSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> ToStringGetter(v8::Local<v8::String> property, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> LengthGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); + static void LengthSetter(v8::Handle<v8::String> property, v8::Handle<v8::Value> value, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> ToStringGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); static v8::Handle<v8::Value> ToString(const v8::Arguments &args); - static v8::Handle<v8::Value> ValueOfGetter(v8::Local<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> SortGetter(v8::Local<v8::String> property, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> ValueOfGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> SortGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); static v8::Handle<v8::Value> ValueOf(const v8::Arguments &args); - static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> Setter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> Setter(v8::Handle<v8::String> property, v8::Handle<v8::Value> value, const v8::AccessorInfo &info); static v8::Handle<v8::Value> Sort(const v8::Arguments &args); }; diff --git a/src/qml/qml/v8/qv8sequencewrapper_p_p.h b/src/qml/qml/v8/qv8sequencewrapper_p_p.h index 80f68c4674..da56fa457e 100644 --- a/src/qml/qml/v8/qv8sequencewrapper_p_p.h +++ b/src/qml/qml/v8/qv8sequencewrapper_p_p.h @@ -107,10 +107,10 @@ static void generateWarning(QV8Engine *engine, const QString& description) { if (!engine) return; - v8::Local<v8::StackTrace> currStack = v8::StackTrace::CurrentStackTrace(1); + v8::Handle<v8::StackTrace> currStack = v8::StackTrace::CurrentStackTrace(1); if (currStack.IsEmpty()) return; - v8::Local<v8::StackFrame> currFrame = currStack->GetFrame(0); + v8::Handle<v8::StackFrame> currFrame = currStack->GetFrame(0); if (currFrame.IsEmpty()) return; @@ -437,7 +437,7 @@ static QString convertUrlToString(QV8Engine *, const QUrl &v) loadReference(); \ } \ qint32 count = c.count(); \ - v8::Local<v8::Array> retn = v8::Array::New(count); \ + v8::Handle<v8::Array> retn = v8::Array::New(count); \ for (qint32 i = 0; i < count; ++i) { \ retn->Set(static_cast<quint32>(i), v8::Integer::NewFromUnsigned(static_cast<quint32>(i))); \ } \ diff --git a/src/qml/qml/v8/qv8typewrapper.cpp b/src/qml/qml/v8/qv8typewrapper.cpp index 00167b5363..34f553298d 100644 --- a/src/qml/qml/v8/qv8typewrapper.cpp +++ b/src/qml/qml/v8/qv8typewrapper.cpp @@ -93,18 +93,18 @@ void QV8TypeWrapper::destroy() void QV8TypeWrapper::init(QV8Engine *engine) { m_engine = engine; - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetNamedPropertyHandler(Getter, Setter); ft->InstanceTemplate()->SetHasExternalResource(true); m_constructor = qPersistentNew<v8::Function>(ft->GetFunction()); } // Returns a type wrapper for type t on o. This allows access of enums, and attached properties. -v8::Local<v8::Object> QV8TypeWrapper::newObject(QObject *o, QQmlType *t, TypeNameMode mode) +v8::Handle<v8::Object> QV8TypeWrapper::newObject(QObject *o, QQmlType *t, TypeNameMode mode) { Q_ASSERT(t); // XXX NewInstance() should be optimized - v8::Local<v8::Object> rv = m_constructor->NewInstance(); + v8::Handle<v8::Object> rv = m_constructor->NewInstance(); QV8TypeResource *r = new QV8TypeResource(m_engine); r->mode = mode; r->object = o; r->type = t; rv->SetExternalResource(r); @@ -113,13 +113,13 @@ v8::Local<v8::Object> QV8TypeWrapper::newObject(QObject *o, QQmlType *t, TypeNam // Returns a type wrapper for importNamespace (of t) on o. This allows nested resolution of a type in a // namespace. -v8::Local<v8::Object> QV8TypeWrapper::newObject(QObject *o, QQmlTypeNameCache *t, +v8::Handle<v8::Object> QV8TypeWrapper::newObject(QObject *o, QQmlTypeNameCache *t, const void *importNamespace, TypeNameMode mode) { Q_ASSERT(t); Q_ASSERT(importNamespace); // XXX NewInstance() should be optimized - v8::Local<v8::Object> rv = m_constructor->NewInstance(); + v8::Handle<v8::Object> rv = m_constructor->NewInstance(); QV8TypeResource *r = new QV8TypeResource(m_engine); t->addref(); r->mode = mode; r->object = o; r->typeNamespace = t; r->importNamespace = importNamespace; @@ -147,7 +147,7 @@ QVariant QV8TypeWrapper::toVariant(QV8ObjectResource *r) return QVariant(); } -v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { QV8TypeResource *resource = v8_resource_cast<QV8TypeResource>(info.This()); @@ -259,8 +259,8 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property, return v8::Handle<v8::Value>(); } -v8::Handle<v8::Value> QV8TypeWrapper::Setter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, +v8::Handle<v8::Value> QV8TypeWrapper::Setter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8TypeResource *resource = v8_resource_cast<QV8TypeResource>(info.This()); diff --git a/src/qml/qml/v8/qv8typewrapper_p.h b/src/qml/qml/v8/qv8typewrapper_p.h index 852f49770b..0db9a1b675 100644 --- a/src/qml/qml/v8/qv8typewrapper_p.h +++ b/src/qml/qml/v8/qv8typewrapper_p.h @@ -72,16 +72,16 @@ public: void destroy(); enum TypeNameMode { IncludeEnums, ExcludeEnums }; - v8::Local<v8::Object> newObject(QObject *, QQmlType *, TypeNameMode = IncludeEnums); - v8::Local<v8::Object> newObject(QObject *, QQmlTypeNameCache *, const void *, + v8::Handle<v8::Object> newObject(QObject *, QQmlType *, TypeNameMode = IncludeEnums); + v8::Handle<v8::Object> newObject(QObject *, QQmlTypeNameCache *, const void *, TypeNameMode = IncludeEnums); QVariant toVariant(QV8ObjectResource *); private: - static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> Setter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, + static v8::Handle<v8::Value> Setter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info); QV8Engine *m_engine; diff --git a/src/qml/qml/v8/qv8valuetypewrapper.cpp b/src/qml/qml/v8/qv8valuetypewrapper.cpp index 13476b8db0..f7fa0b7adf 100644 --- a/src/qml/qml/v8/qv8valuetypewrapper.cpp +++ b/src/qml/qml/v8/qv8valuetypewrapper.cpp @@ -115,7 +115,7 @@ void QV8ValueTypeWrapper::init(QV8Engine *engine) { m_engine = engine; m_toString = qPersistentNew<v8::Function>(v8::FunctionTemplate::New(ToString)->GetFunction()); - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetNamedPropertyHandler(Getter, Setter); ft->InstanceTemplate()->SetHasExternalResource(true); ft->InstanceTemplate()->MarkAsUseUserObjectComparison(); @@ -129,20 +129,20 @@ void QV8ValueTypeWrapper::init(QV8Engine *engine) toStringHash = m_toStringString.hash(); } -v8::Local<v8::Object> QV8ValueTypeWrapper::newValueType(QObject *object, int property, QQmlValueType *type) +v8::Handle<v8::Object> QV8ValueTypeWrapper::newValueType(QObject *object, int property, QQmlValueType *type) { // XXX NewInstance() should be optimized - v8::Local<v8::Object> rv = m_constructor->NewInstance(); + v8::Handle<v8::Object> rv = m_constructor->NewInstance(); QV8ValueTypeReferenceResource *r = new QV8ValueTypeReferenceResource(m_engine); r->type = type; r->object = object; r->property = property; rv->SetExternalResource(r); return rv; } -v8::Local<v8::Object> QV8ValueTypeWrapper::newValueType(const QVariant &value, QQmlValueType *type) +v8::Handle<v8::Object> QV8ValueTypeWrapper::newValueType(const QVariant &value, QQmlValueType *type) { // XXX NewInstance() should be optimized - v8::Local<v8::Object> rv = m_constructor->NewInstance(); + v8::Handle<v8::Object> rv = m_constructor->NewInstance(); QV8ValueTypeCopyResource *r = new QV8ValueTypeCopyResource(m_engine); r->type = type; r->value = value; rv->SetExternalResource(r); @@ -247,7 +247,7 @@ bool QV8ValueTypeWrapper::isEqual(QV8ObjectResource *r, const QVariant& value) } } -v8::Handle<v8::Value> QV8ValueTypeWrapper::ToStringGetter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8ValueTypeWrapper::ToStringGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { Q_UNUSED(property); @@ -276,7 +276,7 @@ v8::Handle<v8::Value> QV8ValueTypeWrapper::ToString(const v8::Arguments &args) } } -v8::Handle<v8::Value> QV8ValueTypeWrapper::Getter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8ValueTypeWrapper::Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { QV8ValueTypeResource *r = v8_resource_cast<QV8ValueTypeResource>(info.This()); @@ -349,8 +349,8 @@ v8::Handle<v8::Value> QV8ValueTypeWrapper::Getter(v8::Local<v8::String> property #undef VALUE_TYPE_ACCESSOR } -v8::Handle<v8::Value> QV8ValueTypeWrapper::Setter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, +v8::Handle<v8::Value> QV8ValueTypeWrapper::Setter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8ValueTypeResource *r = v8_resource_cast<QV8ValueTypeResource>(info.This()); @@ -392,11 +392,11 @@ v8::Handle<v8::Value> QV8ValueTypeWrapper::Setter(v8::Local<v8::String> property cacheData.valueTypeCoreIndex = index; cacheData.valueTypePropType = p.userType(); - v8::Local<v8::StackTrace> trace = + v8::Handle<v8::StackTrace> trace = v8::StackTrace::CurrentStackTrace(1, (v8::StackTrace::StackTraceOptions)(v8::StackTrace::kLineNumber | v8::StackTrace::kScriptName)); - v8::Local<v8::StackFrame> frame = trace->GetFrame(0); + v8::Handle<v8::StackFrame> frame = trace->GetFrame(0); int lineNumber = frame->GetLineNumber(); int columnNumber = frame->GetColumn(); QString url = frame->GetScriptName()->v4Value().toQString(); diff --git a/src/qml/qml/v8/qv8valuetypewrapper_p.h b/src/qml/qml/v8/qv8valuetypewrapper_p.h index d22874639a..620f0bbc78 100644 --- a/src/qml/qml/v8/qv8valuetypewrapper_p.h +++ b/src/qml/qml/v8/qv8valuetypewrapper_p.h @@ -73,8 +73,8 @@ public: void init(QV8Engine *); void destroy(); - v8::Local<v8::Object> newValueType(QObject *, int, QQmlValueType *); - v8::Local<v8::Object> newValueType(const QVariant &, QQmlValueType *); + v8::Handle<v8::Object> newValueType(QObject *, int, QQmlValueType *); + v8::Handle<v8::Object> newValueType(const QVariant &, QQmlValueType *); bool isValueType(v8::Handle<v8::Object>) const; @@ -85,13 +85,13 @@ public: static bool isEqual(QV8ObjectResource *, const QVariant& value); private: - static v8::Handle<v8::Value> ToStringGetter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> ToStringGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); static v8::Handle<v8::Value> ToString(const v8::Arguments &args); - static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> Setter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, + static v8::Handle<v8::Value> Setter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info); QV8Engine *m_engine; diff --git a/src/qml/qml/v8/qv8variantwrapper.cpp b/src/qml/qml/v8/qv8variantwrapper.cpp index bea016a905..ebe24c51ae 100644 --- a/src/qml/qml/v8/qv8variantwrapper.cpp +++ b/src/qml/qml/v8/qv8variantwrapper.cpp @@ -87,7 +87,7 @@ void QV8VariantWrapper::init(QV8Engine *engine) m_valueOf = qPersistentNew<v8::Function>(v8::FunctionTemplate::New(ValueOf)->GetFunction()); { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetFallbackPropertyHandler(Getter, Setter); ft->InstanceTemplate()->SetHasExternalResource(true); ft->InstanceTemplate()->MarkAsUseUserObjectComparison(); @@ -102,7 +102,7 @@ void QV8VariantWrapper::init(QV8Engine *engine) { m_preserve = qPersistentNew<v8::Function>(v8::FunctionTemplate::New(Preserve)->GetFunction()); m_destroy = qPersistentNew<v8::Function>(v8::FunctionTemplate::New(Destroy)->GetFunction()); - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetFallbackPropertyHandler(Getter, Setter); ft->InstanceTemplate()->SetHasExternalResource(true); ft->InstanceTemplate()->MarkAsUseUserObjectComparison(); @@ -133,13 +133,13 @@ void QV8VariantWrapper::destroy() qPersistentDispose(m_constructor); } -v8::Local<v8::Object> QV8VariantWrapper::newVariant(const QVariant &value) +v8::Handle<v8::Object> QV8VariantWrapper::newVariant(const QVariant &value) { bool scarceResource = value.type() == QVariant::Pixmap || value.type() == QVariant::Image; // XXX NewInstance() should be optimized - v8::Local<v8::Object> rv; + v8::Handle<v8::Object> rv; QV8VariantResource *r = new QV8VariantResource(m_engine, value); if (scarceResource) { @@ -180,41 +180,41 @@ QVariant &QV8VariantWrapper::variantValue(v8::Handle<v8::Value> value) return static_cast<QV8VariantResource *>(r)->data; } -v8::Handle<v8::Value> QV8VariantWrapper::Getter(v8::Local<v8::String> /* property */, +v8::Handle<v8::Value> QV8VariantWrapper::Getter(v8::Handle<v8::String> /* property */, const v8::AccessorInfo & /* info */) { return v8::Handle<v8::Value>(); } -v8::Handle<v8::Value> QV8VariantWrapper::Setter(v8::Local<v8::String> /* property */, - v8::Local<v8::Value> value, +v8::Handle<v8::Value> QV8VariantWrapper::Setter(v8::Handle<v8::String> /* property */, + v8::Handle<v8::Value> value, const v8::AccessorInfo & /* info */) { return value; } -v8::Handle<v8::Value> QV8VariantWrapper::PreserveGetter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8VariantWrapper::PreserveGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { Q_UNUSED(property); return info.Data(); } -v8::Handle<v8::Value> QV8VariantWrapper::DestroyGetter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8VariantWrapper::DestroyGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { Q_UNUSED(property); return info.Data(); } -v8::Handle<v8::Value> QV8VariantWrapper::ToStringGetter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8VariantWrapper::ToStringGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { Q_UNUSED(property); return info.Data(); } -v8::Handle<v8::Value> QV8VariantWrapper::ValueOfGetter(v8::Local<v8::String> property, +v8::Handle<v8::Value> QV8VariantWrapper::ValueOfGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info) { Q_UNUSED(property); diff --git a/src/qml/qml/v8/qv8variantwrapper_p.h b/src/qml/qml/v8/qv8variantwrapper_p.h index 9f634b938d..125875ab24 100644 --- a/src/qml/qml/v8/qv8variantwrapper_p.h +++ b/src/qml/qml/v8/qv8variantwrapper_p.h @@ -70,25 +70,25 @@ public: void init(QV8Engine *); void destroy(); - v8::Local<v8::Object> newVariant(const QVariant &); + v8::Handle<v8::Object> newVariant(const QVariant &); bool isVariant(v8::Handle<v8::Value>); static QVariant toVariant(v8::Handle<v8::Object>); static QVariant toVariant(QV8ObjectResource *); QVariant &variantValue(v8::Handle<v8::Value>); private: - static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> Getter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> Setter(v8::Local<v8::String> property, - v8::Local<v8::Value> value, + static v8::Handle<v8::Value> Setter(v8::Handle<v8::String> property, + v8::Handle<v8::Value> value, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> PreserveGetter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> PreserveGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> DestroyGetter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> DestroyGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> ToStringGetter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> ToStringGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> ValueOfGetter(v8::Local<v8::String> property, + static v8::Handle<v8::Value> ValueOfGetter(v8::Handle<v8::String> property, const v8::AccessorInfo &info); static v8::Handle<v8::Value> Preserve(const v8::Arguments &args); static v8::Handle<v8::Value> Destroy(const v8::Arguments &args); diff --git a/src/qml/qml/v8/qv8worker.cpp b/src/qml/qml/v8/qv8worker.cpp index 0369f47303..c536e6cc27 100644 --- a/src/qml/qml/v8/qv8worker.cpp +++ b/src/qml/qml/v8/qv8worker.cpp @@ -202,7 +202,7 @@ void QV8Worker::serialize(QByteArray &data, v8::Handle<v8::Value> v, QV8Engine * } else if (v->IsRegExp()) { v8::Handle<v8::RegExp> regexp = v8::Handle<v8::RegExp>::Cast(v); quint32 flags = regexp->GetFlags(); - v8::Local<v8::String> source = regexp->GetSource(); + v8::Handle<v8::String> source = regexp->GetSource(); int length = source->Length() + 1; if (length > 0xFFFFFF) { @@ -221,7 +221,7 @@ void QV8Worker::serialize(QByteArray &data, v8::Handle<v8::Value> v, QV8Engine * source->Write((uint16_t*)buffer); } else if (v->IsObject() && !v->ToObject()->GetExternalResource()) { v8::Handle<v8::Object> object = v->ToObject(); - v8::Local<v8::Array> properties = v8::Local<v8::Array>::New(v8::Value::fromV4Value(engine->getOwnPropertyNames(object->v4Value()))); + v8::Handle<v8::Array> properties = engine->getOwnPropertyNames(object->v4Value()); quint32 length = properties->Length(); if (length > 0xFFFFFF) { push(data, valueheader(WorkerUndefined)); @@ -230,10 +230,10 @@ void QV8Worker::serialize(QByteArray &data, v8::Handle<v8::Value> v, QV8Engine * push(data, valueheader(WorkerObject, length)); v8::TryCatch tc; for (quint32 ii = 0; ii < length; ++ii) { - v8::Local<v8::String> str = properties->Get(ii)->ToString(); + v8::Handle<v8::String> str = properties->Get(ii)->ToString(); serialize(data, str, engine); - v8::Local<v8::Value> val = object->Get(str); + v8::Handle<v8::Value> val = object->Get(str); if (tc.HasCaught()) { serialize(data, v8::Undefined(), engine); tc.Reset(); @@ -303,7 +303,7 @@ v8::Handle<v8::Value> QV8Worker::deserialize(const char *&data, QV8Engine *engin case WorkerString: { quint32 size = headersize(header); - v8::Local<v8::String> string = v8::String::New((uint16_t*)data, size - 1); + v8::Handle<v8::String> string = v8::String::New((uint16_t*)data, size - 1); data += ALIGN(size * sizeof(uint16_t)); return string; } @@ -313,7 +313,7 @@ v8::Handle<v8::Value> QV8Worker::deserialize(const char *&data, QV8Engine *engin case WorkerArray: { quint32 size = headersize(header); - v8::Local<v8::Array> array = v8::Array::New(size); + v8::Handle<v8::Array> array = v8::Array::New(size); for (quint32 ii = 0; ii < size; ++ii) { array->Set(ii, deserialize(data, engine)); } @@ -322,7 +322,7 @@ v8::Handle<v8::Value> QV8Worker::deserialize(const char *&data, QV8Engine *engin case WorkerObject: { quint32 size = headersize(header); - v8::Local<v8::Object> o = v8::Object::New(); + v8::Handle<v8::Object> o = v8::Object::New(); for (quint32 ii = 0; ii < size; ++ii) { v8::Handle<v8::Value> name = deserialize(data, engine); v8::Handle<v8::Value> value = deserialize(data, engine); @@ -342,7 +342,7 @@ v8::Handle<v8::Value> QV8Worker::deserialize(const char *&data, QV8Engine *engin { quint32 flags = headersize(header); quint32 length = popUint32(data); - v8::Local<v8::String> source = v8::String::New((uint16_t*)data, length - 1); + v8::Handle<v8::String> source = v8::String::New((uint16_t*)data, length - 1); data += ALIGN(length * sizeof(uint16_t)); return v8::RegExp::New(source, (v8::RegExp::Flags)flags); } @@ -366,7 +366,7 @@ v8::Handle<v8::Value> QV8Worker::deserialize(const char *&data, QV8Engine *engin quint32 length = headersize(header); quint32 seqLength = length - 1; int sequenceType = deserialize(data, engine)->Int32Value(); - v8::Local<v8::Array> array = v8::Array::New(seqLength); + v8::Handle<v8::Array> array = v8::Array::New(seqLength); for (quint32 ii = 0; ii < seqLength; ++ii) array->Set(ii, deserialize(data, engine)); QVariant seqVariant = engine->sequenceWrapper()->toVariant(array, sequenceType, &succeeded); diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 113f99afc9..b0b7085d45 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -72,21 +72,21 @@ public: QQmlDelegateModelEngineData(QV8Engine *engine); ~QQmlDelegateModelEngineData(); - v8::Local<v8::Object> array( + v8::Handle<v8::Object> array( QV8Engine *engine, const QVector<QQmlChangeSet::Remove> &changes); - v8::Local<v8::Object> array( + v8::Handle<v8::Object> array( QV8Engine *engine, const QVector<QQmlChangeSet::Insert> &changes); - v8::Local<v8::Object> array( + v8::Handle<v8::Object> array( QV8Engine *engine, const QVector<QQmlChangeSet::Change> &changes); - inline v8::Local<v8::String> model() { return strings->Get(Model)->ToString(); } - inline v8::Local<v8::String> groups() { return strings->Get(Groups)->ToString(); } - inline v8::Local<v8::String> isUnresolved() { return strings->Get(IsUnresolved)->ToString(); } - inline v8::Local<v8::String> itemsIndex() { return strings->Get(ItemsIndex)->ToString(); } - inline v8::Local<v8::String> persistedItemsIndex() { return strings->Get(PersistedItemsIndex)->ToString(); } - inline v8::Local<v8::String> inItems() { return strings->Get(InItems)->ToString(); } - inline v8::Local<v8::String> inPersistedItems() { return strings->Get(InPersistedItems)->ToString(); } + inline v8::Handle<v8::String> model() { return strings->Get(Model)->ToString(); } + inline v8::Handle<v8::String> groups() { return strings->Get(Groups)->ToString(); } + inline v8::Handle<v8::String> isUnresolved() { return strings->Get(IsUnresolved)->ToString(); } + inline v8::Handle<v8::String> itemsIndex() { return strings->Get(ItemsIndex)->ToString(); } + inline v8::Handle<v8::String> persistedItemsIndex() { return strings->Get(PersistedItemsIndex)->ToString(); } + inline v8::Handle<v8::String> inItems() { return strings->Get(InItems)->ToString(); } + inline v8::Handle<v8::String> inPersistedItems() { return strings->Get(InPersistedItems)->ToString(); } v8::Persistent<v8::Array> strings; v8::Persistent<v8::Function> constructorChange; @@ -1358,16 +1358,16 @@ void QQmlDelegateModel::_q_itemsMoved(int from, int to, int count) d->emitChanges(); } -template <typename T> v8::Local<v8::Array> +template <typename T> v8::Handle<v8::Array> QQmlDelegateModelPrivate::buildChangeList(const QVector<T> &changes) { - v8::Local<v8::Array> indexes = v8::Array::New(changes.count()); - v8::Local<v8::String> indexKey = v8::String::New("index"); - v8::Local<v8::String> countKey = v8::String::New("count"); - v8::Local<v8::String> moveIdKey = v8::String::New("moveId"); + v8::Handle<v8::Array> indexes = v8::Array::New(changes.count()); + v8::Handle<v8::String> indexKey = v8::String::New("index"); + v8::Handle<v8::String> countKey = v8::String::New("count"); + v8::Handle<v8::String> moveIdKey = v8::String::New("moveId"); for (int i = 0; i < changes.count(); ++i) { - v8::Local<v8::Object> object = v8::Object::New(); + v8::Handle<v8::Object> object = v8::Object::New(); object->Set(indexKey, v8::Integer::New(changes.at(i).index)); object->Set(countKey, v8::Integer::New(changes.at(i).count)); object->Set(moveIdKey, changes.at(i).moveId != -1 ? v8::Integer::New(changes.at(i).count) : v8::Undefined()); @@ -1515,7 +1515,7 @@ QQmlDelegateModelAttached *QQmlDelegateModel::qmlAttachedProperties(QObject *obj } bool QQmlDelegateModelPrivate::insert( - Compositor::insert_iterator &before, const v8::Local<v8::Object> &object, int groups) + Compositor::insert_iterator &before, const v8::Handle<v8::Object> &object, int groups) { if (!m_context->isValid()) return false; @@ -1524,9 +1524,9 @@ bool QQmlDelegateModelPrivate::insert( if (!cacheItem) return false; - v8::Local<v8::Array> propertyNames = object->GetPropertyNames(); + v8::Handle<v8::Array> propertyNames = object->GetPropertyNames(); for (uint i = 0; i < propertyNames->Length(); ++i) { - v8::Local<v8::String> propertyName = propertyNames->Get(i)->ToString(); + v8::Handle<v8::String> propertyName = propertyNames->Get(i)->ToString(); cacheItem->setValue( propertyName->v4Value().toQString(), m_cacheMetaType->v8Engine->toVariant(object->Get(propertyName)->v4Value(), QVariant::Invalid)); @@ -1628,7 +1628,7 @@ int QQmlDelegateModelItemMetaType::parseGroups(const QStringList &groups) const return groupFlags; } -int QQmlDelegateModelItemMetaType::parseGroups(const v8::Local<v8::Value> &groups) const +int QQmlDelegateModelItemMetaType::parseGroups(const v8::Handle<v8::Value> &groups) const { int groupFlags = 0; if (groups->IsString()) { @@ -1637,7 +1637,7 @@ int QQmlDelegateModelItemMetaType::parseGroups(const v8::Local<v8::Value> &group if (index != -1) groupFlags |= 2 << index; } else if (groups->IsArray()) { - v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(groups); + v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(groups); for (uint i = 0; i < array->Length(); ++i) { const QString groupName = array->Get(i)->v4Value().toQString(); int index = groupNames.indexOf(groupName); @@ -1649,7 +1649,7 @@ int QQmlDelegateModelItemMetaType::parseGroups(const v8::Local<v8::Value> &group } v8::Handle<v8::Value> QQmlDelegateModelItemMetaType::get_model( - v8::Local<v8::String>, const v8::AccessorInfo &info) + v8::Handle<v8::String>, const v8::AccessorInfo &info) { QQmlDelegateModelItem *cacheItem = v8_resource_cast<QQmlDelegateModelItem>(info.This()); V8ASSERT_TYPE(cacheItem, "Not a valid VisualData object"); @@ -1660,7 +1660,7 @@ v8::Handle<v8::Value> QQmlDelegateModelItemMetaType::get_model( } v8::Handle<v8::Value> QQmlDelegateModelItemMetaType::get_groups( - v8::Local<v8::String>, const v8::AccessorInfo &info) + v8::Handle<v8::String>, const v8::AccessorInfo &info) { QQmlDelegateModelItem *cacheItem = v8_resource_cast<QQmlDelegateModelItem>(info.This()); V8ASSERT_TYPE(cacheItem, "Not a valid VisualData object"); @@ -1675,7 +1675,7 @@ v8::Handle<v8::Value> QQmlDelegateModelItemMetaType::get_groups( } void QQmlDelegateModelItemMetaType::set_groups( - v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) + v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QQmlDelegateModelItem *cacheItem = v8_resource_cast<QQmlDelegateModelItem>(info.This()); V8ASSERT_TYPE_SETTER(cacheItem, "Not a valid VisualData object"); @@ -1691,7 +1691,7 @@ void QQmlDelegateModelItemMetaType::set_groups( } v8::Handle<v8::Value> QQmlDelegateModelItemMetaType::get_member( - v8::Local<v8::String>, const v8::AccessorInfo &info) + v8::Handle<v8::String>, const v8::AccessorInfo &info) { QQmlDelegateModelItem *cacheItem = v8_resource_cast<QQmlDelegateModelItem>(info.This()); V8ASSERT_TYPE(cacheItem, "Not a valid VisualData object"); @@ -1700,7 +1700,7 @@ v8::Handle<v8::Value> QQmlDelegateModelItemMetaType::get_member( } void QQmlDelegateModelItemMetaType::set_member( - v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) + v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QQmlDelegateModelItem *cacheItem = v8_resource_cast<QQmlDelegateModelItem>(info.This()); V8ASSERT_TYPE_SETTER(cacheItem, "Not a valid VisualData object"); @@ -1724,7 +1724,7 @@ void QQmlDelegateModelItemMetaType::set_member( } v8::Handle<v8::Value> QQmlDelegateModelItemMetaType::get_index( - v8::Local<v8::String>, const v8::AccessorInfo &info) + v8::Handle<v8::String>, const v8::AccessorInfo &info) { QQmlDelegateModelItem *cacheItem = v8_resource_cast<QQmlDelegateModelItem>(info.This()); V8ASSERT_TYPE(cacheItem, "Not a valid VisualData object"); @@ -2099,8 +2099,8 @@ void QQmlDelegateModelGroupPrivate::emitChanges(QV8Engine *engine) { Q_Q(QQmlDelegateModelGroup); if (isChangedConnected() && !changeSet.isEmpty()) { - v8::Local<v8::Object> removed = engineData(engine)->array(engine, changeSet.removes()); - v8::Local<v8::Object> inserted = engineData(engine)->array(engine, changeSet.inserts()); + v8::Handle<v8::Object> removed = engineData(engine)->array(engine, changeSet.removes()); + v8::Handle<v8::Object> inserted = engineData(engine)->array(engine, changeSet.inserts()); emit q->changed(QQmlV4Handle::fromV8Handle(removed), QQmlV4Handle::fromV8Handle(inserted)); } if (changeSet.difference() != 0) @@ -2323,7 +2323,7 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index) if (model->m_cacheMetaType->constructor.IsEmpty()) model->m_cacheMetaType->initializeConstructor(); - v8::Local<v8::Object> handle = model->m_cacheMetaType->constructor->NewInstance(); + v8::Handle<v8::Object> handle = model->m_cacheMetaType->constructor->NewInstance(); handle->SetExternalResource(cacheItem); ++cacheItem->scriptRef; @@ -2331,13 +2331,13 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index) } bool QQmlDelegateModelGroupPrivate::parseIndex( - const v8::Local<v8::Value> &value, int *index, Compositor::Group *group) const + const v8::Handle<v8::Value> &value, int *index, Compositor::Group *group) const { if (value->IsInt32()) { *index = value->Int32Value(); return true; } else if (value->IsObject()) { - v8::Local<v8::Object> object = value->ToObject(); + v8::Handle<v8::Object> object = value->ToObject(); QQmlDelegateModelItem * const cacheItem = v8_resource_cast<QQmlDelegateModelItem>(object); if (QQmlDelegateModelPrivate *model = cacheItem && cacheItem->metaType->model ? QQmlDelegateModelPrivate::get(cacheItem->metaType->model) @@ -2379,7 +2379,7 @@ void QQmlDelegateModelGroup::insert(QQmlV8Function *args) return; int i = 0; - v8::Local<v8::Value> v = (*args)[i]; + v8::Handle<v8::Value> v = (*args)[i]; if (d->parseIndex(v, &index, &group)) { if (index < 0 || index > model->m_compositor.count(group)) { qmlInfo(this) << tr("insert: index out of range"); @@ -2438,7 +2438,7 @@ void QQmlDelegateModelGroup::create(QQmlV8Function *args) Compositor::Group group = d->group; int i = 0; - v8::Local<v8::Value> v = (*args)[i]; + v8::Handle<v8::Value> v = (*args)[i]; if (d->parseIndex(v, &index, &group)) ++i; @@ -2511,7 +2511,7 @@ void QQmlDelegateModelGroup::resolve(QQmlV8Function *args) Compositor::Group fromGroup = d->group; Compositor::Group toGroup = d->group; - v8::Local<v8::Value> v = (*args)[0]; + v8::Handle<v8::Value> v = (*args)[0]; if (d->parseIndex(v, &from, &fromGroup)) { if (from < 0 || from >= model->m_compositor.count(fromGroup)) { qmlInfo(this) << tr("resolve: from index out of range"); @@ -2608,7 +2608,7 @@ void QQmlDelegateModelGroup::remove(QQmlV8Function *args) return; int i = 0; - v8::Local<v8::Value> v = (*args)[i]; + v8::Handle<v8::Value> v = (*args)[i]; if (!d->parseIndex(v, &index, &group)) { qmlInfo(this) << tr("remove: invalid index"); return; @@ -2643,7 +2643,7 @@ bool QQmlDelegateModelGroupPrivate::parseGroupArgs( return false; int i = 0; - v8::Local<v8::Value> v = (*args)[i]; + v8::Handle<v8::Value> v = (*args)[i]; if (!parseIndex(v, index, group)) return false; @@ -2787,7 +2787,7 @@ void QQmlDelegateModelGroup::move(QQmlV8Function *args) } if (args->Length() > 2) { - v8::Local<v8::Value> v = (*args)[2]; + v8::Handle<v8::Value> v = (*args)[2]; if (v->IsInt32()) count = v->Int32Value(); } @@ -3041,17 +3041,17 @@ void QQmlPartsModel::emitModelUpdated(const QQmlChangeSet &changeSet, bool reset //============================================================================ -v8::Handle<v8::Value> get_change_index(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> get_change_index(v8::Handle<v8::String>, const v8::AccessorInfo &info) { return info.This()->GetInternalField(0); } -v8::Handle<v8::Value> get_change_count(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> get_change_count(v8::Handle<v8::String>, const v8::AccessorInfo &info) { return info.This()->GetInternalField(1); } -v8::Handle<v8::Value> get_change_moveId(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> get_change_moveId(v8::Handle<v8::String>, const v8::AccessorInfo &info) { return info.This()->GetInternalField(2); } @@ -3078,7 +3078,7 @@ public: const QQmlChangeSet::Change &change = array->at(index); - v8::Local<v8::Object> object = engineData(array->engine)->constructorChange->NewInstance(); + v8::Handle<v8::Object> object = engineData(array->engine)->constructorChange->NewInstance(); object->SetInternalField(0, v8::Int32::New(change.index)); object->SetInternalField(1, v8::Int32::New(change.count)); if (change.isMove()) @@ -3087,7 +3087,7 @@ public: return object; } - static v8::Handle<v8::Value> get_length(v8::Local<v8::String>, const v8::AccessorInfo &info) + static v8::Handle<v8::Value> get_length(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QQmlDelegateModelGroupChangeArray *array = v8_resource_cast<QQmlDelegateModelGroupChangeArray>(info.This()); V8ASSERT_TYPE(array, "Not a valid change array"); @@ -3095,9 +3095,9 @@ public: return v8::Integer::New(array->count()); } - static v8::Local<v8::Function> constructor() + static v8::Handle<v8::Function> constructor() { - v8::Local<v8::FunctionTemplate> changeArray = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> changeArray = v8::FunctionTemplate::New(); changeArray->InstanceTemplate()->SetHasExternalResource(true); changeArray->InstanceTemplate()->SetIndexedPropertyHandler(get_change); changeArray->InstanceTemplate()->SetAccessor(v8::String::New("length"), get_length); @@ -3148,7 +3148,7 @@ QQmlDelegateModelEngineData::QQmlDelegateModelEngineData(QV8Engine *) strings->Set(InItems, v8::String::New("inItems")); strings->Set(InPersistedItems, v8::String::New("inPersistedItems")); - v8::Local<v8::FunctionTemplate> change = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> change = v8::FunctionTemplate::New(); change->InstanceTemplate()->SetAccessor(v8::String::New("index"), get_change_index); change->InstanceTemplate()->SetAccessor(v8::String::New("count"), get_change_count); change->InstanceTemplate()->SetAccessor(v8::String::New("moveId"), get_change_moveId); @@ -3164,18 +3164,18 @@ QQmlDelegateModelEngineData::~QQmlDelegateModelEngineData() qPersistentDispose(constructorChangeArray); } -v8::Local<v8::Object> QQmlDelegateModelEngineData::array( +v8::Handle<v8::Object> QQmlDelegateModelEngineData::array( QV8Engine *engine, const QVector<QQmlChangeSet::Remove> &changes) { - v8::Local<v8::Object> array = constructorChangeArray->NewInstance(); + v8::Handle<v8::Object> array = constructorChangeArray->NewInstance(); array->SetExternalResource(new QQmlDelegateModelGroupRemoveArray(engine, changes)); return array; } -v8::Local<v8::Object> QQmlDelegateModelEngineData::array( +v8::Handle<v8::Object> QQmlDelegateModelEngineData::array( QV8Engine *engine, const QVector<QQmlChangeSet::Insert> &changes) { - v8::Local<v8::Object> array = constructorChangeArray->NewInstance(); + v8::Handle<v8::Object> array = constructorChangeArray->NewInstance(); array->SetExternalResource(new QQmlDelegateModelGroupInsertArray(engine, changes)); return array; } diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h index 68242f433d..b54e8bb5b5 100644 --- a/src/qml/types/qqmldelegatemodel_p_p.h +++ b/src/qml/types/qqmldelegatemodel_p_p.h @@ -78,19 +78,19 @@ public: void initializeConstructor(); int parseGroups(const QStringList &groupNames) const; - int parseGroups(const v8::Local<v8::Value> &groupNames) const; + int parseGroups(const v8::Handle<v8::Value> &groupNames) const; static void release_index(v8::Persistent<v8::Value> object, void *parameter); static void release_model(v8::Persistent<v8::Value> object, void *parameter); - static v8::Handle<v8::Value> get_model(v8::Local<v8::String>, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> get_groups(v8::Local<v8::String>, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> get_model(v8::Handle<v8::String>, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> get_groups(v8::Handle<v8::String>, const v8::AccessorInfo &info); static void set_groups( - v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> get_member(v8::Local<v8::String>, const v8::AccessorInfo &info); + v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> get_member(v8::Handle<v8::String>, const v8::AccessorInfo &info); static void set_member( - v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info); - static v8::Handle<v8::Value> get_index(v8::Local<v8::String>, const v8::AccessorInfo &info); + v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> get_index(v8::Handle<v8::String>, const v8::AccessorInfo &info); QQmlGuard<QQmlDelegateModel> model; const int groupCount; @@ -216,7 +216,7 @@ public: void initPackage(int index, QQuickPackage *package); void destroyingPackage(QQuickPackage *package); - bool parseIndex(const v8::Local<v8::Value> &value, int *index, Compositor::Group *group) const; + bool parseIndex(const v8::Handle<v8::Value> &value, int *index, Compositor::Group *group) const; bool parseGroupArgs( QQmlV8Function *args, Compositor::Group *group, int *index, int *count, int *groups) const; @@ -276,11 +276,11 @@ public: void itemsMoved( const QVector<Compositor::Remove> &removes, const QVector<Compositor::Insert> &inserts); void itemsChanged(const QVector<Compositor::Change> &changes); - template <typename T> static v8::Local<v8::Array> buildChangeList(const QVector<T> &changes); + template <typename T> static v8::Handle<v8::Array> buildChangeList(const QVector<T> &changes); void emitChanges(); void emitModelUpdated(const QQmlChangeSet &changeSet, bool reset); - bool insert(Compositor::insert_iterator &before, const v8::Local<v8::Object> &object, int groups); + bool insert(Compositor::insert_iterator &before, const v8::Handle<v8::Object> &object, int groups); static void group_append(QQmlListProperty<QQmlDelegateModelGroup> *property, QQmlDelegateModelGroup *group); static int group_count(QQmlListProperty<QQmlDelegateModelGroup> *property); diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 8b22047192..755103c9ba 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -415,12 +415,12 @@ void ListModel::set(int elementIndex, v8::Handle<v8::Object> object, QVector<int { ListElement *e = elements[elementIndex]; - v8::Local<v8::Array> propertyNames = object->GetPropertyNames(); + v8::Handle<v8::Array> propertyNames = object->GetPropertyNames(); int propertyCount = propertyNames->Length(); for (int i=0 ; i < propertyCount ; ++i) { - v8::Local<v8::String> propertyName = propertyNames->Get(i)->ToString(); - v8::Local<v8::Value> propertyValue = object->Get(propertyName); + v8::Handle<v8::String> propertyName = propertyNames->Get(i)->ToString(); + v8::Handle<v8::Value> propertyValue = object->Get(propertyName); // Check if this key exists yet int roleIndex = -1; @@ -486,12 +486,12 @@ void ListModel::set(int elementIndex, v8::Handle<v8::Object> object, QV8Engine * { ListElement *e = elements[elementIndex]; - v8::Local<v8::Array> propertyNames = object->GetPropertyNames(); + v8::Handle<v8::Array> propertyNames = object->GetPropertyNames(); int propertyCount = propertyNames->Length(); for (int i=0 ; i < propertyCount ; ++i) { - v8::Local<v8::String> propertyName = propertyNames->Get(i)->ToString(); - v8::Local<v8::Value> propertyValue = object->Get(propertyName); + v8::Handle<v8::String> propertyName = propertyNames->Get(i)->ToString(); + v8::Handle<v8::Value> propertyValue = object->Get(propertyName); // Add the value now if (propertyValue->IsString()) { diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index 2fce25b0fc..e6c0e7d349 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -141,7 +141,7 @@ public: QQuickWorkerScriptEnginePrivate *p; - v8::Local<v8::Function> sendFunction(int id); + v8::Handle<v8::Function> sendFunction(int id); void callOnMessage(v8::Handle<v8::Object> object, v8::Handle<v8::Value> arg); private: v8::Persistent<v8::Function> onmessage; @@ -224,27 +224,27 @@ void QQuickWorkerScriptEnginePrivate::WorkerEngine::init() "})" { - v8::Local<v8::Script> onmessagescript = v8::Script::New(v8::String::New(CALL_ONMESSAGE_SCRIPT)); + v8::Handle<v8::Script> onmessagescript = v8::Script::New(v8::String::New(CALL_ONMESSAGE_SCRIPT)); onmessage = qPersistentNew<v8::Function>(v8::Handle<v8::Function>::Cast(onmessagescript->Run())); } { - v8::Local<v8::Script> createsendscript = v8::Script::New(v8::String::New(SEND_MESSAGE_CREATE_SCRIPT)); - v8::Local<v8::Function> createsendconstructor = v8::Local<v8::Function>::Cast(createsendscript->Run()); + v8::Handle<v8::Script> createsendscript = v8::Script::New(v8::String::New(SEND_MESSAGE_CREATE_SCRIPT)); + v8::Handle<v8::Function> createsendconstructor = v8::Handle<v8::Function>::Cast(createsendscript->Run()); v8::Handle<v8::Value> args[] = { V8FUNCTION(QQuickWorkerScriptEnginePrivate::sendMessage, this) }; - v8::Local<v8::Value> createsendvalue = createsendconstructor->Call(v8::Value::fromV4Value(global()), 1, args); + v8::Handle<v8::Value> createsendvalue = createsendconstructor->Call(v8::Value::fromV4Value(global()), 1, args); createsend = qPersistentNew<v8::Function>(v8::Handle<v8::Function>::Cast(createsendvalue)); } } // Requires handle and context scope -v8::Local<v8::Function> QQuickWorkerScriptEnginePrivate::WorkerEngine::sendFunction(int id) +v8::Handle<v8::Function> QQuickWorkerScriptEnginePrivate::WorkerEngine::sendFunction(int id) { v8::Handle<v8::Value> args[] = { v8::Integer::New(id) }; - return v8::Local<v8::Function>::Cast(createsend->Call(v8::Value::fromV4Value(global()), 1, args)); + return v8::Handle<v8::Function>::Cast(createsend->Call(v8::Value::fromV4Value(global()), 1, args)); } // Requires handle and context scope @@ -301,7 +301,7 @@ v8::Handle<v8::Object> QQuickWorkerScriptEnginePrivate::getWorker(WorkerScript * workerEngine->contextWrapper()->setReadOnly(script->object, false); - v8::Local<v8::Object> api = v8::Object::New(); + v8::Handle<v8::Object> api = v8::Object::New(); api->Set(v8::String::New("sendMessage"), workerEngine->sendFunction(script->id)); script->object->Set(v8::String::New("WorkerScript"), api); @@ -377,7 +377,7 @@ void QQuickWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url) // workerEngine->baseUrl = url; v8::TryCatch tc; - v8::Local<v8::Script> program = workerEngine->qmlModeCompile(sourceCode, url.toString()); + v8::Handle<v8::Script> program = workerEngine->qmlModeCompile(sourceCode, url.toString()); if (!tc.HasCaught()) program->Run(activation); diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp index 18e413776c..6c1c593e93 100644 --- a/src/qml/util/qqmladaptormodel.cpp +++ b/src/qml/util/qqmladaptormodel.cpp @@ -62,9 +62,9 @@ public: QQmlAdaptorModelEngineData(QV8Engine *engine); ~QQmlAdaptorModelEngineData(); - v8::Local<v8::String> index() { return strings->Get(Index)->ToString(); } - v8::Local<v8::String> modelData() { return strings->Get(ModelData)->ToString(); } - v8::Local<v8::String> hasModelChildren() { return strings->Get(HasModelChildren)->ToString(); } + v8::Handle<v8::String> index() { return strings->Get(Index)->ToString(); } + v8::Handle<v8::String> modelData() { return strings->Get(ModelData)->ToString(); } + v8::Handle<v8::String> hasModelChildren() { return strings->Get(HasModelChildren)->ToString(); } v8::Persistent<v8::Function> constructorListItem; v8::Persistent<v8::Array> strings; @@ -72,7 +72,7 @@ public: V8_DEFINE_EXTENSION(QQmlAdaptorModelEngineData, engineData) -static v8::Handle<v8::Value> get_index(v8::Local<v8::String>, const v8::AccessorInfo &info) +static v8::Handle<v8::Value> get_index(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QQmlDelegateModelItem *data = v8_resource_cast<QQmlDelegateModelItem>(info.This()); V8ASSERT_TYPE(data, "Not a valid VisualData object"); @@ -115,9 +115,9 @@ public: void setValue(const QString &role, const QVariant &value); bool resolveIndex(const QQmlAdaptorModel &model, int idx); - static v8::Handle<v8::Value> get_property(v8::Local<v8::String>, const v8::AccessorInfo &info); + static v8::Handle<v8::Value> get_property(v8::Handle<v8::String>, const v8::AccessorInfo &info); static void set_property( - v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info); + v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info); VDMModelDelegateDataType *type; QVector<QVariant> cachedData; @@ -331,7 +331,7 @@ bool QQmlDMCachedModelData::resolveIndex(const QQmlAdaptorModel &, int idx) } v8::Handle<v8::Value> QQmlDMCachedModelData::get_property( - v8::Local<v8::String>, const v8::AccessorInfo &info) + v8::Handle<v8::String>, const v8::AccessorInfo &info) { QQmlDelegateModelItem *data = v8_resource_cast<QQmlDelegateModelItem>(info.This()); V8ASSERT_TYPE(data, "Not a valid VisualData object"); @@ -351,7 +351,7 @@ v8::Handle<v8::Value> QQmlDMCachedModelData::get_property( } void QQmlDMCachedModelData::set_property( - v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) + v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QQmlDelegateModelItem *data = v8_resource_cast<QQmlDelegateModelItem>(info.This()); V8ASSERT_TYPE_SETTER(data, "Not a valid VisualData object"); @@ -417,13 +417,13 @@ public: type->initializeConstructor(data); type->constructor->SetAccessor(data->hasModelChildren(), get_hasModelChildren); } - v8::Local<v8::Object> data = type->constructor->NewInstance(); + v8::Handle<v8::Object> data = type->constructor->NewInstance(); data->SetExternalResource(this); ++scriptRef; return data; } - static v8::Handle<v8::Value> get_hasModelChildren(v8::Local<v8::String>, const v8::AccessorInfo &info) + static v8::Handle<v8::Value> get_hasModelChildren(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QQmlDelegateModelItem *data = v8_resource_cast<QQmlDelegateModelItem>(info.This()); V8ASSERT_TYPE(data, "Not a valid VisualData object"); @@ -580,7 +580,7 @@ public: } } - static v8::Handle<v8::Value> get_modelData(v8::Local<v8::String>, const v8::AccessorInfo &info) + static v8::Handle<v8::Value> get_modelData(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QQmlDelegateModelItem *data = v8_resource_cast<QQmlDelegateModelItem>(info.This()); V8ASSERT_TYPE(data, "Not a valid VisualData object"); @@ -588,7 +588,7 @@ public: return data->engine->fromVariant(static_cast<QQmlDMListAccessorData *>(data)->cachedData); } - static void set_modelData(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) + static void set_modelData(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QQmlDelegateModelItem *data = v8_resource_cast<QQmlDelegateModelItem>(info.This()); V8ASSERT_TYPE_SETTER(data, "Not a valid VisualData object"); @@ -599,7 +599,7 @@ public: v8::Handle<v8::Value> get() { - v8::Local<v8::Object> data = engineData(engine)->constructorListItem->NewInstance(); + v8::Handle<v8::Object> data = engineData(engine)->constructorListItem->NewInstance(); data->SetExternalResource(this); ++scriptRef; return data; @@ -954,7 +954,7 @@ QQmlAdaptorModelEngineData::QQmlAdaptorModelEngineData(QV8Engine *) strings->Set(ModelData, v8::String::New("modelData")); strings->Set(HasModelChildren, v8::String::New("hasModelChildren")); - v8::Local<v8::FunctionTemplate> listItem = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> listItem = v8::FunctionTemplate::New(); listItem->InstanceTemplate()->SetHasExternalResource(true); listItem->InstanceTemplate()->SetAccessor(index(), get_index); listItem->InstanceTemplate()->SetAccessor( diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp index d8e0f3f84b..35091f8a59 100644 --- a/src/qmltest/quicktestresult.cpp +++ b/src/qmltest/quicktestresult.cpp @@ -477,7 +477,7 @@ void QuickTestResult::stringify(QQmlV8Function *args) if (args->Length() < 1) args->returnValue(v8::Null()); - v8::Local<v8::Value> value = (*args)[0]; + v8::Handle<v8::Value> value = (*args)[0]; QString result; QV8Engine *engine = args->engine(); @@ -505,7 +505,7 @@ void QuickTestResult::stringify(QQmlV8Function *args) result = QLatin1String("Object"); } } else { - v8::Local<v8::String> jsstr = value->ToString(); + v8::Handle<v8::String> jsstr = value->ToString(); QString tmp = jsstr->v4Value().toQString(); if (value->IsArray()) result.append(QString::fromLatin1("[%1]").arg(tmp)); diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 2bbb0935b0..ca4e201098 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -120,7 +120,7 @@ static const double Q_PI = 3.14159265358979323846; // pi V8THROW_ERROR_SETTER("Not a Context2D object"); #define qClamp(val, min, max) qMin(qMax(val, min), max) #define CHECK_RGBA(c) (c == '-' || c == '.' || (c >=0 && c <= 9)) -QColor qt_color_from_string(v8::Local<v8::Value> name) +QColor qt_color_from_string(v8::Handle<v8::Value> name) { v8::String::AsciiValue str(name); @@ -422,10 +422,10 @@ static QString qt_composite_mode_to_string(QPainter::CompositionMode op) } -static v8::Local<v8::Object> qt_create_image_data(qreal w, qreal h, QV8Engine* engine, const QImage& image) +static v8::Handle<v8::Object> qt_create_image_data(qreal w, qreal h, QV8Engine* engine, const QImage& image) { QQuickContext2DEngineData *ed = engineData(engine); - v8::Local<v8::Object> imageData = ed->constructorImageData->NewInstance(); + v8::Handle<v8::Object> imageData = ed->constructorImageData->NewInstance(); QV8Context2DPixelArrayResource *r = new QV8Context2DPixelArrayResource(engine); if (image.isNull()) { r->image = QImage(w, h, QImage::Format_ARGB32); @@ -434,7 +434,7 @@ static v8::Local<v8::Object> qt_create_image_data(qreal w, qreal h, QV8Engine* e Q_ASSERT(image.width() == w && image.height() == h); r->image = image.format() == QImage::Format_ARGB32 ? image : image.convertToFormat(QImage::Format_ARGB32); } - v8::Local<v8::Object> pixelData = ed->constructorPixelArray->NewInstance(); + v8::Handle<v8::Object> pixelData = ed->constructorPixelArray->NewInstance(); pixelData->SetExternalResource(r); imageData->SetInternalField(0, pixelData); @@ -449,7 +449,7 @@ static v8::Local<v8::Object> qt_create_image_data(qreal w, qreal h, QV8Engine* e This property is read only. */ -static v8::Handle<v8::Value> ctx2d_canvas(v8::Local<v8::String>, const v8::AccessorInfo &info) +static v8::Handle<v8::Value> ctx2d_canvas(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -717,7 +717,7 @@ static v8::Handle<v8::Value> ctx2d_shear(const v8::Arguments &args) The value must be in the range from 0.0 (fully transparent) to 1.0 (fully opque). The default value is 1.0. */ -static v8::Handle<v8::Value> ctx2d_globalAlpha(v8::Local<v8::String>, const v8::AccessorInfo &info) +static v8::Handle<v8::Value> ctx2d_globalAlpha(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -725,7 +725,7 @@ static v8::Handle<v8::Value> ctx2d_globalAlpha(v8::Local<v8::String>, const v8:: return v8::Number::New(r->context->state.globalAlpha); } -static void ctx2d_globalAlpha_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_globalAlpha_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -767,7 +767,7 @@ static void ctx2d_globalAlpha_set(v8::Local<v8::String>, v8::Local<v8::Value> va extension composition modes are provided as "vendorName-operationName" syntax, for example: QPainter::CompositionMode_Exclusion is provided as "qt-exclusion". */ -static v8::Handle<v8::Value> ctx2d_globalCompositeOperation(v8::Local<v8::String>, const v8::AccessorInfo &info) +static v8::Handle<v8::Value> ctx2d_globalCompositeOperation(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -778,7 +778,7 @@ static v8::Handle<v8::Value> ctx2d_globalCompositeOperation(v8::Local<v8::String return engine->toString(qt_composite_mode_to_string(r->context->state.globalCompositeOperation)); } -static void ctx2d_globalCompositeOperation_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_globalCompositeOperation_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -817,7 +817,7 @@ static void ctx2d_globalCompositeOperation_set(v8::Local<v8::String>, v8::Local< \sa createPattern() \sa strokeStyle */ -static v8::Handle<v8::Value> ctx2d_fillStyle(v8::Local<v8::String>, const v8::AccessorInfo &info) +static v8::Handle<v8::Value> ctx2d_fillStyle(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -838,7 +838,7 @@ static v8::Handle<v8::Value> ctx2d_fillStyle(v8::Local<v8::String>, const v8::Ac return r->context->m_fillStyle; } -static void ctx2d_fillStyle_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_fillStyle_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -882,7 +882,7 @@ static void ctx2d_fillStyle_set(v8::Local<v8::String>, v8::Local<v8::Value> valu \sa fillStyle */ -static v8::Handle<v8::Value> ctx2d_fillRule(v8::Local<v8::String>, const v8::AccessorInfo &info) +static v8::Handle<v8::Value> ctx2d_fillRule(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -891,7 +891,7 @@ static v8::Handle<v8::Value> ctx2d_fillRule(v8::Local<v8::String>, const v8::Acc return engine->fromVariant(r->context->state.fillRule); } -static void ctx2d_fillRule_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_fillRule_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -920,7 +920,7 @@ static void ctx2d_fillRule_set(v8::Local<v8::String>, v8::Local<v8::Value> value \sa createPattern() \sa fillStyle */ -v8::Handle<v8::Value> ctx2d_strokeStyle(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_strokeStyle(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -941,7 +941,7 @@ v8::Handle<v8::Value> ctx2d_strokeStyle(v8::Local<v8::String>, const v8::Accesso return r->context->m_strokeStyle; } -static void ctx2d_strokeStyle_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_strokeStyle_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -1002,7 +1002,7 @@ static v8::Handle<v8::Value> ctx2d_createLinearGradient(const v8::Arguments &arg if (args.Length() == 4) { QQuickContext2DEngineData *ed = engineData(engine); - v8::Local<v8::Object> gradient = ed->constructorGradient->NewInstance(); + v8::Handle<v8::Object> gradient = ed->constructorGradient->NewInstance(); QV8Context2DStyleResource *r = new QV8Context2DStyleResource(engine); qreal x0 = args[0]->NumberValue(); qreal y0 = args[1]->NumberValue(); @@ -1048,7 +1048,7 @@ static v8::Handle<v8::Value> ctx2d_createRadialGradient(const v8::Arguments &arg if (args.Length() == 6) { QQuickContext2DEngineData *ed = engineData(engine); - v8::Local<v8::Object> gradient = ed->constructorGradient->NewInstance(); + v8::Handle<v8::Object> gradient = ed->constructorGradient->NewInstance(); QV8Context2DStyleResource *r = new QV8Context2DStyleResource(engine); qreal x0 = args[0]->NumberValue(); @@ -1103,7 +1103,7 @@ static v8::Handle<v8::Value> ctx2d_createConicalGradient(const v8::Arguments &ar if (args.Length() == 6) { QQuickContext2DEngineData *ed = engineData(engine); - v8::Local<v8::Object> gradient = ed->constructorGradient->NewInstance(); + v8::Handle<v8::Object> gradient = ed->constructorGradient->NewInstance(); QV8Context2DStyleResource *r = new QV8Context2DStyleResource(engine); qreal x = args[0]->NumberValue(); @@ -1222,7 +1222,7 @@ static v8::Handle<v8::Value> ctx2d_createPattern(const v8::Arguments &args) } } - v8::Local<v8::Object> pattern = ed->constructorPattern->NewInstance(); + v8::Handle<v8::Object> pattern = ed->constructorPattern->NewInstance(); pattern->SetExternalResource(styleResouce); return pattern; @@ -1242,7 +1242,7 @@ static v8::Handle<v8::Value> ctx2d_createPattern(const v8::Arguments &args) \endlist Other values are ignored. */ -v8::Handle<v8::Value> ctx2d_lineCap(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_lineCap(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -1262,7 +1262,7 @@ v8::Handle<v8::Value> ctx2d_lineCap(v8::Local<v8::String>, const v8::AccessorInf return engine->toString(QLatin1String("butt"));; } -static void ctx2d_lineCap_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_lineCap_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -1298,7 +1298,7 @@ static void ctx2d_lineCap_set(v8::Local<v8::String>, v8::Local<v8::Value> value, \endlist Other values are ignored. */ -v8::Handle<v8::Value> ctx2d_lineJoin(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_lineJoin(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -1318,7 +1318,7 @@ v8::Handle<v8::Value> ctx2d_lineJoin(v8::Local<v8::String>, const v8::AccessorIn return engine->toString(QLatin1String("miter")); } -static void ctx2d_lineJoin_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_lineJoin_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -1344,7 +1344,7 @@ static void ctx2d_lineJoin_set(v8::Local<v8::String>, v8::Local<v8::Value> value \qmlproperty real QtQuick2::Context2D::lineWidth Holds the current line width. Values that are not finite values greater than zero are ignored. */ -v8::Handle<v8::Value> ctx2d_lineWidth(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_lineWidth(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -1353,7 +1353,7 @@ v8::Handle<v8::Value> ctx2d_lineWidth(v8::Local<v8::String>, const v8::AccessorI return v8::Number::New(r->context->state.lineWidth); } -static void ctx2d_lineWidth_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_lineWidth_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -1371,7 +1371,7 @@ static void ctx2d_lineWidth_set(v8::Local<v8::String>, v8::Local<v8::Value> valu Holds the current miter limit ratio. The default miter limit value is 10.0. */ -v8::Handle<v8::Value> ctx2d_miterLimit(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_miterLimit(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -1380,7 +1380,7 @@ v8::Handle<v8::Value> ctx2d_miterLimit(v8::Local<v8::String>, const v8::Accessor return v8::Number::New(r->context->state.miterLimit); } -static void ctx2d_miterLimit_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_miterLimit_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -1398,7 +1398,7 @@ static void ctx2d_miterLimit_set(v8::Local<v8::String>, v8::Local<v8::Value> val \qmlproperty real QtQuick2::Context2D::shadowBlur Holds the current level of blur applied to shadows */ -v8::Handle<v8::Value> ctx2d_shadowBlur(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_shadowBlur(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -1407,7 +1407,7 @@ v8::Handle<v8::Value> ctx2d_shadowBlur(v8::Local<v8::String>, const v8::Accessor return v8::Number::New(r->context->state.shadowBlur); } -static void ctx2d_shadowBlur_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_shadowBlur_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -1423,7 +1423,7 @@ static void ctx2d_shadowBlur_set(v8::Local<v8::String>, v8::Local<v8::Value> val \qmlproperty string QtQuick2::Context2D::shadowColor Holds the current shadow color. */ -v8::Handle<v8::Value> ctx2d_shadowColor(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_shadowColor(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -1434,7 +1434,7 @@ v8::Handle<v8::Value> ctx2d_shadowColor(v8::Local<v8::String>, const v8::Accesso return engine->toString(r->context->state.shadowColor.name()); } -static void ctx2d_shadowColor_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_shadowColor_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -1454,7 +1454,7 @@ static void ctx2d_shadowColor_set(v8::Local<v8::String>, v8::Local<v8::Value> va \sa shadowOffsetY */ -v8::Handle<v8::Value> ctx2d_shadowOffsetX(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_shadowOffsetX(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -1463,7 +1463,7 @@ v8::Handle<v8::Value> ctx2d_shadowOffsetX(v8::Local<v8::String>, const v8::Acces return v8::Number::New(r->context->state.shadowOffsetX); } -static void ctx2d_shadowOffsetX_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_shadowOffsetX_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -1480,7 +1480,7 @@ static void ctx2d_shadowOffsetX_set(v8::Local<v8::String>, v8::Local<v8::Value> \sa shadowOffsetX */ -v8::Handle<v8::Value> ctx2d_shadowOffsetY(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_shadowOffsetY(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -1489,7 +1489,7 @@ v8::Handle<v8::Value> ctx2d_shadowOffsetY(v8::Local<v8::String>, const v8::Acces return v8::Number::New(r->context->state.shadowOffsetY); } -static void ctx2d_shadowOffsetY_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_shadowOffsetY_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -1501,14 +1501,14 @@ static void ctx2d_shadowOffsetY_set(v8::Local<v8::String>, v8::Local<v8::Value> } } -v8::Handle<v8::Value> ctx2d_path(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_path(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) return r->context->m_v8path; } -static void ctx2d_path_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_path_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -1998,7 +1998,7 @@ static v8::Handle<v8::Value> ctx2d_caretBlinkRate(const v8::Arguments &args) The default font value is "10px sans-serif". See \l {http://www.w3.org/TR/2dcontext/#dom-context-2d-font}{w3C 2d context standard for font} */ -v8::Handle<v8::Value> ctx2d_font(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_font(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -2008,7 +2008,7 @@ v8::Handle<v8::Value> ctx2d_font(v8::Local<v8::String>, const v8::AccessorInfo & return engine->toString(r->context->state.font.toString()); } -static void ctx2d_font_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_font_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -2034,7 +2034,7 @@ static void ctx2d_font_set(v8::Local<v8::String>, v8::Local<v8::Value> value, co \endlist Other values are ignored. The default value is "start". */ -v8::Handle<v8::Value> ctx2d_textAlign(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_textAlign(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -2056,7 +2056,7 @@ v8::Handle<v8::Value> ctx2d_textAlign(v8::Local<v8::String>, const v8::AccessorI return engine->toString(QLatin1String("start")); } -static void ctx2d_textAlign_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_textAlign_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -2097,7 +2097,7 @@ static void ctx2d_textAlign_set(v8::Local<v8::String>, v8::Local<v8::Value> valu \endlist Other values are ignored. The default value is "alphabetic". */ -v8::Handle<v8::Value> ctx2d_textBaseline(v8::Local<v8::String>, const v8::AccessorInfo &info) +v8::Handle<v8::Value> ctx2d_textBaseline(v8::Handle<v8::String>, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT(r) @@ -2120,7 +2120,7 @@ v8::Handle<v8::Value> ctx2d_textBaseline(v8::Local<v8::String>, const v8::Access return engine->toString(QLatin1String("alphabetic")); } -static void ctx2d_textBaseline_set(v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info) +static void ctx2d_textBaseline_set(v8::Handle<v8::String>, v8::Handle<v8::Value> value, const v8::AccessorInfo &info) { QV8Context2DResource *r = v8_resource_cast<QV8Context2DResource>(info.This()); CHECK_CONTEXT_SETTER(r) @@ -2218,7 +2218,7 @@ static v8::Handle<v8::Value> ctx2d_measureText(const v8::Arguments &args) if (args.Length() == 1) { QFontMetrics fm(r->context->state.font); uint width = fm.width(args[0]->v4Value().toQString()); - v8::Local<v8::Object> tm = v8::Object::New(); + v8::Handle<v8::Object> tm = v8::Object::New(); tm->Set(v8::String::New("width"), v8::Number::New(width)); return tm; } @@ -2410,7 +2410,7 @@ static v8::Handle<v8::Value> ctx2d_drawImage(const v8::Arguments &args) \qmlproperty int QtQuick2::CanvasImageData::width Holds the actual width dimension of the data in the ImageData object, in device pixels. */ -v8::Handle<v8::Value> ctx2d_imageData_width(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> ctx2d_imageData_width(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QV8Context2DPixelArrayResource *r = v8_resource_cast<QV8Context2DPixelArrayResource>(args.This()->GetInternalField(0)->ToObject()); if (!r) @@ -2422,7 +2422,7 @@ v8::Handle<v8::Value> ctx2d_imageData_width(v8::Local<v8::String>, const v8::Acc \qmlproperty int QtQuick2::CanvasImageData::height Holds the actual height dimension of the data in the ImageData object, in device pixels. */ -v8::Handle<v8::Value> ctx2d_imageData_height(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> ctx2d_imageData_height(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QV8Context2DPixelArrayResource *r = v8_resource_cast<QV8Context2DPixelArrayResource>(args.This()->GetInternalField(0)->ToObject()); if (!r) @@ -2435,7 +2435,7 @@ v8::Handle<v8::Value> ctx2d_imageData_height(v8::Local<v8::String>, const v8::Ac \qmlproperty object QtQuick2::CanvasImageData::data Holds the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255. */ -v8::Handle<v8::Value> ctx2d_imageData_data(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> ctx2d_imageData_data(v8::Handle<v8::String>, const v8::AccessorInfo &args) { return args.This()->GetInternalField(0); } @@ -2458,7 +2458,7 @@ v8::Handle<v8::Value> ctx2d_imageData_data(v8::Local<v8::String>, const v8::Acce The length attribute of a CanvasPixelArray object must return this h×w×4 number value. This property is read only. */ -v8::Handle<v8::Value> ctx2d_pixelArray_length(v8::Local<v8::String>, const v8::AccessorInfo &args) +v8::Handle<v8::Value> ctx2d_pixelArray_length(v8::Handle<v8::String>, const v8::AccessorInfo &args) { QV8Context2DPixelArrayResource *r = v8_resource_cast<QV8Context2DPixelArrayResource>(args.This()); if (!r || r->image.isNull()) return v8::Undefined(); @@ -2490,7 +2490,7 @@ v8::Handle<v8::Value> ctx2d_pixelArray_indexed(uint32_t index, const v8::Accesso return v8::Undefined(); } -v8::Handle<v8::Value> ctx2d_pixelArray_indexed_set(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +v8::Handle<v8::Value> ctx2d_pixelArray_indexed_set(uint32_t index, v8::Handle<v8::Value> value, const v8::AccessorInfo& info) { QV8Context2DPixelArrayResource *r = v8_resource_cast<QV8Context2DPixelArrayResource>(info.This()); @@ -2544,7 +2544,7 @@ static v8::Handle<v8::Value> ctx2d_createImageData(const v8::Arguments &args) if (args.Length() == 1) { if (args[0]->IsObject()) { - v8::Local<v8::Object> imgData = args[0]->ToObject(); + v8::Handle<v8::Object> imgData = args[0]->ToObject(); QV8Context2DPixelArrayResource *pa = v8_resource_cast<QV8Context2DPixelArrayResource>(imgData->GetInternalField(0)->ToObject()); if (pa) { qreal w = imgData->Get(v8::String::New("width"))->NumberValue(); @@ -2592,7 +2592,7 @@ static v8::Handle<v8::Value> ctx2d_getImageData(const v8::Arguments &args) V8THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "getImageData(): Invalid arguments"); QImage image = r->context->canvas()->toImage(QRectF(x, y, w, h)); - v8::Local<v8::Object> imageData = qt_create_image_data(w, h, engine, image); + v8::Handle<v8::Object> imageData = qt_create_image_data(w, h, engine, image); return imageData; } @@ -2620,7 +2620,7 @@ static v8::Handle<v8::Value> ctx2d_putImageData(const v8::Arguments &args) if (!qIsFinite(dx) || !qIsFinite(dy)) V8THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "putImageData() : Invalid arguments"); - v8::Local<v8::Object> imageData = args[0]->ToObject(); + v8::Handle<v8::Object> imageData = args[0]->ToObject(); QV8Context2DPixelArrayResource *pixelArray = v8_resource_cast<QV8Context2DPixelArrayResource>(imageData->Get(v8::String::New("data"))->ToObject()); if (pixelArray) { w = imageData->Get(v8::String::New("width"))->NumberValue(); @@ -3457,7 +3457,7 @@ QImage QQuickContext2D::toImage(const QRectF& bounds) QQuickContext2DEngineData::QQuickContext2DEngineData(QV8Engine *engine) { - v8::Local<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(); ft->InstanceTemplate()->SetHasExternalResource(true); ft->PrototypeTemplate()->SetAccessor(v8::String::New("canvas"), ctx2d_canvas, 0, v8::External::New(engine)); ft->PrototypeTemplate()->Set(v8::String::New("restore"), V8FUNCTION(ctx2d_restore, engine)); @@ -3523,22 +3523,22 @@ QQuickContext2DEngineData::QQuickContext2DEngineData(QV8Engine *engine) constructorContext = qPersistentNew(ft->GetFunction()); - v8::Local<v8::FunctionTemplate> ftGradient = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ftGradient = v8::FunctionTemplate::New(); ftGradient->InstanceTemplate()->SetHasExternalResource(true); ftGradient->PrototypeTemplate()->Set(v8::String::New("addColorStop"), V8FUNCTION(ctx2d_gradient_addColorStop, engine)); constructorGradient = qPersistentNew(ftGradient->GetFunction()); - v8::Local<v8::FunctionTemplate> ftPattern = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ftPattern = v8::FunctionTemplate::New(); ftPattern->InstanceTemplate()->SetHasExternalResource(true); constructorPattern = qPersistentNew(ftPattern->GetFunction()); - v8::Local<v8::FunctionTemplate> ftPixelArray = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ftPixelArray = v8::FunctionTemplate::New(); ftPixelArray->InstanceTemplate()->SetHasExternalResource(true); ftPixelArray->InstanceTemplate()->SetAccessor(v8::String::New("length"), ctx2d_pixelArray_length, 0, v8::External::New(engine)); ftPixelArray->InstanceTemplate()->SetIndexedPropertyHandler(ctx2d_pixelArray_indexed, ctx2d_pixelArray_indexed_set, 0, 0, 0, v8::External::New(engine)); constructorPixelArray = qPersistentNew(ftPixelArray->GetFunction()); - v8::Local<v8::FunctionTemplate> ftImageData = v8::FunctionTemplate::New(); + v8::Handle<v8::FunctionTemplate> ftImageData = v8::FunctionTemplate::New(); ftImageData->InstanceTemplate()->SetAccessor(v8::String::New("width"), ctx2d_imageData_width, 0, v8::External::New(engine)); ftImageData->InstanceTemplate()->SetAccessor(v8::String::New("height"), ctx2d_imageData_height, 0, v8::External::New(engine)); ftImageData->InstanceTemplate()->SetAccessor(v8::String::New("data"), ctx2d_imageData_data, 0, v8::External::New(engine)); diff --git a/src/quick/items/context2d/qquickcontext2d_p.h b/src/quick/items/context2d/qquickcontext2d_p.h index 24f5c44f18..6a3389e01f 100644 --- a/src/quick/items/context2d/qquickcontext2d_p.h +++ b/src/quick/items/context2d/qquickcontext2d_p.h @@ -233,8 +233,8 @@ public: QQuickCanvasItem* m_canvas; QQuickContext2DCommandBuffer* m_buffer; QPainterPath m_path; - v8::Local<v8::Value> m_fillStyle; - v8::Local<v8::Value> m_strokeStyle; + v8::Handle<v8::Value> m_fillStyle; + v8::Handle<v8::Value> m_strokeStyle; v8::Handle<v8::Value> m_v8path; QV8Engine *m_v8engine; QSurface *m_surface; diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index a24d1a33c4..ccd3082fbf 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -517,7 +517,7 @@ void QQuickDragAttached::start(QQmlV8Function *args) Qt::DropActions supportedActions = d->supportedActions; // check arguments for supportedActions, maybe data? if (args->Length() >= 1) { - v8::Local<v8::Value> v = (*args)[0]; + v8::Handle<v8::Value> v = (*args)[0]; if (v->IsInt32()) { supportedActions = Qt::DropActions(v->Int32Value()); d->overrideActions = true; diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp index 5dc8cec640..cda308e0b6 100644 --- a/src/quick/items/qquickdroparea.cpp +++ b/src/quick/items/qquickdroparea.cpp @@ -421,7 +421,7 @@ void QQuickDropEvent::accept(QQmlV8Function *args) Qt::DropAction action = event->dropAction(); if (args->Length() >= 1) { - v8::Local<v8::Value> v = (*args)[0]; + v8::Handle<v8::Value> v = (*args)[0]; if (v->IsInt32()) action = Qt::DropAction(v->Int32Value()); } diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index eb7c48104d..43328c3f96 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -3754,7 +3754,7 @@ void QQuickItem::polish() void QQuickItem::mapFromItem(QQmlV8Function *args) const { if (args->Length() != 0) { - v8::Local<v8::Value> item = (*args)[0]; + v8::Handle<v8::Value> item = (*args)[0]; QV8Engine *engine = args->engine(); QQuickItem *itemObj = 0; @@ -3767,7 +3767,7 @@ void QQuickItem::mapFromItem(QQmlV8Function *args) const return; } - v8::Local<v8::Object> rv = v8::Object::New(); + v8::Handle<v8::Object> rv = v8::Object::New(); args->returnValue(rv); qreal x = (args->Length() > 1)?(*args)[1]->NumberValue():0; @@ -3826,7 +3826,7 @@ QTransform QQuickItem::itemTransform(QQuickItem *other, bool *ok) const void QQuickItem::mapToItem(QQmlV8Function *args) const { if (args->Length() != 0) { - v8::Local<v8::Value> item = (*args)[0]; + v8::Handle<v8::Value> item = (*args)[0]; QV8Engine *engine = args->engine(); QQuickItem *itemObj = 0; @@ -3839,7 +3839,7 @@ void QQuickItem::mapToItem(QQmlV8Function *args) const return; } - v8::Local<v8::Object> rv = v8::Object::New(); + v8::Handle<v8::Object> rv = v8::Object::New(); args->returnValue(rv); qreal x = (args->Length() > 1)?(*args)[1]->NumberValue():0; diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 3b662c1696..a1f9502fa2 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -939,15 +939,15 @@ QUrl QQuickLoaderPrivate::resolveSourceUrl(QQmlV8Function *args) v8::Handle<v8::Object> QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV8Function *args, QObject *loader, bool *error) { - v8::Local<v8::Object> valuemap; + v8::Handle<v8::Object> valuemap; if (args->Length() >= 2) { - v8::Local<v8::Value> v = (*args)[1]; + v8::Handle<v8::Value> v = (*args)[1]; if (!v->IsObject() || v->IsArray()) { *error = true; qmlInfo(loader) << QQuickLoader::tr("setSource: value is not an object"); } else { *error = false; - valuemap = v8::Local<v8::Object>::Cast(v); + valuemap = v8::Handle<v8::Object>::Cast(v); } } diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 8da66d5b45..58b1f265b3 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -1411,7 +1411,7 @@ void QQuickTextInput::positionAt(QQmlV8Function *args) const return; int i = 0; - v8::Local<v8::Value> arg = (*args)[i]; + v8::Handle<v8::Value> arg = (*args)[i]; x = arg->NumberValue(); if (++i < args->Length()) { -- GitLab