From a508650fb6e2e850734efdcce154b83bdad4df67 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 4 Mar 2013 17:21:08 +0100 Subject: Replace deprecated V8 functions The External::Wrap and External::Unwrap functions became deprecated in the mainline V8. Replace them as it is officially proposed. Change-Id: Ieac1da53997da440a909939d86c98f17a124c068 Reviewed-by: Lars Knoll --- src/qml/qml/qqmlxmlhttprequest.cpp | 56 ++++++++++++++++++------------------ src/qml/qml/v8/qv8engine.cpp | 6 ++-- src/qml/qml/v8/qv8engine_p.h | 6 ++-- src/qml/qml/v8/qv8qobjectwrapper.cpp | 6 ++-- 4 files changed, 37 insertions(+), 37 deletions(-) (limited to 'src/qml') diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 9bd769f157..80f5deccdb 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -496,25 +496,25 @@ v8::Handle Node::prototype(QV8Engine *engine) if (d->nodePrototype.IsEmpty()) { d->nodePrototype = qPersistentNew(v8::Object::New()); d->nodePrototype->SetAccessor(v8::String::New("nodeName"), nodeName, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->nodePrototype->SetAccessor(v8::String::New("nodeValue"), nodeValue, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->nodePrototype->SetAccessor(v8::String::New("nodeType"), nodeType, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->nodePrototype->SetAccessor(v8::String::New("parentNode"), parentNode, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->nodePrototype->SetAccessor(v8::String::New("childNodes"), childNodes, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->nodePrototype->SetAccessor(v8::String::New("firstChild"), firstChild, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->nodePrototype->SetAccessor(v8::String::New("lastChild"), lastChild, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->nodePrototype->SetAccessor(v8::String::New("previousSibling"), previousSibling, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->nodePrototype->SetAccessor(v8::String::New("nextSibling"), nextSibling, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->nodePrototype->SetAccessor(v8::String::New("attributes"), attributes, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); engine->freezeObject(d->nodePrototype); } return d->nodePrototype; @@ -564,7 +564,7 @@ v8::Handle Element::prototype(QV8Engine *engine) d->elementPrototype = qPersistentNew(v8::Object::New()); d->elementPrototype->SetPrototype(Node::prototype(engine)); d->elementPrototype->SetAccessor(v8::String::New("tagName"), nodeName, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); engine->freezeObject(d->elementPrototype); } return d->elementPrototype; @@ -577,11 +577,11 @@ v8::Handle Attr::prototype(QV8Engine *engine) d->attrPrototype = qPersistentNew(v8::Object::New()); d->attrPrototype->SetPrototype(Node::prototype(engine)); d->attrPrototype->SetAccessor(v8::String::New("name"), name, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->attrPrototype->SetAccessor(v8::String::New("value"), value, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->attrPrototype->SetAccessor(v8::String::New("ownerElement"), ownerElement, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); engine->freezeObject(d->attrPrototype); } return d->attrPrototype; @@ -630,9 +630,9 @@ v8::Handle CharacterData::prototype(QV8Engine *engine) d->characterDataPrototype = qPersistentNew(v8::Object::New()); d->characterDataPrototype->SetPrototype(Node::prototype(engine)); d->characterDataPrototype->SetAccessor(v8::String::New("data"), nodeValue, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->characterDataPrototype->SetAccessor(v8::String::New("length"), length, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); engine->freezeObject(d->characterDataPrototype); } return d->characterDataPrototype; @@ -663,9 +663,9 @@ v8::Handle Text::prototype(QV8Engine *engine) d->textPrototype = qPersistentNew(v8::Object::New()); d->textPrototype->SetPrototype(CharacterData::prototype(engine)); d->textPrototype->SetAccessor(v8::String::New("isElementContentWhitespace"), isElementContentWhitespace, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->textPrototype->SetAccessor(v8::String::New("wholeText"), wholeText, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); engine->freezeObject(d->textPrototype); } return d->textPrototype; @@ -689,13 +689,13 @@ v8::Handle Document::prototype(QV8Engine *engine) d->documentPrototype = qPersistentNew(v8::Object::New()); d->documentPrototype->SetPrototype(Node::prototype(engine)); d->documentPrototype->SetAccessor(v8::String::New("xmlVersion"), xmlVersion, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->documentPrototype->SetAccessor(v8::String::New("xmlEncoding"), xmlEncoding, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->documentPrototype->SetAccessor(v8::String::New("xmlStandalone"), xmlStandalone, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); d->documentPrototype->SetAccessor(v8::String::New("documentElement"), documentElement, - 0, v8::External::Wrap(engine)); + 0, v8::External::New(engine)); engine->freezeObject(d->documentPrototype); } return d->documentPrototype; @@ -854,9 +854,9 @@ v8::Handle NamedNodeMap::prototype(QV8Engine *engine) QQmlXMLHttpRequestData *d = xhrdata(engine); if (d->namedNodeMapPrototype.IsEmpty()) { v8::Local ot = v8::ObjectTemplate::New(); - ot->SetAccessor(v8::String::New("length"), length, 0, v8::External::Wrap(engine)); - ot->SetIndexedPropertyHandler(indexed, 0, 0, 0, 0, v8::External::Wrap(engine)); - ot->SetFallbackPropertyHandler(named, 0, 0, 0, 0, v8::External::Wrap(engine)); + 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)); d->namedNodeMapPrototype = qPersistentNew(ot->NewInstance()); engine->freezeObject(d->namedNodeMapPrototype); } @@ -903,8 +903,8 @@ v8::Handle NodeList::prototype(QV8Engine *engine) QQmlXMLHttpRequestData *d = xhrdata(engine); if (d->nodeListPrototype.IsEmpty()) { v8::Local ot = v8::ObjectTemplate::New(); - ot->SetAccessor(v8::String::New("length"), length, 0, v8::External::Wrap(engine)); - ot->SetIndexedPropertyHandler(indexed, 0, 0, 0, 0, v8::External::Wrap(engine)); + 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(ot->NewInstance()); engine->freezeObject(d->nodeListPrototype); } @@ -1790,7 +1790,7 @@ void *qt_add_qmlxmlhttprequest(QV8Engine *engine) // XMLHttpRequest v8::Local xmlhttprequest = v8::FunctionTemplate::New(qmlxmlhttprequest_new, - v8::External::Wrap(engine)); + v8::External::New(engine)); xmlhttprequest->InstanceTemplate()->SetHasExternalResource(true); // Methods diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 15611f3428..2f14b62618 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -1451,7 +1451,7 @@ int QV8Engine::consoleCountHelper(const QString &file, quint16 line, quint16 col v8::Handle QV8Engine::getPlatform(v8::Local, const v8::AccessorInfo &info) { - QV8Engine *engine = reinterpret_cast(v8::External::Unwrap(info.Data())); + QV8Engine *engine = reinterpret_cast(v8::External::Cast(*info.Data())->Value()); if (!engine->m_platform) { // Only allocate a platform object once engine->m_platform = new QQmlPlatform(engine->m_engine); @@ -1461,7 +1461,7 @@ v8::Handle QV8Engine::getPlatform(v8::Local, const v8::Ac v8::Handle QV8Engine::getApplication(v8::Local, const v8::AccessorInfo &info) { - QV8Engine *engine = reinterpret_cast(v8::External::Unwrap(info.Data())); + QV8Engine *engine = reinterpret_cast(v8::External::Cast(*info.Data())->Value()); if (!engine->m_application) { // Only allocate an application object once engine->m_application = QQml_guiProvider()->application(engine->m_engine); @@ -1472,7 +1472,7 @@ v8::Handle QV8Engine::getApplication(v8::Local, const v8: #ifndef QT_NO_IM v8::Handle QV8Engine::getInputMethod(v8::Local, const v8::AccessorInfo &info) { - QV8Engine *engine = reinterpret_cast(v8::External::Unwrap(info.Data())); + QV8Engine *engine = reinterpret_cast(v8::External::Cast(*info.Data())->Value()); return engine->newQObject(QQml_guiProvider()->inputMethod(), CppOwnership); } #endif diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index 9c3eb22e1c..090ffaa353 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -102,8 +102,8 @@ QT_BEGIN_NAMESPACE // a handle, qFatal() is called. // #define QML_GLOBAL_HANDLE_DEBUGGING -#define V8ENGINE() ((QV8Engine *)v8::External::Unwrap(args.Data())) -#define V8FUNCTION(function, engine) v8::FunctionTemplate::New(function, v8::External::Wrap((QV8Engine*)engine))->GetFunction() +#define V8ENGINE() ((QV8Engine *)v8::External::Cast(*args.Data())->Value()) +#define V8FUNCTION(function, engine) v8::FunctionTemplate::New(function, v8::External::New((QV8Engine*)engine))->GetFunction() #define V8THROW_ERROR(string) { \ v8::ThrowException(v8::Exception::Error(v8::String::New(string))); \ return v8::Handle(); \ @@ -112,7 +112,7 @@ QT_BEGIN_NAMESPACE v8::ThrowException(v8::Exception::TypeError(v8::String::New(string))); \ return v8::Handle(); \ } -#define V8ENGINE_ACCESSOR() ((QV8Engine *)v8::External::Unwrap(info.Data())); +#define V8ENGINE_ACCESSOR() ((QV8Engine *)v8::External::Cast(*info.Data())->Value()); #define V8THROW_ERROR_SETTER(string) { \ v8::ThrowException(v8::Exception::Error(v8::String::New(string))); \ return; \ diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp index 4539401a3b..0982f177d3 100644 --- a/src/qml/qml/v8/qv8qobjectwrapper.cpp +++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp @@ -277,7 +277,7 @@ static v8::Handle GenericValueGetter(v8::Local, const v8: if (QQmlData::wasDeleted(object)) return v8::Undefined(); QQmlPropertyData *property = - (QQmlPropertyData *)v8::External::Unwrap(info.Data()); + (QQmlPropertyData *)v8::External::Cast(*info.Data())->Value(); QQmlEngine *engine = resource->engine->engine(); QQmlEnginePrivate *ep = engine?QQmlEnginePrivate::get(engine):0; @@ -894,7 +894,7 @@ static void FastValueSetter(v8::Local, v8::Local value, QObject *object = resource->object; QQmlPropertyData *property = - (QQmlPropertyData *)v8::External::Unwrap(info.Data()); + (QQmlPropertyData *)v8::External::Cast(*info.Data())->Value(); int index = property->coreIndex; @@ -1029,7 +1029,7 @@ v8::Local QQmlPropertyCache::newQObject(QObject *object, QV8Engine * // this type and the property accessor checks if the object is 0 (deleted) before // dereferencing the pointer. ft->InstanceTemplate()->SetAccessor(engine->toString(iter.key()), fastgetter, fastsetter, - v8::External::Wrap(property)); + v8::External::New(property)); } } -- cgit v1.2.3