| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/debugger/qqmldebugservice.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | class QQmlDebugServer; | - | ||||||
| 6 | - | |||||||
| 7 | class QQmlDebugServicePrivate : public QObjectPrivate | - | ||||||
| 8 | { | - | ||||||
| 9 | inline QQmlDebugService* q_func() { return static_cast<QQmlDebugService *>(q_ptr); } inline const QQmlDebugService* q_func() const { return static_cast<const QQmlDebugService *>(q_ptr); } friend class QQmlDebugService; | - | ||||||
| 10 | public: | - | ||||||
| 11 | QQmlDebugServicePrivate(const QString &name, float version); | - | ||||||
| 12 | - | |||||||
| 13 | const QString name; | - | ||||||
| 14 | const float version; | - | ||||||
| 15 | QQmlDebugService::State state; | - | ||||||
| 16 | }; | - | ||||||
| 17 | - | |||||||
| 18 | QQmlDebugServicePrivate::QQmlDebugServicePrivate(const QString &name, float version) : | - | ||||||
| 19 | name(name), version(version), state(QQmlDebugService::NotConnected) | - | ||||||
| 20 | { | - | ||||||
| 21 | } executed 158 times by 7 tests: end of blockExecuted by:
| 158 | ||||||
| 22 | - | |||||||
| 23 | QQmlDebugService::QQmlDebugService(const QString &name, float version, QObject *parent) | - | ||||||
| 24 | : QObject(*(new QQmlDebugServicePrivate(name, version)), parent) | - | ||||||
| 25 | { | - | ||||||
| 26 | QQmlDebugServicePrivate * const d = d_func(); | - | ||||||
| 27 | QQmlDebugConnector *server = QQmlDebugConnector::instance(); | - | ||||||
| 28 | - | |||||||
| 29 | if (!server
| 0-158 | ||||||
| 30 | return; never executed: return; | 0 | ||||||
| 31 | - | |||||||
| 32 | if (server->service(d->name)
| 4-154 | ||||||
| 33 | QMessageLogger(__FILE__, 79, __PRETTY_FUNCTION__).warning() << "QQmlDebugService: Conflicting plugin name" << d->name; | - | ||||||
| 34 | } executed 4 times by 1 test: else {end of blockExecuted by:
| 4 | ||||||
| 35 | server->addService(d->name, this); | - | ||||||
| 36 | } executed 154 times by 7 tests: end of blockExecuted by:
| 154 | ||||||
| 37 | } | - | ||||||
| 38 | - | |||||||
| 39 | QQmlDebugService::~QQmlDebugService() | - | ||||||
| 40 | { | - | ||||||
| 41 | QQmlDebugServicePrivate * const d = d_func(); | - | ||||||
| 42 | QQmlDebugConnector *server = QQmlDebugConnector::instance(); | - | ||||||
| 43 | - | |||||||
| 44 | if (!server
| 0-152 | ||||||
| 45 | return; never executed: return; | 0 | ||||||
| 46 | - | |||||||
| 47 | if (server->service(d->name) != this
| 4-148 | ||||||
| 48 | QMessageLogger(__FILE__, 94, __PRETTY_FUNCTION__).warning() << "QQmlDebugService: Plugin" << d->name << "is not registered."; executed 4 times by 1 test: QMessageLogger(__FILE__, 94, __PRETTY_FUNCTION__).warning() << "QQmlDebugService: Plugin" << d->name << "is not registered.";Executed by:
| 4 | ||||||
| 49 | else | - | ||||||
| 50 | server->removeService(d->name); executed 148 times by 5 tests: server->removeService(d->name);Executed by:
| 148 | ||||||
| 51 | } | - | ||||||
| 52 | - | |||||||
| 53 | const QString &QQmlDebugService::name() const | - | ||||||
| 54 | { | - | ||||||
| 55 | const QQmlDebugServicePrivate * const d = d_func(); | - | ||||||
| 56 | return executed 732 times by 7 tests: d->name;return d->name;Executed by:
executed 732 times by 7 tests: return d->name;Executed by:
| 732 | ||||||
| 57 | } | - | ||||||
| 58 | - | |||||||
| 59 | float QQmlDebugService::version() const | - | ||||||
| 60 | { | - | ||||||
| 61 | const QQmlDebugServicePrivate * const d = d_func(); | - | ||||||
| 62 | return executed 158 times by 6 tests: d->version;return d->version;Executed by:
executed 158 times by 6 tests: return d->version;Executed by:
| 158 | ||||||
| 63 | } | - | ||||||
| 64 | - | |||||||
| 65 | QQmlDebugService::State QQmlDebugService::state() const | - | ||||||
| 66 | { | - | ||||||
| 67 | const QQmlDebugServicePrivate * const d = d_func(); | - | ||||||
| 68 | return executed 836 times by 7 tests: d->state;return d->state;Executed by:
executed 836 times by 7 tests: return d->state;Executed by:
| 836 | ||||||
| 69 | } | - | ||||||
| 70 | - | |||||||
| 71 | void QQmlDebugService::setState(QQmlDebugService::State newState) | - | ||||||
| 72 | { | - | ||||||
| 73 | QQmlDebugServicePrivate * const d = d_func(); | - | ||||||
| 74 | d->state = newState; | - | ||||||
| 75 | } executed 688 times by 7 tests: end of blockExecuted by:
| 688 | ||||||
| 76 | - | |||||||
| 77 | namespace { | - | ||||||
| 78 | class ObjectReferenceHash : public QObject | - | ||||||
| 79 | { | - | ||||||
| 80 | public: | - | ||||||
| 81 | #pragma GCC diagnostic push | - | ||||||
| 82 | - | |||||||
| 83 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||
| 84 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||
| 85 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||
| 86 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||
| 87 | #pragma GCC diagnostic pop | - | ||||||
| 88 | struct QPrivateSignal {}; | - | ||||||
| 89 | public: | - | ||||||
| 90 | ObjectReferenceHash() : nextId(0) {} executed 28 times by 5 tests: end of blockExecuted by:
| 28 | ||||||
| 91 | - | |||||||
| 92 | QHash<QObject *, int> objects; | - | ||||||
| 93 | QHash<int, QObject *> ids; | - | ||||||
| 94 | - | |||||||
| 95 | int nextId; | - | ||||||
| 96 | - | |||||||
| 97 | void remove(QObject *obj); | - | ||||||
| 98 | }; | - | ||||||
| 99 | } | - | ||||||
| 100 | namespace { namespace Q_QGS_objectReferenceHash { typedef ObjectReferenceHash Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 28 times by 5 tests: }guard.store(QtGlobalStatic::Destroyed);Executed by:
executed 28 times by 5 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of blockExecuted by:
executed 6804 times by 5 tests: &holder.value;return &holder.value;Executed by:
executed 6804 times by 5 tests: } } } static QGlobalStatic<ObjectReferenceHash, Q_QGS_objectReferenceHash::innerFunction, Q_QGS_objectReferenceHash::guard> objectReferenceHash;return &holder.value;Executed by:
| 0-6804 | ||||||
| 101 | - | |||||||
| 102 | void ObjectReferenceHash::remove(QObject *obj) | - | ||||||
| 103 | { | - | ||||||
| 104 | QHash<QObject *, int>::Iterator iter = objects.find(obj); | - | ||||||
| 105 | if (iter != objects.end()
| 0-106 | ||||||
| 106 | ids.remove(iter.value()); | - | ||||||
| 107 | objects.erase(iter); | - | ||||||
| 108 | } executed 106 times by 5 tests: end of blockExecuted by:
| 106 | ||||||
| 109 | } executed 106 times by 5 tests: end of blockExecuted by:
| 106 | ||||||
| 110 | - | |||||||
| 111 | - | |||||||
| 112 | - | |||||||
| 113 | - | |||||||
| 114 | - | |||||||
| 115 | int QQmlDebugService::idForObject(QObject *object) | - | ||||||
| 116 | { | - | ||||||
| 117 | if (!object
| 840-6436 | ||||||
| 118 | return executed 840 times by 3 tests: -1;return -1;Executed by:
executed 840 times by 3 tests: return -1;Executed by:
| 840 | ||||||
| 119 | - | |||||||
| 120 | ObjectReferenceHash *hash = objectReferenceHash(); | - | ||||||
| 121 | QHash<QObject *, int>::Iterator iter = hash->objects.find(object); | - | ||||||
| 122 | - | |||||||
| 123 | if (iter == hash->objects.end()
| 124-6312 | ||||||
| 124 | int id = hash->nextId++; | - | ||||||
| 125 | hash->ids.insert(id, object); | - | ||||||
| 126 | iter = hash->objects.insert(object, id); | - | ||||||
| 127 | connect(object, &QObject::destroyed, hash, &ObjectReferenceHash::remove); | - | ||||||
| 128 | } executed 124 times by 5 tests: end of blockExecuted by:
| 124 | ||||||
| 129 | return executed 6436 times by 5 tests: iter.value();return iter.value();Executed by:
executed 6436 times by 5 tests: return iter.value();Executed by:
| 6436 | ||||||
| 130 | } | - | ||||||
| 131 | - | |||||||
| 132 | - | |||||||
| 133 | - | |||||||
| 134 | - | |||||||
| 135 | const QHash<int, QObject *> &QQmlDebugService::objectsForIds() | - | ||||||
| 136 | { | - | ||||||
| 137 | return executed 368 times by 4 tests: objectReferenceHash()->ids;return objectReferenceHash()->ids;Executed by:
executed 368 times by 4 tests: return objectReferenceHash()->ids;Executed by:
| 368 | ||||||
| 138 | } | - | ||||||
| 139 | - | |||||||
| 140 | - | |||||||
| 141 | - | |||||||
| Switch to Source code | Preprocessed file |