kernel/qabstracteventdispatcher.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6struct QtTimerIdFreeListConstants : public QFreeListDefaultConstants -
7{ -
8 enum -
9 { -
10 InitialNextValue = 1, -
11 BlockCount = 6 -
12 }; -
13 -
14 static const int Sizes[BlockCount]; -
15}; -
16 -
17enum { -
18 Offset0 = 0x00000000, -
19 Offset1 = 0x00000040, -
20 Offset2 = 0x00000100, -
21 Offset3 = 0x00001000, -
22 Offset4 = 0x00010000, -
23 Offset5 = 0x00100000, -
24 -
25 Size0 = Offset1 - Offset0, -
26 Size1 = Offset2 - Offset1, -
27 Size2 = Offset3 - Offset2, -
28 Size3 = Offset4 - Offset3, -
29 Size4 = Offset5 - Offset4, -
30 Size5 = QtTimerIdFreeListConstants::MaxIndex - Offset5 -
31}; -
32 -
33const int QtTimerIdFreeListConstants::Sizes[QtTimerIdFreeListConstants::BlockCount] = { -
34 Size0, -
35 Size1, -
36 Size2, -
37 Size3, -
38 Size4, -
39 Size5 -
40}; -
41 -
42typedef QFreeList<void, QtTimerIdFreeListConstants> QtTimerIdFreeList; -
43static QtTimerIdFreeList *timerIdFreeList() { static QGlobalStatic<QtTimerIdFreeList > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QtTimerIdFreeList *x = new QtTimerIdFreeList; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QtTimerIdFreeList > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:263347
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:42
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:263305
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:42
no
Evaluation Count:0
0-263347
44 -
45int QAbstractEventDispatcherPrivate::allocateTimerId() -
46{ -
47 return timerIdFreeList()->next();
executed: return timerIdFreeList()->next();
Execution Count:132414
132414
48} -
49 -
50void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId) -
51{ -
52 -
53 -
54 if (QtTimerIdFreeList *fl = timerIdFreeList())
partially evaluated: QtTimerIdFreeList *fl = timerIdFreeList()
TRUEFALSE
yes
Evaluation Count:130933
no
Evaluation Count:0
0-130933
55 fl->release(timerId);
executed: fl->release(timerId);
Execution Count:130933
130933
56}
executed: }
Execution Count:130933
130933
57QAbstractEventDispatcher::QAbstractEventDispatcher(QObject *parent) -
58 : QObject(*new QAbstractEventDispatcherPrivate, parent) {}
executed: }
Execution Count:2
2
59 -
60 -
61 -
62 -
63QAbstractEventDispatcher::QAbstractEventDispatcher(QAbstractEventDispatcherPrivate &dd, -
64 QObject *parent) -
65 : QObject(dd, parent) {}
executed: }
Execution Count:1717500
1717500
66 -
67 -
68 -
69 -
70QAbstractEventDispatcher::~QAbstractEventDispatcher() -
71{ } -
72QAbstractEventDispatcher *QAbstractEventDispatcher::instance(QThread *thread) -
73{ -
74 QThreadData *data = thread ? QThreadData::get2(thread) : QThreadData::current();
evaluated: thread
TRUEFALSE
yes
Evaluation Count:136
yes
Evaluation Count:286304
136-286304
75 return data->eventDispatcher;
executed: return data->eventDispatcher;
Execution Count:286440
286440
76} -
77int QAbstractEventDispatcher::registerTimer(int interval, Qt::TimerType timerType, QObject *object) -
78{ -
79 int id = QAbstractEventDispatcherPrivate::allocateTimerId(); -
80 registerTimer(id, interval, timerType, object); -
81 return id;
executed: return id;
Execution Count:132414
132414
82} -
83void QAbstractEventDispatcher::startingUp() -
84{ } -
85 -
86 -
87 -
88 -
89void QAbstractEventDispatcher::closingDown() -
90{ } -
91void QAbstractEventDispatcher::installNativeEventFilter(QAbstractNativeEventFilter *filterObj) -
92{ -
93 QAbstractEventDispatcherPrivate * const d = d_func(); -
94 -
95 -
96 d->eventFilters.removeAll(0); -
97 d->eventFilters.removeAll(filterObj); -
98 d->eventFilters.prepend(filterObj); -
99}
executed: }
Execution Count:1
1
100void QAbstractEventDispatcher::removeNativeEventFilter(QAbstractNativeEventFilter *filter) -
101{ -
102 QAbstractEventDispatcherPrivate * const d = d_func(); -
103 for (int i = 0; i < d->eventFilters.count(); ++i) {
partially evaluated: i < d->eventFilters.count()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
104 if (d->eventFilters.at(i) == filter) {
partially evaluated: d->eventFilters.at(i) == filter
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
105 d->eventFilters[i] = 0; -
106 break;
executed: break;
Execution Count:1
1
107 } -
108 }
never executed: }
0
109}
executed: }
Execution Count:1
1
110bool QAbstractEventDispatcher::filterNativeEvent(const QByteArray &eventType, void *message, long *result) -
111{ -
112 QAbstractEventDispatcherPrivate * const d = d_func(); -
113 if (!d->eventFilters.isEmpty()) {
evaluated: !d->eventFilters.isEmpty()
TRUEFALSE
yes
Evaluation Count:5072
yes
Evaluation Count:143523
5072-143523
114 -
115 -
116 QScopedLoopLevelCounter loopLevelCounter(d->threadData); -
117 for (int i = 0; i < d->eventFilters.size(); ++i) {
evaluated: i < d->eventFilters.size()
TRUEFALSE
yes
Evaluation Count:5072
yes
Evaluation Count:5072
5072
118 QAbstractNativeEventFilter *filter = d->eventFilters.at(i); -
119 if (!filter)
evaluated: !filter
TRUEFALSE
yes
Evaluation Count:4974
yes
Evaluation Count:98
98-4974
120 continue;
executed: continue;
Execution Count:4974
4974
121 if (filter->nativeEventFilter(eventType, message, result))
partially evaluated: filter->nativeEventFilter(eventType, message, result)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:98
0-98
122 return true;
never executed: return true;
0
123 }
executed: }
Execution Count:98
98
124 }
executed: }
Execution Count:5072
5072
125 return false;
executed: return false;
Execution Count:148595
148595
126} -
127 -
128 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial