Return v8::Local instead v8::Handle in some functions.
authorJędrzej Nowacki <jedrzej.nowacki@nokia.com>
Thu, 6 Oct 2011 11:31:49 +0000 (13:31 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 24 Oct 2011 10:36:29 +0000 (12:36 +0200)
Lets try to keep information about original handle type if possible.

Change-Id: I76484c688ee5605cc99687aa4a17c6ca5d1a3891
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
src/declarative/qml/v8/qjsconverter_impl_p.h
src/declarative/qml/v8/qjsconverter_p.h
src/declarative/qml/v8/qjsengine.cpp
src/declarative/qml/v8/qv8engine.cpp
src/declarative/qml/v8/qv8engine_impl_p.h
src/declarative/qml/v8/qv8engine_p.h

index 2272721..4366ed8 100644 (file)
@@ -174,7 +174,7 @@ QRegExp QJSConverter::toRegExp(v8::Handle<v8::RegExp> jsRegExp)
 // Converts a QRegExp to a JS RegExp.
 // The conversion is not 100% exact since ECMA regexp and QRegExp
 // have different semantics/flags, but we try to do our best.
-v8::Handle<v8::RegExp> QJSConverter::toRegExp(const QRegExp &re)
+v8::Local<v8::RegExp> QJSConverter::toRegExp(const QRegExp &re)
 {
     // Convert the pattern to a ECMAScript pattern.
     QString pattern = qt_regexp_toCanonical(re.pattern(), re.patternSyntax());
@@ -224,9 +224,9 @@ v8::Handle<v8::RegExp> QJSConverter::toRegExp(const QRegExp &re)
 // The result is a new Array object with length equal to the length
 // of the QStringList, and the elements being the QStringList's
 // elements converted to JS Strings.
-v8::Handle<v8::Array> QJSConverter::toStringList(const QStringList &lst)
+v8::Local<v8::Array> QJSConverter::toStringList(const QStringList &lst)
 {
-    v8::Handle<v8::Array> result = v8::Array::New(lst.size());
+    v8::Local<v8::Array> result = v8::Array::New(lst.size());
     for (int i = 0; i < lst.size(); ++i)
         result->Set(i, toString(lst.at(i)));
     return result;
@@ -253,7 +253,7 @@ QDateTime QJSConverter::toDateTime(v8::Handle<v8::Date> jsDate)
 }
 
 // Converts a QDateTime to a JS Date.
-v8::Handle<v8::Value> QJSConverter::toDateTime(const QDateTime &dt)
+v8::Local<v8::Value> QJSConverter::toDateTime(const QDateTime &dt)
 {
     double date;
     if (!dt.isValid())
index 9ec7aaf..4b17fd6 100644 (file)
@@ -67,13 +67,13 @@ public:
     // Converts a QRegExp to a JS RegExp.
     // The conversion is not 100% exact since ECMA regexp and QRegExp
     // have different semantics/flags, but we try to do our best.
-    static inline v8::Handle<v8::RegExp> toRegExp(const QRegExp &re);
+    static inline v8::Local<v8::RegExp> toRegExp(const QRegExp &re);
 
     // Converts a QStringList to JS.
     // The result is a new Array object with length equal to the length
     // of the QStringList, and the elements being the QStringList's
     // elements converted to JS Strings.
-    static inline v8::Handle<v8::Array> toStringList(const QStringList &lst);
+    static inline v8::Local<v8::Array> toStringList(const QStringList &lst);
 
     // Converts a JS Array object to a QStringList.
     // The result is a QStringList with length equal to the length
@@ -85,7 +85,7 @@ public:
     static inline QDateTime toDateTime(v8::Handle<v8::Date> jsDate);
 
     // Converts a QDateTime to a JS Date.
-    static inline v8::Handle<v8::Value> toDateTime(const QDateTime &dt);
+    static inline v8::Local<v8::Value> toDateTime(const QDateTime &dt);
 };
 
 QT_END_NAMESPACE
index e466afc..084640b 100644 (file)
@@ -453,7 +453,7 @@ QJSValue QJSEngine::newDate(const QDateTime &dt)
     Q_D(QJSEngine);
     QScriptIsolate api(d, QScriptIsolate::NotNullEngine);
     v8::HandleScope handleScope;
-    return d->scriptValueFromInternal(v8::Handle<v8::Value>(QJSConverter::toDateTime(dt)));
+    return d->scriptValueFromInternal(QJSConverter::toDateTime(dt));
 }
 
 /*!
index 7879b7c..62abbbe 100644 (file)
@@ -915,9 +915,9 @@ QScriptPassPointer<QJSValuePrivate> QV8Engine::newRegExp(const QRegExp &regexp)
 // The result is a new Array object with length equal to the length
 // of the QVariantList, and the elements being the QVariantList's
 // elements converted to JS, recursively.
-v8::Handle<v8::Array> QV8Engine::variantListToJS(const QVariantList &lst)
+v8::Local<v8::Array> QV8Engine::variantListToJS(const QVariantList &lst)
 {
-    v8::Handle<v8::Array> result = v8::Array::New(lst.size());
+    v8::Local<v8::Array> result = v8::Array::New(lst.size());
     for (int i = 0; i < lst.size(); ++i)
         result->Set(i, variantToJS(lst.at(i)));
     return result;
@@ -946,9 +946,9 @@ QVariantList QV8Engine::variantListFromJS(v8::Handle<v8::Array> jsArray)
 // The result is a new Object object with property names being
 // the keys of the QVariantMap, and values being the values of
 // the QVariantMap converted to JS, recursively.
-v8::Handle<v8::Object> QV8Engine::variantMapToJS(const QVariantMap &vmap)
+v8::Local<v8::Object> QV8Engine::variantMapToJS(const QVariantMap &vmap)
 {
-    v8::Handle<v8::Object> result = v8::Object::New();
+    v8::Local<v8::Object> result = v8::Object::New();
     QVariantMap::const_iterator it;
     for (it = vmap.constBegin(); it != vmap.constEnd(); ++it)
         result->Set(QJSConverter::toString(it.key()), variantToJS(it.value()));
@@ -1319,10 +1319,9 @@ QVariant &QV8Engine::variantValue(v8::Handle<v8::Value> value)
 }
 
 // Creates a QVariant wrapper object.
-v8::Handle<v8::Object> QV8Engine::newVariant(const QVariant &value)
+v8::Local<v8::Object> QV8Engine::newVariant(const QVariant &value)
 {
-    v8::Handle<v8::Object> instance = variantWrapper()->newVariant(value);
-    return instance;
+    return variantWrapper()->newVariant(value);
 }
 
 QScriptPassPointer<QJSValuePrivate> QV8Engine::evaluate(v8::Handle<v8::Script> script, v8::TryCatch& tryCatch)
index 53ce2a5..be76bd3 100644 (file)
@@ -47,17 +47,17 @@ inline v8::Handle<v8::Value> QV8Engine::makeJSValue(bool value)
     return value ? v8::True() : v8::False();
 }
 
-inline v8::Handle<v8::Value> QV8Engine::makeJSValue(int value)
+inline v8::Local<v8::Value> QV8Engine::makeJSValue(int value)
 {
     return v8::Integer::New(value);
 }
 
-inline v8::Handle<v8::Value> QV8Engine::makeJSValue(uint value)
+inline v8::Local<v8::Value> QV8Engine::makeJSValue(uint value)
 {
     return v8::Integer::NewFromUnsigned(value);
 }
 
-inline v8::Handle<v8::Value> QV8Engine::makeJSValue(double value)
+inline v8::Local<v8::Value> QV8Engine::makeJSValue(double value)
 {
     return v8::Number::New(value);
 }
@@ -68,7 +68,7 @@ inline v8::Handle<v8::Value> QV8Engine::makeJSValue(QJSValue::SpecialValue value
     return v8::Undefined();
 }
 
-inline v8::Handle<v8::Value> QV8Engine::makeJSValue(const QString& value)
+inline v8::Local<v8::Value> QV8Engine::makeJSValue(const QString &value)
 {
     return QJSConverter::toString(value);
 }
index e8163fb..79a77c2 100644 (file)
@@ -364,23 +364,23 @@ public:
     void setExtensionData(int, Deletable *);
 
     inline v8::Handle<v8::Value> makeJSValue(bool value);
-    inline v8::Handle<v8::Value> makeJSValue(int value);
-    inline v8::Handle<v8::Value> makeJSValue(uint value);
-    inline v8::Handle<v8::Value> makeJSValue(double value);
+    inline v8::Local<v8::Value> makeJSValue(int value);
+    inline v8::Local<v8::Value> makeJSValue(uint value);
+    inline v8::Local<v8::Value> makeJSValue(double value);
     inline v8::Handle<v8::Value> makeJSValue(QJSValue::SpecialValue value);
-    inline v8::Handle<v8::Value> makeJSValue(const QString& value);
+    inline v8::Local<v8::Value> makeJSValue(const QString &value);
 
     inline QScriptPassPointer<QJSValuePrivate> evaluate(const QString &program, const QString &fileName = QString(), int lineNumber = 1);
     QScriptPassPointer<QJSValuePrivate> evaluate(v8::Handle<v8::Script> script, v8::TryCatch& tryCatch);
 
     QScriptPassPointer<QJSValuePrivate> newArray(uint length);
-    v8::Handle<v8::Object> newVariant(const QVariant &variant);
+    v8::Local<v8::Object> newVariant(const QVariant &variant);
     QScriptPassPointer<QJSValuePrivate> newVariant(QJSValuePrivate* value, const QVariant &variant);
 
-    v8::Handle<v8::Array> variantListToJS(const QVariantList &lst);
+    v8::Local<v8::Array> variantListToJS(const QVariantList &lst);
     QVariantList variantListFromJS(v8::Handle<v8::Array> jsArray);
 
-    v8::Handle<v8::Object> variantMapToJS(const QVariantMap &vmap);
+    v8::Local<v8::Object> variantMapToJS(const QVariantMap &vmap);
     QVariantMap variantMapFromJS(v8::Handle<v8::Object> jsObject);
 
     v8::Handle<v8::Value> variantToJS(const QVariant &value);