Changeset 116102 in webkit


Ignore:
Timestamp:
May 4, 2012 7:52:30 AM (12 years ago)
Author:
Csaba Osztrogonác
Message:

[Qt] Update Qt bridge after changes to QMetaMethod
https://bugs.webkit.org/show_bug.cgi?id=85478

Patch by Kent Hansen <kent.hansen@nokia.com> on 2012-05-04
Reviewed by Tor Arne Vestbø.

QMetaMethod::signature() has been renamed to methodSignature() and
returns a QByteArray.

The new function QMetaMethod::name() gives direct access to a
method's name. returnType(), parameterCount(), and parameterType()
give direct access to type information.

Ported the custom QtConnectionObject meta-object to revision 7;
revision 6 and below aren't supported (and don't compile) with Qt5.

Source/WebCore:

  • Target.pri:
  • bridge/qt/qt_class.cpp:

(JSC::Bindings::QtClass::fallbackObject):

  • bridge/qt/qt_instance.cpp:

(JSC::Bindings::QtInstance::getPropertyNames):

  • bridge/qt/qt_runtime.cpp:

(JSC::Bindings::findMethodIndex):
(Bindings):
(qt_meta_stringdata_QtConnectionObject_t):
(JSC::Bindings::QtConnectionObject::qt_static_metacall):
(JSC::Bindings::QtConnectionObject::qt_metacast):
(JSC::Bindings::QtConnectionObject::qt_metacall):
(JSC::Bindings::QtConnectionObject::execute):

  • bridge/qt/qt_runtime.h:

(QtConnectionObject):

  • bridge/qt/qt_runtime_qt4.cpp: Copied from Source/WebCore/bridge/qt/qt_runtime.cpp.

