Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/kernel/qabstracteventdispatcher.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | - | |||||||
6 | struct QtTimerIdFreeListConstants : public QFreeListDefaultConstants | - | ||||||
7 | { | - | ||||||
8 | enum | - | ||||||
9 | { | - | ||||||
10 | InitialNextValue = 1, | - | ||||||
11 | BlockCount = 6 | - | ||||||
12 | }; | - | ||||||
13 | - | |||||||
14 | static const int Sizes[BlockCount]; | - | ||||||
15 | }; | - | ||||||
16 | - | |||||||
17 | enum { | - | ||||||
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 | - | |||||||
33 | const int QtTimerIdFreeListConstants::Sizes[QtTimerIdFreeListConstants::BlockCount] = { | - | ||||||
34 | Size0, | - | ||||||
35 | Size1, | - | ||||||
36 | Size2, | - | ||||||
37 | Size3, | - | ||||||
38 | Size4, | - | ||||||
39 | Size5 | - | ||||||
40 | }; | - | ||||||
41 | - | |||||||
42 | typedef QFreeList<void, QtTimerIdFreeListConstants> QtTimerIdFreeList; | - | ||||||
43 | namespace { namespace Q_QGS_timerIdFreeList { typedef QtTimerIdFreeList Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QtTimerIdFreeList, Q_QGS_timerIdFreeList::innerFunction, Q_QGS_timerIdFreeList::guard> timerIdFreeList; | - | ||||||
44 | - | |||||||
45 | int QAbstractEventDispatcherPrivate::allocateTimerId() | - | ||||||
46 | { | - | ||||||
47 | return timerIdFreeList()->next(); | - | ||||||
48 | } | - | ||||||
49 | - | |||||||
50 | void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId) | - | ||||||
51 | { | - | ||||||
52 | - | |||||||
53 | - | |||||||
54 | if (QtTimerIdFreeList *fl = timerIdFreeList()) | - | ||||||
55 | fl->release(timerId); | - | ||||||
56 | } | - | ||||||
57 | QAbstractEventDispatcher::QAbstractEventDispatcher(QObject *parent) | - | ||||||
58 | : QObject(*new QAbstractEventDispatcherPrivate, parent) {} | - | ||||||
59 | - | |||||||
60 | - | |||||||
61 | - | |||||||
62 | - | |||||||
63 | QAbstractEventDispatcher::QAbstractEventDispatcher(QAbstractEventDispatcherPrivate &dd, | - | ||||||
64 | QObject *parent) | - | ||||||
65 | : QObject(dd, parent) {} | - | ||||||
66 | - | |||||||
67 | - | |||||||
68 | - | |||||||
69 | - | |||||||
70 | QAbstractEventDispatcher::~QAbstractEventDispatcher() | - | ||||||
71 | { } | - | ||||||
72 | QAbstractEventDispatcher *QAbstractEventDispatcher::instance(QThread *thread) | - | ||||||
73 | { | - | ||||||
74 | QThreadData *data = thread ? QThreadData::get2(thread) : QThreadData::current(); | - | ||||||
75 | return data->eventDispatcher.load(); | - | ||||||
76 | } | - | ||||||
77 | int QAbstractEventDispatcher::registerTimer(int interval, Qt::TimerType timerType, QObject *object) | - | ||||||
78 | { | - | ||||||
79 | int id = QAbstractEventDispatcherPrivate::allocateTimerId(); | - | ||||||
80 | registerTimer(id, interval, timerType, object); | - | ||||||
81 | return id; | - | ||||||
82 | } | - | ||||||
83 | void QAbstractEventDispatcher::startingUp() | - | ||||||
84 | { } | - | ||||||
85 | - | |||||||
86 | - | |||||||
87 | - | |||||||
88 | - | |||||||
89 | void QAbstractEventDispatcher::closingDown() | - | ||||||
90 | { } | - | ||||||
91 | void 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 | } | - | ||||||
100 | void QAbstractEventDispatcher::removeNativeEventFilter(QAbstractNativeEventFilter *filter) | - | ||||||
101 | { | - | ||||||
102 | QAbstractEventDispatcherPrivate * const d = d_func(); | - | ||||||
103 | for (int i = 0; i < d->eventFilters.count(); ++i) { | - | ||||||
104 | if (d->eventFilters.at(i) == filter) { | - | ||||||
105 | d->eventFilters[i] = 0; | - | ||||||
106 | break; | - | ||||||
107 | } | - | ||||||
108 | } | - | ||||||
109 | } | - | ||||||
110 | bool QAbstractEventDispatcher::filterNativeEvent(const QByteArray &eventType, void *message, long *result) | - | ||||||
111 | { | - | ||||||
112 | QAbstractEventDispatcherPrivate * const d = d_func(); | - | ||||||
113 | if (!d->eventFilters.isEmpty()
| 242174-2647856 | ||||||
114 | - | |||||||
115 | - | |||||||
116 | QScopedLoopLevelCounter loopLevelCounterQScopedScopeLevelCounter scopeLevelCounter(d->threadData); | - | ||||||
117 | for (int i = 0; i < d->eventFilters.size()
| 2647856 | ||||||
118 | QAbstractNativeEventFilter *filter = d->eventFilters.at(i); | - | ||||||
119 | if (!filter
| 6612-2641244 | ||||||
120 | continue; executed 6612 times by 1 test: continue; Executed by:
| 6612 | ||||||
121 | if (filter->nativeEventFilter(eventType, message, result)
| 0-2641244 | ||||||
122 | return never executed: true;return true; never executed: return true; | 0 | ||||||
123 | } executed 2641244 times by 2 tests: end of block Executed by:
| 2641244 | ||||||
124 | } executed 2647856 times by 2 tests: end of block Executed by:
| 2647856 | ||||||
125 | return executed 2890030 times by 114 tests: false;return false; Executed by:
executed 2890030 times by 114 tests: return false; Executed by:
| 2890030 | ||||||
126 | } | - | ||||||
127 | - | |||||||
Switch to Source code | Preprocessed file |