OpenCoverage

qaccessiblecache.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12namespace { 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
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
never executed: guard.store(QtGlobalStatic::Destroyed);
}
never executed: end of block
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<QAccessibleCache, Q_QGS_qAccessibleCache::innerFunction, Q_QGS_qAccessibleCache::guard> qAccessibleCache;
0
13-
14QAccessibleCache *QAccessibleCache::instance()-
15{-
16 return
never executed: return qAccessibleCache;
qAccessibleCache;
never executed: return qAccessibleCache;
0
17}-
18-
19-
20-
21-
22-
23-
24QAccessible::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)
idToInterface....ns(lastUsedId)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
30-
31-
32 if (lastUsedId == (2147483647 * 2U + 1U) - 1
lastUsedId == ...* 2U + 1U) - 1Description
TRUEnever evaluated
FALSEnever evaluated
)
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: return lastUsedId;
lastUsedId;
never executed: return lastUsedId;
0
39}-
40-
41QAccessibleInterface *QAccessibleCache::interfaceForId(QAccessible::Id id) const-
42{-
43 return
never executed: return idToInterface.value(id);
idToInterface.value(id);
never executed: return idToInterface.value(id);
0
44}-
45-
46QAccessible::Id QAccessibleCache::idForInterface(QAccessibleInterface *iface) const-
47{-
48 return
never executed: return interfaceToId.value(iface);
interfaceToId.value(iface);
never executed: return interfaceToId.value(iface);
0
49}-
50-
51QAccessible::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
objDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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: return id;
id;
never executed: return id;
0
70}-
71-
72void QAccessibleCache::objectDestroyed(QObject* obj)-
73{-
74 QAccessible::Id id = objectToId.value(obj);-
75 if (id
idDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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-
81void QAccessibleCache::deleteInterface(QAccessible::Id id, QObject *obj)-
82{-
83 QAccessibleInterface *iface = idToInterface.take(id);-
84 interfaceToId.take(iface);-
85 if (!obj
!objDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
86 obj = iface->object();
never executed: obj = iface->object();
0
87 if (obj
objDescription
TRUEnever evaluated
FALSEnever evaluated
)
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 codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9