(Bindings):
(QWKNoDebug):
(JSC::Bindings::QWKNoDebug::QWKNoDebug):
(JSC::Bindings::QWKNoDebug::~QWKNoDebug):
(JSC::Bindings::QWKNoDebug::operator<<):
(JSC::Bindings::operator<<):
(RuntimeConversion):
(JSC::Bindings::registerCustomType):
(JSC::Bindings::isJSUint8ClampedArray):
(JSC::Bindings::valueRealType):
(JSC::Bindings::convertValueToQVariantMap):
(JSC::Bindings::convertValueToQVariant):
(JSC::Bindings::convertQVariantToValue):
(JSC::Bindings::QtRuntimeMethod::QtRuntimeMethod):
(JSC::Bindings::QtRuntimeMethod::finishCreation):
(JSC::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
(JSC::Bindings::QtRuntimeMethod::destroy):
(JSC::Bindings::QtRuntimeMethodData::~QtRuntimeMethodData):
(JSC::Bindings::QtRuntimeMethodData::finalize):
(JSC::Bindings::QtRuntimeMetaMethodData::~QtRuntimeMetaMethodData):
(JSC::Bindings::QtRuntimeConnectionMethodData::~QtRuntimeConnectionMethodData):
(QtMethodMatchType):
(JSC::Bindings::QtMethodMatchType::QtMethodMatchType):
(JSC::Bindings::QtMethodMatchType::kind):
(JSC::Bindings::QtMethodMatchType::isValid):
(JSC::Bindings::QtMethodMatchType::isVariant):
(JSC::Bindings::QtMethodMatchType::isMetaType):
(JSC::Bindings::QtMethodMatchType::isUnresolved):
(JSC::Bindings::QtMethodMatchType::isMetaEnum):
(JSC::Bindings::QtMethodMatchType::enumeratorIndex):
(JSC::Bindings::QtMethodMatchType::variant):
(JSC::Bindings::QtMethodMatchType::metaType):
(JSC::Bindings::QtMethodMatchType::metaEnum):
(JSC::Bindings::QtMethodMatchType::unresolved):
(JSC::Bindings::QtMethodMatchType::typeId):
(JSC::Bindings::QtMethodMatchType::name):
(QtMethodMatchData):
(JSC::Bindings::QtMethodMatchData::QtMethodMatchData):
(JSC::Bindings::QtMethodMatchData::isValid):
(JSC::Bindings::QtMethodMatchData::firstUnresolvedIndex):
(JSC::Bindings::indexOfMetaEnum):
(JSC::Bindings::findMethodIndex):
(JSC::Bindings::findSignalIndex):
(JSC::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
(JSC::Bindings::QtRuntimeMetaMethod::finishCreation):
(JSC::Bindings::QtRuntimeMetaMethod::visitChildren):
(JSC::Bindings::QtRuntimeMetaMethod::call):
(JSC::Bindings::QtRuntimeMetaMethod::getCallData):
(JSC::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
(JSC::Bindings::QtRuntimeMetaMethod::getOwnPropertyDescriptor):
(JSC::Bindings::QtRuntimeMetaMethod::getOwnPropertyNames):
(JSC::Bindings::QtRuntimeMetaMethod::lengthGetter):
(JSC::Bindings::QtRuntimeMetaMethod::connectGetter):
(JSC::Bindings::QtRuntimeMetaMethod::disconnectGetter):
(JSC::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
(JSC::Bindings::QtRuntimeConnectionMethod::finishCreation):
(JSC::Bindings::QtRuntimeConnectionMethod::call):
(JSC::Bindings::QtRuntimeConnectionMethod::getCallData):
(JSC::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
(JSC::Bindings::QtRuntimeConnectionMethod::getOwnPropertyDescriptor):
(JSC::Bindings::QtRuntimeConnectionMethod::getOwnPropertyNames):
(JSC::Bindings::QtRuntimeConnectionMethod::lengthGetter):
(JSC::Bindings::QtConnectionObject::QtConnectionObject):
(JSC::Bindings::QtConnectionObject::~QtConnectionObject):
(JSC::Bindings::QtConnectionObject::metaObject):
(JSC::Bindings::QtConnectionObject::qt_metacast):
(JSC::Bindings::QtConnectionObject::qt_metacall):
(JSC::Bindings::isJavaScriptFunction):
(JSC::Bindings::QtConnectionObject::execute):
(JSC::Bindings::QtConnectionObject::match):
(JSC::Bindings::QtConnectionObject::createWithInternalJSC):
(JSC::Bindings::::QtArray):
(JSC::Bindings::::~QtArray):
(JSC::Bindings::::rootObject):
(JSC::Bindings::::setValueAt):
(JSC::Bindings::::valueAt):

Source/WebKit2:

  • UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:

(gatherAPI):

Location:
trunk/Source
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116099 r116102  
     12012-05-04  Kent Hansen <kent.hansen@nokia.com>
     2
     3        [Qt] Update Qt bridge after changes to QMetaMethod
     4        https://bugs.webkit.org/show_bug.cgi?id=85478
     5
     6        Reviewed by Tor Arne Vestbø.
     7
     8        QMetaMethod::signature() has been renamed to methodSignature() and
     9        returns a QByteArray.
     10
     11        The new function QMetaMethod::name() gives direct access to a
     12        method's name. returnType(), parameterCount(), and parameterType()
     13        give direct access to type information.
     14
     15        Ported the custom QtConnectionObject meta-object to revision 7;
     16        revision 6 and below aren't supported (and don't compile) with Qt5.
     17
     18        * Target.pri:
     19        * bridge/qt/qt_class.cpp:
     20        (JSC::Bindings::QtClass::fallbackObject):
     21        * bridge/qt/qt_instance.cpp:
     22        (JSC::Bindings::QtInstance::getPropertyNames):
     23        * bridge/qt/qt_runtime.cpp:
     24        (JSC::Bindings::findMethodIndex):
     25        (Bindings):
     26        (qt_meta_stringdata_QtConnectionObject_t):
     27        (JSC::Bindings::QtConnectionObject::qt_static_metacall):
     28        (JSC::Bindings::QtConnectionObject::qt_metacast):
     29        (JSC::Bindings::QtConnectionObject::qt_metacall):
     30        (JSC::Bindings::QtConnectionObject::execute):
     31        * bridge/qt/qt_runtime.h:
     32        (QtConnectionObject):
     33        * bridge/qt/qt_runtime_qt4.cpp: Copied from Source/WebCore/bridge/qt/qt_runtime.cpp.
     34        (Bindings):
     35        (QWKNoDebug):
     36        (JSC::Bindings::QWKNoDebug::QWKNoDebug):
     37        (JSC::Bindings::QWKNoDebug::~QWKNoDebug):
     38        (JSC::Bindings::QWKNoDebug::operator<<):
     39        (JSC::Bindings::operator<<):
     40        (RuntimeConversion):
     41        (JSC::Bindings::registerCustomType):
     42        (JSC::Bindings::isJSUint8ClampedArray):
     43        (JSC::Bindings::valueRealType):
     44        (JSC::Bindings::convertValueToQVariantMap):
     45        (JSC::Bindings::convertValueToQVariant):
     46        (JSC::Bindings::convertQVariantToValue):
     47        (JSC::Bindings::QtRuntimeMethod::QtRuntimeMethod):
     48        (JSC::Bindings::QtRuntimeMethod::finishCreation):
     49        (JSC::Bindings::QtRuntimeMethod::~QtRuntimeMethod):
     50        (JSC::Bindings::QtRuntimeMethod::destroy):
     51        (JSC::Bindings::QtRuntimeMethodData::~QtRuntimeMethodData):
     52        (JSC::Bindings::QtRuntimeMethodData::finalize):
     53        (JSC::Bindings::QtRuntimeMetaMethodData::~QtRuntimeMetaMethodData):
     54        (JSC::Bindings::QtRuntimeConnectionMethodData::~QtRuntimeConnectionMethodData):
     55        (QtMethodMatchType):
     56        (JSC::Bindings::QtMethodMatchType::QtMethodMatchType):
     57        (JSC::Bindings::QtMethodMatchType::kind):
     58        (JSC::Bindings::QtMethodMatchType::isValid):
     59        (JSC::Bindings::QtMethodMatchType::isVariant):
     60        (JSC::Bindings::QtMethodMatchType::isMetaType):
     61        (JSC::Bindings::QtMethodMatchType::isUnresolved):
     62        (JSC::Bindings::QtMethodMatchType::isMetaEnum):
     63        (JSC::Bindings::QtMethodMatchType::enumeratorIndex):
     64        (JSC::Bindings::QtMethodMatchType::variant):
     65        (JSC::Bindings::QtMethodMatchType::metaType):
     66        (JSC::Bindings::QtMethodMatchType::metaEnum):
     67        (JSC::Bindings::QtMethodMatchType::unresolved):
     68        (JSC::Bindings::QtMethodMatchType::typeId):
     69        (JSC::Bindings::QtMethodMatchType::name):
     70        (QtMethodMatchData):
     71        (JSC::Bindings::QtMethodMatchData::QtMethodMatchData):
     72        (JSC::Bindings::QtMethodMatchData::isValid):
     73        (JSC::Bindings::QtMethodMatchData::firstUnresolvedIndex):
     74        (JSC::Bindings::indexOfMetaEnum):
     75        (JSC::Bindings::findMethodIndex):
     76        (JSC::Bindings::findSignalIndex):
     77        (JSC::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
     78        (JSC::Bindings::QtRuntimeMetaMethod::finishCreation):
     79        (JSC::Bindings::QtRuntimeMetaMethod::visitChildren):
     80        (JSC::Bindings::QtRuntimeMetaMethod::call):
     81        (JSC::Bindings::QtRuntimeMetaMethod::getCallData):
     82        (JSC::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
     83        (JSC::Bindings::QtRuntimeMetaMethod::getOwnPropertyDescriptor):
     84        (JSC::Bindings::QtRuntimeMetaMethod::getOwnPropertyNames):
     85        (JSC::Bindings::QtRuntimeMetaMethod::lengthGetter):
     86        (JSC::Bindings::QtRuntimeMetaMethod::connectGetter):
     87        (JSC::Bindings::QtRuntimeMetaMethod::disconnectGetter):
     88        (JSC::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
     89        (JSC::Bindings::QtRuntimeConnectionMethod::finishCreation):
     90        (JSC::Bindings::QtRuntimeConnectionMethod::call):
     91        (JSC::Bindings::QtRuntimeConnectionMethod::getCallData):
     92        (JSC::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
     93        (JSC::Bindings::QtRuntimeConnectionMethod::getOwnPropertyDescriptor):
     94        (JSC::Bindings::QtRuntimeConnectionMethod::getOwnPropertyNames):
     95        (JSC::Bindings::QtRuntimeConnectionMethod::lengthGetter):
     96        (JSC::Bindings::QtConnectionObject::QtConnectionObject):
     97        (JSC::Bindings::QtConnectionObject::~QtConnectionObject):
     98        (JSC::Bindings::QtConnectionObject::metaObject):
     99        (JSC::Bindings::QtConnectionObject::qt_metacast):
     100        (JSC::Bindings::QtConnectionObject::qt_metacall):
     101        (JSC::Bindings::isJavaScriptFunction):
     102        (JSC::Bindings::QtConnectionObject::execute):
     103        (JSC::Bindings::QtConnectionObject::match):
     104        (JSC::Bindings::QtConnectionObject::createWithInternalJSC):
     105        (JSC::Bindings::::QtArray):
     106        (JSC::Bindings::::~QtArray):
     107        (JSC::Bindings::::rootObject):
     108        (JSC::Bindings::::setValueAt):
     109        (JSC::Bindings::::valueAt):
     110
    11112012-05-04  Yury Semikhatsky  <yurys@chromium.org>
    2112
  • trunk/Source/WebCore/Target.pri

    r116086 r116102  
    397397        bridge/qt/qt_instance.cpp \
    398398        bridge/qt/qt_pixmapruntime.cpp \
    399         bridge/qt/qt_runtime.cpp \
    400399        bridge/runtime_array.cpp \
    401400        bridge/runtime_method.cpp \
     
    403402        bridge/runtime_root.cpp \
    404403        testing/js/WebCoreTestSupport.cpp
     404
     405    haveQt(5) {
     406        SOURCES += bridge/qt/qt_runtime.cpp
     407    } else {
     408        SOURCES += bridge/qt/qt_runtime_qt4.cpp
     409    }
    405410}
    406411
  • trunk/Source/WebCore/bridge/qt/qt_class.cpp

    r91903 r116102  
    100100            continue;
    101101
     102#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    102103        int iter = 0;
    103104        const char* signature = m.signature();
     
    106107
    107108        if (normal == QByteArray::fromRawData(signature, iter)) {
     109#else
     110        if (normal == m.name()) {
     111#endif
    108112            QtRuntimeMetaMethod* val = QtRuntimeMetaMethod::create(exec, identifier, static_cast<QtInstance*>(inst), index, normal, false);
    109113            qtinst->m_methods.insert(name, WriteBarrier<JSObject>(exec->globalData(), qtinst->createRuntimeObject(exec), val));
  • trunk/Source/WebCore/bridge/qt/qt_instance.cpp

    r102679 r116102  
    237237        for (i = 0; i < methodCount; i++) {
    238238            QMetaMethod method = meta->method(i);
    239             if (method.access() != QMetaMethod::Private)
     239            if (method.access() != QMetaMethod::Private) {
     240#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
     241                QString sig = QString::fromLatin1(method.methodSignature());
     242                array.add(Identifier(exec, UString(sig.utf16(), sig.length())));
     243#else
    240244                array.add(Identifier(exec, method.signature()));
     245#endif
     246            }
    241247        }
    242248    }
     
    284290            if (m.access() != QMetaMethod::Private
    285291                && m.methodType() != QMetaMethod::Signal
     292#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
     293                && m.parameterCount() == 0
     294                && m.returnType() != QMetaType::Void) {
     295                QVariant ret(m.returnType(), (void*)0);
     296                void * qargs[1];
     297                qargs[0] = ret.data();
     298
     299                if (QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, index, qargs) < 0) {
     300                    if (ret.isValid() && ret.canConvert(QVariant::String)) {
     301                        buf = ret.toString().toLatin1().constData(); // ### Latin 1? Ascii?
     302                        useDefault = false;
     303#else
    286304                && m.parameterTypes().isEmpty()) {
    287305                const char* retsig = m.typeName();
     
    296314                            useDefault = false;
    297315                        }
     316#endif
    298317                    }
    299318                }
     
    385404        QMetaType::Type argtype = QMetaType::Void;
    386405        if (m_type == MetaProperty)
     406#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
     407            argtype = (QMetaType::Type) m_property.userType();
     408#else
    387409            argtype = (QMetaType::Type) QMetaType::type(m_property.typeName());
     410#endif
    388411
    389412        // dynamic properties just get any QVariant
  • trunk/Source/WebCore/bridge/qt/qt_runtime.cpp

    r115546 r116102  
    11621162
    11631163        // try and find all matching named methods
    1164         if (m.signature() == signature)
     1164        if (!overloads && m.methodSignature() == signature)
    11651165            matchingIndices.append(i);
    1166         else if (overloads) {
    1167             QByteArray rawsignature = m.signature();
    1168             rawsignature.truncate(rawsignature.indexOf('('));
    1169             if (rawsignature == signature)
    1170                 matchingIndices.append(i);
    1171         }
     1166        else if (overloads && m.name() == signature)
     1167            matchingIndices.append(i);
    11721168    }
    11731169
     
    11901186        // resolve return type
    11911187        QByteArray returnTypeName = method.typeName();
    1192         int rtype = QMetaType::type(returnTypeName);
    1193         if ((rtype == 0) && !returnTypeName.isEmpty()) {
    1194             if (returnTypeName == "QVariant") {
    1195                 types.append(QtMethodMatchType::variant());
    1196             } else if (returnTypeName.endsWith('*')) {
     1188        int rtype = method.returnType();
     1189        if (rtype == QMetaType::UnknownType) {
     1190            if (returnTypeName.endsWith('*')) {
    11971191                types.append(QtMethodMatchType::metaType(QMetaType::VoidStar, returnTypeName));
    11981192            } else {
     
    12061200            }
    12071201        } else {
    1208             if (returnTypeName == "QVariant")
     1202            if (rtype == QMetaType::QVariant)
    12091203                types.append(QtMethodMatchType::variant());
    12101204            else
     
    12161210        for (int i = 0; i < parameterTypeNames.count(); ++i) {
    12171211            QByteArray argTypeName = parameterTypeNames.at(i);
    1218             int atype = QMetaType::type(argTypeName);
    1219             if (atype == 0) {
    1220                 if (argTypeName == "QVariant") {
    1221                     types.append(QtMethodMatchType::variant());
    1222                 } else {
    1223                     int enumIndex = indexOfMetaEnum(meta, argTypeName);
    1224                     if (enumIndex != -1)
    1225                         types.append(QtMethodMatchType::metaEnum(enumIndex, argTypeName));
    1226                     else {
    1227                         unresolvedTypes = true;
    1228                         types.append(QtMethodMatchType::unresolved(argTypeName));
    1229                     }
     1212            int atype = method.parameterType(i);
     1213            if (atype == QMetaType::UnknownType) {
     1214                int enumIndex = indexOfMetaEnum(meta, argTypeName);
     1215                if (enumIndex != -1)
     1216                    types.append(QtMethodMatchType::metaEnum(enumIndex, argTypeName));
     1217                else {
     1218                    unresolvedTypes = true;
     1219                    types.append(QtMethodMatchType::unresolved(argTypeName));
    12301220                }
    12311221            } else {
    1232                 if (argTypeName == "QVariant")
     1222                if (atype == QMetaType::QVariant)
    12331223                    types.append(QtMethodMatchType::variant());
    12341224                else
     
    12391229        // If the native method requires more arguments than what was passed from JavaScript
    12401230        if (exec->argumentCount() + 1 < static_cast<unsigned>(types.count())) {
    1241             qMatchDebug() << "Match:too few args for" << method.signature();
     1231            qMatchDebug() << "Match:too few args for" << method.methodSignature();
    12421232            tooFewArgs.append(index);
    12431233            continue;
     
    12451235
    12461236        if (unresolvedTypes) {
    1247             qMatchDebug() << "Match:unresolved arg types for" << method.signature();
     1237            qMatchDebug() << "Match:unresolved arg types for" << method.methodSignature();
    12481238            // remember it so we can give an error message later, if necessary
    12491239            unresolved.append(QtMethodMatchData(/*matchDistance=*/INT_MAX, index,
     
    12571247
    12581248        QtMethodMatchType retType = types[0];
    1259         args[0] = QVariant(retType.typeId(), (void *)0); // the return value
     1249        if (retType.typeId() != QMetaType::Void)
     1250            args[0] = QVariant(retType.typeId(), (void *)0); // the return value
    12601251
    12611252        bool converted = true;
     
    12751266        }
    12761267
    1277         qMatchDebug() << "Match: " << method.signature() << (converted ? "converted":"failed to convert") << "distance " << matchDistance;
     1268        qMatchDebug() << "Match: " << method.methodSignature() << (converted ? "converted":"failed to convert") << "distance " << matchDistance;
    12781269
    12791270        if (converted) {
     
    13101301        if (!conversionFailed.isEmpty()) {
    13111302            QString message = QString::fromLatin1("incompatible type of argument(s) in call to %0(); candidates were\n")
    1312                               .arg(QLatin1String(signature));
     1303                              .arg(QString::fromLatin1(signature));
    13131304            for (int i = 0; i < conversionFailed.size(); ++i) {
    13141305                if (i > 0)
    13151306                    message += QLatin1String("\n");
    13161307                QMetaMethod mtd = meta->method(conversionFailed.at(i));
    1317                 message += QString::fromLatin1("    %0").arg(QString::fromLatin1(mtd.signature()));
     1308                message += QString::fromLatin1("    %0").arg(QString::fromLatin1(mtd.methodSignature()));
    13181309            }
    13191310            *pError = throwError(exec, createTypeError(exec, message.toLatin1().constData()));
     
    13291320        } else {
    13301321            QString message = QString::fromLatin1("too few arguments in call to %0(); candidates are\n")
    1331                               .arg(QLatin1String(signature));
     1322                              .arg(QString::fromLatin1(signature));
    13321323            for (int i = 0; i < tooFewArgs.size(); ++i) {
    13331324                if (i > 0)
    13341325                    message += QLatin1String("\n");
    13351326                QMetaMethod mtd = meta->method(tooFewArgs.at(i));
    1336                 message += QString::fromLatin1("    %0").arg(QString::fromLatin1(mtd.signature()));
     1327                message += QString::fromLatin1("    %0").arg(QString::fromLatin1(mtd.methodSignature()));
    13371328            }
    13381329            *pError = throwError(exec, createSyntaxError(exec, message.toLatin1().constData()));
     
    13551346                        message += QLatin1String("\n");
    13561347                    QMetaMethod mtd = meta->method(candidates.at(i).index);
    1357                     message += QString::fromLatin1("    %0").arg(QString::fromLatin1(mtd.signature()));
     1348                    message += QString::fromLatin1("    %0").arg(QString::fromLatin1(mtd.methodSignature()));
    13581349                }
    13591350            }
     
    17681759}
    17691760
     1761// Begin moc-generated code -- modify with care! Check "HAND EDIT" parts
     1762struct qt_meta_stringdata_QtConnectionObject_t {
     1763    QByteArrayData data[3];
     1764    char stringdata[44];
     1765};
     1766#define QT_MOC_LITERAL(idx, ofs, len) { \
     1767    Q_REFCOUNT_INITIALIZE_STATIC, len, 0, 0, \
     1768    offsetof(qt_meta_stringdata_QtConnectionObject_t, stringdata) + ofs \
     1769        - idx * sizeof(QByteArrayData) \
     1770    }
     1771static const qt_meta_stringdata_QtConnectionObject_t qt_meta_stringdata_QtConnectionObject = {
     1772    {
     1773QT_MOC_LITERAL(0, 0, 33),
     1774QT_MOC_LITERAL(1, 34, 7),
     1775QT_MOC_LITERAL(2, 42, 0)
     1776    },
     1777    "JSC::Bindings::QtConnectionObject\0"
     1778    "execute\0\0"
     1779};
     1780#undef QT_MOC_LITERAL
     1781
    17701782static const uint qt_meta_data_QtConnectionObject[] = {
    17711783
    17721784 // content:
    1773        1,       // revision
     1785       7,       // revision
    17741786       0,       // classname
    17751787       0,    0, // classinfo
    1776        1,   10, // methods
     1788       1,   14, // methods
    17771789       0,    0, // properties
    17781790       0,    0, // enums/sets
    1779 
    1780  // slots: signature, parameters, type, tag, flags
    1781       28,   27,   27,   27, 0x0a,
     1791       0,    0, // constructors
     1792       0,       // flags
     1793       0,       // signalCount
     1794
     1795 // slots: name, argc, parameters, tag, flags
     1796       1,    0,   19,    2, 0x0a,
     1797
     1798 // slots: parameters
     1799    QMetaType::Void,
    17821800
    17831801       0        // eod
    17841802};
    17851803
    1786 static const char qt_meta_stringdata_QtConnectionObject[] = {
    1787     "JSC::Bindings::QtConnectionObject\0\0execute()\0"
     1804void QtConnectionObject::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
     1805{
     1806    if (_c == QMetaObject::InvokeMetaMethod) {
     1807        Q_ASSERT(staticMetaObject.cast(_o));
     1808        QtConnectionObject *_t = static_cast<QtConnectionObject *>(_o);
     1809        switch (_id) {
     1810        case 0: _t->execute(_a); break; // HAND EDIT: add _a parameter
     1811        default: ;
     1812        }
     1813    }
     1814}
     1815
     1816const QMetaObject QtConnectionObject::staticMetaObject = {
     1817    { &QObject::staticMetaObject, qt_meta_stringdata_QtConnectionObject.data,
     1818      qt_meta_data_QtConnectionObject, qt_static_metacall, 0, 0 }
    17881819};
    17891820
    1790 const QMetaObject QtConnectionObject::staticMetaObject = {
    1791     { &QObject::staticMetaObject, qt_meta_stringdata_QtConnectionObject,
    1792       qt_meta_data_QtConnectionObject, 0 }
    1793 };
    1794 
    17951821const QMetaObject *QtConnectionObject::metaObject() const
    17961822{
     
    18011827{
    18021828    if (!_clname) return 0;
    1803     if (!strcmp(_clname, qt_meta_stringdata_QtConnectionObject))
     1829    if (!strcmp(_clname, qt_meta_stringdata_QtConnectionObject.stringdata))
    18041830        return static_cast<void*>(const_cast<QtConnectionObject*>(this));
    18051831    return QObject::qt_metacast(_clname);
    18061832}
    18071833
    1808 // This is what moc would generate except by the fact that we pass all arguments to our execute() slot.
    18091834int QtConnectionObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
    18101835{
     
    18131838        return _id;
    18141839    if (_c == QMetaObject::InvokeMetaMethod) {
    1815         switch (_id) {
    1816         case 0: execute(_a); break;
    1817         }
     1840        if (_id < 1)
     1841            qt_static_metacall(this, _c, _id, _a);
    18181842        _id -= 1;
    18191843    }
    18201844    return _id;
    18211845}
     1846// End of moc-generated code
    18221847
    18231848static bool isJavaScriptFunction(JSObjectRef object)
     
    18411866    const QMetaMethod method = meta->method(m_signalIndex);
    18421867
    1843     QList<QByteArray> parameterTypes = method.parameterTypes();
    1844 
    18451868    JSValueRef* ignoredException = 0;
    18461869    JSRetainPtr<JSStringRef> lengthProperty(JSStringCreateWithUTF8CString("length"));
    18471870    int receiverLength = int(JSValueToNumber(m_context, JSObjectGetProperty(m_context, m_receiverFunction, lengthProperty.get(), ignoredException), ignoredException));
    1848     int argc = qMax(parameterTypes.count(), receiverLength);
     1871    int argc = qMax(method.parameterCount(), receiverLength);
    18491872    WTF::Vector<JSValueRef> args(argc);
    18501873
     
    18541877
    18551878    for (int i = 0; i < argc; i++) {
    1856         int argType = QMetaType::type(parameterTypes.at(i));
     1879        int argType = method.parameterType(i);
    18571880        args[i] = ::toRef(exec, convertQVariantToValue(exec, rootObject, QVariant(argType, argv[i+1])));
    18581881    }
  • trunk/Source/WebCore/bridge/qt/qt_runtime.h

    r103083 r116102  
    239239class QtConnectionObject : public QObject
    240240{
     241#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
     242    Q_OBJECT_FAKE
     243#endif
    241244public:
    242245    QtConnectionObject(JSContextRef, PassRefPtr<QtInstance> senderInstance, int signalIndex, JSObjectRef receiver, JSObjectRef receiverFunction);
    243246    ~QtConnectionObject();
    244247
     248#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    245249    // Explicitly define these because want a custom qt_metacall(), so we can't use Q_OBJECT macro.
    246250    static const QMetaObject staticMetaObject;
     
    248252    virtual void *qt_metacast(const char *);
    249253    virtual int qt_metacall(QMetaObject::Call, int, void **argv);
     254#endif
    250255
    251256    void execute(void **argv);
  • trunk/Source/WebKit2/ChangeLog

    r116101 r116102  
     12012-05-04  Kent Hansen <kent.hansen@nokia.com>
     2
     3        [Qt] Update Qt bridge after changes to QMetaMethod
     4        https://bugs.webkit.org/show_bug.cgi?id=85478
     5
     6        Reviewed by Tor Arne Vestbø.
     7
     8        QMetaMethod::signature() has been renamed to methodSignature() and
     9        returns a QByteArray.
     10
     11        The new function QMetaMethod::name() gives direct access to a
     12        method's name. returnType(), parameterCount(), and parameterType()
     13        give direct access to type information.
     14
     15        Ported the custom QtConnectionObject meta-object to revision 7;
     16        revision 6 and below aren't supported (and don't compile) with Qt5.
     17
     18        * UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:
     19        (gatherAPI):
     20
    1212012-05-04  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
    222
  • trunk/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp

    r115862 r116102  
    142142    if (method.access() != QMetaMethod::Private) {
    143143        const char* methodTypeName = !!strlen(method.typeName()) ? method.typeName() : "void";
     144#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
     145        *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(QString::fromLatin1(method.methodSignature())).arg(QString::fromLatin1(methodTypeName));
     146#else
    144147        *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(method.signature()).arg(methodTypeName);
     148#endif
    145149
    146150        checkKnownType(methodTypeName);
Note: See TracChangeset for help on using the changeset viewer.