qabstracteventdispatcher.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/kernel/qabstracteventdispatcher.cpp
Switch to Source codePreprocessed file
LineSourceCount
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;-
43namespace { 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-
45int QAbstractEventDispatcherPrivate::allocateTimerId()-
46{-
47 return timerIdFreeList()->next();-
48}-
49-
50void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId)-
51{-
52-
53-
54 if (QtTimerIdFreeList *fl = timerIdFreeList())-
55 fl->release(timerId);-
56}-
57QAbstractEventDispatcher::QAbstractEventDispatcher(QObject *parent)-
58 : QObject(*new QAbstractEventDispatcherPrivate, parent) {}-
59-
60-
61-
62-
63QAbstractEventDispatcher::QAbstractEventDispatcher(QAbstractEventDispatcherPrivate &dd,-
64 QObject *parent)-
65 : QObject(dd, parent) {}-
66-
67-
68-
69-
70QAbstractEventDispatcher::~QAbstractEventDispatcher()-
71{ }-
72QAbstractEventDispatcher *QAbstractEventDispatcher::instance(QThread *thread)-
73{-
74 QThreadData *data = thread ? QThreadData::get2(thread) : QThreadData::current();-
75 return data->eventDispatcher.load();-
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;-
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}-
100void 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}-
110bool QAbstractEventDispatcher::filterNativeEvent(const QByteArray &eventType, void *message, long *result)-
111{-
112 QAbstractEventDispatcherPrivate * const d = d_func();-
113 if (!d->eventFilters.isEmpty()
!d->eventFilters.isEmpty()Description
TRUEevaluated 2647856 times by 2 tests
Evaluated by:
  • tst_QWidget
  • tst_selftests - unknown status
FALSEevaluated 242174 times by 113 tests
Evaluated by:
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QClipboard
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDesktopWidget
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • ...
) {
242174-2647856
114-
115-
116 QScopedLoopLevelCounter loopLevelCounterQScopedScopeLevelCounter scopeLevelCounter(d->threadData);-
117 for (int i = 0; i < d->eventFilters.size()
i < d->eventFilters.size()Description
TRUEevaluated 2647856 times by 2 tests
Evaluated by:
  • tst_QWidget
  • tst_selftests - unknown status
FALSEevaluated 2647856 times by 2 tests
Evaluated by:
  • tst_QWidget
  • tst_selftests - unknown status
; ++i) {
2647856
118 QAbstractNativeEventFilter *filter = d->eventFilters.at(i);-
119 if (!filter
!filterDescription
TRUEevaluated 6612 times by 1 test
Evaluated by:
  • tst_QWidget
FALSEevaluated 2641244 times by 2 tests
Evaluated by:
  • tst_QWidget
  • tst_selftests - unknown status
)
6612-2641244
120 continue;
executed 6612 times by 1 test: continue;
Executed by:
  • tst_QWidget
6612
121 if (filter->nativeEventFilter(eventType, message, result)
filter->native...ssage, result)Description
TRUEnever evaluated
FALSEevaluated 2641244 times by 2 tests
Evaluated by:
  • tst_QWidget
  • tst_selftests - unknown status
)
0-2641244
122 return
never executed: return true;
true;
never executed: return true;
0
123 }
executed 2641244 times by 2 tests: end of block
Executed by:
  • tst_QWidget
  • tst_selftests - unknown status
2641244
124 }
executed 2647856 times by 2 tests: end of block
Executed by:
  • tst_QWidget
  • tst_selftests - unknown status
2647856
125 return
executed 2890030 times by 114 tests: return false;
Executed by:
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QClipboard
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDesktopWidget
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • ...
false;
executed 2890030 times by 114 tests: return false;
Executed by:
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QClipboard
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDesktopWidget
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • ...
2890030
126}-
127-
Switch to Source codePreprocessed file

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