| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | - | |||||||
| 6 | - | |||||||
| 7 | - | |||||||
| 8 | - | |||||||
| 9 | - | |||||||
| 10 | - | |||||||
| 11 | - | |||||||
| 12 | namespace { namespace Q_QGS_qAccessibleCache { typedef QAccessibleCache Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized 
 never executed: } guard.store(QtGlobalStatic::Destroyed);never executed: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return end of blocknever executed: &holder.value; return &holder.value;never executed: } } } static QGlobalStatic<QAccessibleCache, Q_QGS_qAccessibleCache::innerFunction, Q_QGS_qAccessibleCache::guard> qAccessibleCache; return &holder.value; | 0 | ||||||
| 13 | - | |||||||
| 14 | QAccessibleCache *QAccessibleCache::instance() | - | ||||||
| 15 | { | - | ||||||
| 16 | return never executed: qAccessibleCache; return qAccessibleCache;never executed:  return qAccessibleCache; | 0 | ||||||
| 17 | } | - | ||||||
| 18 | - | |||||||
| 19 | - | |||||||
| 20 | - | |||||||
| 21 | - | |||||||
| 22 | - | |||||||
| 23 | - | |||||||
| 24 | QAccessible::Id QAccessibleCache::acquireId() const | - | ||||||
| 25 | { | - | ||||||
| 26 | static const QAccessible::Id FirstId = QAccessible::Id(2147483647) + 1; | - | ||||||
| 27 | static QAccessible::Id lastUsedId = FirstId; | - | ||||||
| 28 | - | |||||||
| 29 | while (idToInterface.contains(lastUsedId) 
 | 0 | ||||||
| 30 | - | |||||||
| 31 | - | |||||||
| 32 | if (lastUsedId == (2147483647 * 2U + 1U) - 1 
 | 0 | ||||||
| 33 | lastUsedId = FirstId; never executed:  lastUsedId = FirstId; | 0 | ||||||
| 34 | else | - | ||||||
| 35 | ++ never executed: lastUsedId; ++lastUsedId;never executed:  ++lastUsedId; | 0 | ||||||
| 36 | } | - | ||||||
| 37 | - | |||||||
| 38 | return never executed: lastUsedId; return lastUsedId;never executed:  return lastUsedId; | 0 | ||||||
| 39 | } | - | ||||||
| 40 | - | |||||||
| 41 | QAccessibleInterface *QAccessibleCache::interfaceForId(QAccessible::Id id) const | - | ||||||
| 42 | { | - | ||||||
| 43 | return never executed: idToInterface.value(id); return idToInterface.value(id);never executed:  return idToInterface.value(id); | 0 | ||||||
| 44 | } | - | ||||||
| 45 | - | |||||||
| 46 | QAccessible::Id QAccessibleCache::idForInterface(QAccessibleInterface *iface) const | - | ||||||
| 47 | { | - | ||||||
| 48 | return never executed: interfaceToId.value(iface); return interfaceToId.value(iface);never executed:  return interfaceToId.value(iface); | 0 | ||||||
| 49 | } | - | ||||||
| 50 | - | |||||||
| 51 | QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface *iface) const | - | ||||||
| 52 | { | - | ||||||
| 53 | ((!(iface)) ? qt_assert("iface",__FILE__,93) : qt_noop()); | - | ||||||
| 54 | (void)object; | - | ||||||
| 55 | - | |||||||
| 56 | - | |||||||
| 57 | ((!(!objectToId.contains(object))) ? qt_assert("!objectToId.contains(object)",__FILE__,97) : qt_noop()); | - | ||||||
| 58 | ((!(!interfaceToId.contains(iface))) ? qt_assert_x("", "Accessible interface inserted into cache twice!",__FILE__,98) : qt_noop()); | - | ||||||
| 59 | - | |||||||
| 60 | QAccessible::Id id = acquireId(); | - | ||||||
| 61 | QObject *obj = iface->object(); | - | ||||||
| 62 | ((!(object == obj)) ? qt_assert("object == obj",__FILE__,102) : qt_noop()); | - | ||||||
| 63 | if (obj 
 | 0 | ||||||
| 64 | objectToId.insert(obj, id); | - | ||||||
| 65 | connect(obj, &QObject::destroyed, this, &QAccessibleCache::objectDestroyed); | - | ||||||
| 66 | } never executed:  end of block | 0 | ||||||
| 67 | idToInterface.insert(id, iface); | - | ||||||
| 68 | interfaceToId.insert(iface, id); | - | ||||||
| 69 | return never executed: id; return id;never executed:  return id; | 0 | ||||||
| 70 | } | - | ||||||
| 71 | - | |||||||
| 72 | void QAccessibleCache::objectDestroyed(QObject* obj) | - | ||||||
| 73 | { | - | ||||||
| 74 | QAccessible::Id id = objectToId.value(obj); | - | ||||||
| 75 | if (id 
 | 0 | ||||||
| 76 | ((!(idToInterface.contains(id))) ? qt_assert_x("", "QObject with accessible interface deleted, where interface not in cache!",__FILE__,116) : qt_noop()); | - | ||||||
| 77 | deleteInterface(id, obj); | - | ||||||
| 78 | } never executed:  end of block | 0 | ||||||
| 79 | } never executed:  end of block | 0 | ||||||
| 80 | - | |||||||
| 81 | void QAccessibleCache::deleteInterface(QAccessible::Id id, QObject *obj) | - | ||||||
| 82 | { | - | ||||||
| 83 | QAccessibleInterface *iface = idToInterface.take(id); | - | ||||||
| 84 | interfaceToId.take(iface); | - | ||||||
| 85 | if (!obj 
 | 0 | ||||||
| 86 | obj = iface->object(); never executed:  obj = iface->object(); | 0 | ||||||
| 87 | if (obj 
 | 0 | ||||||
| 88 | objectToId.remove(obj); never executed:  objectToId.remove(obj); | 0 | ||||||
| 89 | delete iface; | - | ||||||
| 90 | - | |||||||
| 91 | - | |||||||
| 92 | - | |||||||
| 93 | - | |||||||
| 94 | } never executed:  end of block | 0 | ||||||
| 95 | - | |||||||
| 96 | - | |||||||
| Switch to Source code | Preprocessed file |