Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | struct GPollFDWithQSocketNotifier | - |
9 | { | - |
10 | GPollFD pollfd; | - |
11 | QSocketNotifier *socketNotifier; | - |
12 | }; | - |
13 | | - |
14 | struct GSocketNotifierSource | - |
15 | { | - |
16 | GSource source; | - |
17 | QList<GPollFDWithQSocketNotifier *> pollfds; | - |
18 | }; | - |
19 | | - |
20 | static gboolean socketNotifierSourcePrepare(GSource *, gint *timeout) | - |
21 | { | - |
22 | if (timeout) partially evaluated: timeout yes Evaluation Count:630163 | no Evaluation Count:0 |
| 0-630163 |
23 | *timeout = -1; executed: *timeout = -1; Execution Count:630153 | 630153 |
24 | return false; executed: return false; Execution Count:630198 | 630198 |
25 | } | - |
26 | | - |
27 | static gboolean socketNotifierSourceCheck(GSource *source) | - |
28 | { | - |
29 | GSocketNotifierSource *src = reinterpret_cast<GSocketNotifierSource *>(source); | - |
30 | | - |
31 | bool pending = false; | - |
32 | for (int i = 0; !pending && i < src->pollfds.count(); ++i) { evaluated: !pending yes Evaluation Count:1278890 | yes Evaluation Count:19761 |
evaluated: i < src->pollfds.count() yes Evaluation Count:668429 | yes Evaluation Count:610462 |
| 19761-1278890 |
33 | GPollFDWithQSocketNotifier *p = src->pollfds.at(i); | - |
34 | | - |
35 | if (p->pollfd.revents & G_IO_NVAL) { partially evaluated: p->pollfd.revents & G_IO_NVAL no Evaluation Count:0 | yes Evaluation Count:668425 |
| 0-668425 |
36 | | - |
37 | static const char *t[] = { "Read", "Write", "Exception" }; | - |
38 | QMessageLogger("kernel/qeventdispatcher_glib.cpp", 88, __PRETTY_FUNCTION__).warning("QSocketNotifier: Invalid socket %d and type '%s', disabling...", | - |
39 | p->pollfd.fd, t[int(p->socketNotifier->type())]); | - |
40 | | - |
41 | p->socketNotifier->setEnabled(false); | - |
42 | } | 0 |
43 | | - |
44 | pending = ((p->pollfd.revents & p->pollfd.events) != 0); | - |
45 | } executed: } Execution Count:668424 | 668424 |
46 | | - |
47 | return pending; executed: return pending; Execution Count:630247 | 630247 |
48 | } | - |
49 | | - |
50 | static gboolean socketNotifierSourceDispatch(GSource *source, GSourceFunc, gpointer) | - |
51 | { | - |
52 | QEvent event(QEvent::SockAct); | - |
53 | | - |
54 | GSocketNotifierSource *src = reinterpret_cast<GSocketNotifierSource *>(source); | - |
55 | for (int i = 0; i < src->pollfds.count(); ++i) { evaluated: i < src->pollfds.count() yes Evaluation Count:49641 | yes Evaluation Count:19762 |
| 19762-49641 |
56 | GPollFDWithQSocketNotifier *p = src->pollfds.at(i); | - |
57 | | - |
58 | if ((p->pollfd.revents & p->pollfd.events) != 0) evaluated: (p->pollfd.revents & p->pollfd.events) != 0 yes Evaluation Count:20164 | yes Evaluation Count:29477 |
| 20164-29477 |
59 | QCoreApplication::sendEvent(p->socketNotifier, &event); executed: QCoreApplication::sendEvent(p->socketNotifier, &event); Execution Count:20164 | 20164 |
60 | } executed: } Execution Count:49635 | 49635 |
61 | | - |
62 | return true; executed: return true; Execution Count:19762 | 19762 |
63 | } | - |
64 | | - |
65 | static GSourceFuncs socketNotifierSourceFuncs = { | - |
66 | socketNotifierSourcePrepare, | - |
67 | socketNotifierSourceCheck, | - |
68 | socketNotifierSourceDispatch, | - |
69 | __null, | - |
70 | __null, | - |
71 | __null | - |
72 | }; | - |
73 | | - |
74 | struct GTimerSource | - |
75 | { | - |
76 | GSource source; | - |
77 | QTimerInfoList timerList; | - |
78 | QEventLoop::ProcessEventsFlags processEventsFlags; | - |
79 | bool runWithIdlePriority; | - |
80 | }; | - |
81 | | - |
82 | static gboolean timerSourcePrepareHelper(GTimerSource *src, gint *timeout) | - |
83 | { | - |
84 | timeval tv = { 0l, 0l }; | - |
85 | if (!(src->processEventsFlags & QEventLoop::X11ExcludeTimers) && src->timerList.timerWait(tv)) evaluated: !(src->processEventsFlags & QEventLoop::X11ExcludeTimers) yes Evaluation Count:629769 | yes Evaluation Count:1 |
evaluated: src->timerList.timerWait(tv) yes Evaluation Count:312001 | yes Evaluation Count:317768 |
| 1-629769 |
86 | *timeout = (tv.tv_sec * 1000) + ((tv.tv_usec + 999) / 1000); executed: *timeout = (tv.tv_sec * 1000) + ((tv.tv_usec + 999) / 1000); Execution Count:312001 | 312001 |
87 | else | - |
88 | *timeout = -1; executed: *timeout = -1; Execution Count:317787 | 317787 |
89 | | - |
90 | return (*timeout == 0); executed: return (*timeout == 0); Execution Count:629798 | 629798 |
91 | } | - |
92 | | - |
93 | static gboolean timerSourceCheckHelper(GTimerSource *src) | - |
94 | { | - |
95 | if (src->timerList.isEmpty() evaluated: src->timerList.isEmpty() yes Evaluation Count:317774 | yes Evaluation Count:274205 |
| 274205-317774 |
96 | || (src->processEventsFlags & QEventLoop::X11ExcludeTimers)) evaluated: (src->processEventsFlags & QEventLoop::X11ExcludeTimers) yes Evaluation Count:1 | yes Evaluation Count:274204 |
| 1-274204 |
97 | return false; executed: return false; Execution Count:317822 | 317822 |
98 | | - |
99 | if (src->timerList.updateCurrentTime() < src->timerList.first()->timeout) evaluated: src->timerList.updateCurrentTime() < src->timerList.first()->timeout yes Evaluation Count:271645 | yes Evaluation Count:2559 |
| 2559-271645 |
100 | return false; executed: return false; Execution Count:271645 | 271645 |
101 | | - |
102 | return true; executed: return true; Execution Count:2559 | 2559 |
103 | } | - |
104 | | - |
105 | static gboolean timerSourcePrepare(GSource *source, gint *timeout) | - |
106 | { | - |
107 | gint dummy; | - |
108 | if (!timeout) partially evaluated: !timeout no Evaluation Count:0 | yes Evaluation Count:630175 |
| 0-630175 |
109 | timeout = &dummy; never executed: timeout = &dummy; | 0 |
110 | | - |
111 | GTimerSource *src = reinterpret_cast<GTimerSource *>(source); | - |
112 | if (src->runWithIdlePriority) { evaluated: src->runWithIdlePriority yes Evaluation Count:2597 | yes Evaluation Count:627599 |
| 2597-627599 |
113 | if (timeout) partially evaluated: timeout yes Evaluation Count:2597 | no Evaluation Count:0 |
| 0-2597 |
114 | *timeout = -1; executed: *timeout = -1; Execution Count:2597 | 2597 |
115 | return false; executed: return false; Execution Count:2597 | 2597 |
116 | } | - |
117 | | - |
118 | return timerSourcePrepareHelper(src, timeout); executed: return timerSourcePrepareHelper(src, timeout); Execution Count:627602 | 627602 |
119 | } | - |
120 | | - |
121 | static gboolean timerSourceCheck(GSource *source) | - |
122 | { | - |
123 | GTimerSource *src = reinterpret_cast<GTimerSource *>(source); | - |
124 | if (src->runWithIdlePriority) evaluated: src->runWithIdlePriority yes Evaluation Count:2597 | yes Evaluation Count:590584 |
| 2597-590584 |
125 | return false; executed: return false; Execution Count:2597 | 2597 |
126 | return timerSourceCheckHelper(src); executed: return timerSourceCheckHelper(src); Execution Count:590588 | 590588 |
127 | } | - |
128 | | - |
129 | static gboolean timerSourceDispatch(GSource *source, GSourceFunc, gpointer) | - |
130 | { | - |
131 | GTimerSource *timerSource = reinterpret_cast<GTimerSource *>(source); | - |
132 | if (timerSource->processEventsFlags & QEventLoop::X11ExcludeTimers) partially evaluated: timerSource->processEventsFlags & QEventLoop::X11ExcludeTimers no Evaluation Count:0 | yes Evaluation Count:39595 |
| 0-39595 |
133 | return true; never executed: return true; | 0 |
134 | timerSource->runWithIdlePriority = true; | - |
135 | (void) timerSource->timerList.activateTimers(); | - |
136 | return true; executed: return true; Execution Count:39595 | 39595 |
137 | } | - |
138 | | - |
139 | static GSourceFuncs timerSourceFuncs = { | - |
140 | timerSourcePrepare, | - |
141 | timerSourceCheck, | - |
142 | timerSourceDispatch, | - |
143 | __null, | - |
144 | __null, | - |
145 | __null | - |
146 | }; | - |
147 | | - |
148 | struct GIdleTimerSource | - |
149 | { | - |
150 | GSource source; | - |
151 | GTimerSource *timerSource; | - |
152 | }; | - |
153 | | - |
154 | static gboolean idleTimerSourcePrepare(GSource *source, gint *timeout) | - |
155 | { | - |
156 | GIdleTimerSource *idleTimerSource = reinterpret_cast<GIdleTimerSource *>(source); | - |
157 | GTimerSource *timerSource = idleTimerSource->timerSource; | - |
158 | if (!timerSource->runWithIdlePriority) { evaluated: !timerSource->runWithIdlePriority yes Evaluation Count:326477 | yes Evaluation Count:2199 |
| 2199-326477 |
159 | | - |
160 | if (timeout) partially evaluated: timeout yes Evaluation Count:326484 | no Evaluation Count:0 |
| 0-326484 |
161 | *timeout = -1; executed: *timeout = -1; Execution Count:326485 | 326485 |
162 | return false; executed: return false; Execution Count:326485 | 326485 |
163 | } | - |
164 | | - |
165 | return timerSourcePrepareHelper(timerSource, timeout); executed: return timerSourcePrepareHelper(timerSource, timeout); Execution Count:2199 | 2199 |
166 | } | - |
167 | | - |
168 | static gboolean idleTimerSourceCheck(GSource *source) | - |
169 | { | - |
170 | GIdleTimerSource *idleTimerSource = reinterpret_cast<GIdleTimerSource *>(source); | - |
171 | GTimerSource *timerSource = idleTimerSource->timerSource; | - |
172 | if (!timerSource->runWithIdlePriority) { evaluated: !timerSource->runWithIdlePriority yes Evaluation Count:291823 | yes Evaluation Count:1415 |
| 1415-291823 |
173 | | - |
174 | return false; executed: return false; Execution Count:291832 | 291832 |
175 | } | - |
176 | return timerSourceCheckHelper(timerSource); executed: return timerSourceCheckHelper(timerSource); Execution Count:1415 | 1415 |
177 | } | - |
178 | | - |
179 | static gboolean idleTimerSourceDispatch(GSource *source, GSourceFunc, gpointer) | - |
180 | { | - |
181 | GTimerSource *timerSource = reinterpret_cast<GIdleTimerSource *>(source)->timerSource; | - |
182 | (void) timerSourceDispatch(&timerSource->source, 0, 0); | - |
183 | return true; executed: return true; Execution Count:1437 | 1437 |
184 | } | - |
185 | | - |
186 | static GSourceFuncs idleTimerSourceFuncs = { | - |
187 | idleTimerSourcePrepare, | - |
188 | idleTimerSourceCheck, | - |
189 | idleTimerSourceDispatch, | - |
190 | __null, | - |
191 | __null, | - |
192 | __null | - |
193 | }; | - |
194 | | - |
195 | struct GPostEventSource | - |
196 | { | - |
197 | GSource source; | - |
198 | QAtomicInt serialNumber; | - |
199 | int lastSerialNumber; | - |
200 | QEventDispatcherGlibPrivate *d; | - |
201 | }; | - |
202 | | - |
203 | static gboolean postEventSourcePrepare(GSource *s, gint *timeout) | - |
204 | { | - |
205 | QThreadData *data = QThreadData::current(); | - |
206 | if (!data) partially evaluated: !data no Evaluation Count:0 | yes Evaluation Count:961310 |
| 0-961310 |
207 | return false; never executed: return false; | 0 |
208 | | - |
209 | gint dummy; | - |
210 | if (!timeout) evaluated: !timeout yes Evaluation Count:331158 | yes Evaluation Count:630239 |
| 331158-630239 |
211 | timeout = &dummy; executed: timeout = &dummy; Execution Count:331161 | 331161 |
212 | *timeout = data->canWait ? -1 : 0; evaluated: data->canWait yes Evaluation Count:645472 | yes Evaluation Count:315886 |
| 315886-645472 |
213 | | - |
214 | GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s); | - |
215 | return (!data->canWait | 961334 |
216 | || (source->serialNumber.load() != source->lastSerialNumber)); executed: return (!data->canWait || (source->serialNumber.load() != source->lastSerialNumber)); Execution Count:961334 | 961334 |
217 | } | - |
218 | | - |
219 | static gboolean postEventSourceCheck(GSource *source) | - |
220 | { | - |
221 | return postEventSourcePrepare(source, 0); executed: return postEventSourcePrepare(source, 0); Execution Count:331105 | 331105 |
222 | } | - |
223 | | - |
224 | static gboolean postEventSourceDispatch(GSource *s, GSourceFunc, gpointer) | - |
225 | { | - |
226 | GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s); | - |
227 | source->lastSerialNumber = source->serialNumber.load(); | - |
228 | QCoreApplication::sendPostedEvents(); | - |
229 | source->d->runTimersOnceWithNormalPriority(); | - |
230 | return true; executed: return true; Execution Count:319336 | 319336 |
231 | } | - |
232 | | - |
233 | static GSourceFuncs postEventSourceFuncs = { | - |
234 | postEventSourcePrepare, | - |
235 | postEventSourceCheck, | - |
236 | postEventSourceDispatch, | - |
237 | __null, | - |
238 | __null, | - |
239 | __null | - |
240 | }; | - |
241 | | - |
242 | | - |
243 | QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context) | - |
244 | : mainContext(context) | - |
245 | { | - |
246 | if (qEnvironmentVariableIsEmpty("QT_NO_THREADED_GLIB")) { partially evaluated: qEnvironmentVariableIsEmpty("QT_NO_THREADED_GLIB") yes Evaluation Count:1731381 | no Evaluation Count:0 |
| 0-1731381 |
247 | static QBasicMutex mutex; | - |
248 | QMutexLocker locker(&mutex); | - |
249 | if (!(g_threads_got_initialized)) evaluated: !(g_threads_got_initialized) yes Evaluation Count:8 | yes Evaluation Count:1731373 |
| 8-1731373 |
250 | g_thread_init(__null); executed: g_thread_init(__null); Execution Count:8 | 8 |
251 | } executed: } Execution Count:1731381 | 1731381 |
252 | | - |
253 | if (mainContext) { partially evaluated: mainContext no Evaluation Count:0 | yes Evaluation Count:1731381 |
| 0-1731381 |
254 | g_main_context_ref(mainContext); | - |
255 | } else { | 0 |
256 | QCoreApplication *app = QCoreApplication::instance(); | - |
257 | if (app && QThread::currentThread() == app->thread()) { evaluated: app yes Evaluation Count:1731349 | yes Evaluation Count:32 |
evaluated: QThread::currentThread() == app->thread() yes Evaluation Count:131 | yes Evaluation Count:1731218 |
| 32-1731349 |
258 | mainContext = g_main_context_default(); | - |
259 | g_main_context_ref(mainContext); | - |
260 | } else { executed: } Execution Count:131 | 131 |
261 | mainContext = g_main_context_new(); | - |
262 | } executed: } Execution Count:1731250 | 1731250 |
263 | } | - |
264 | | - |
265 | | - |
266 | g_main_context_push_thread_default (mainContext); | - |
267 | | - |
268 | | - |
269 | | - |
270 | postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs, | - |
271 | sizeof(GPostEventSource))); | - |
272 | postEventSource->serialNumber.store(1); | - |
273 | postEventSource->d = this; | - |
274 | g_source_set_can_recurse(&postEventSource->source, true); | - |
275 | g_source_attach(&postEventSource->source, mainContext); | - |
276 | | - |
277 | | - |
278 | socketNotifierSource = | - |
279 | reinterpret_cast<GSocketNotifierSource *>(g_source_new(&socketNotifierSourceFuncs, | - |
280 | sizeof(GSocketNotifierSource))); | - |
281 | (void) new (&socketNotifierSource->pollfds) QList<GPollFDWithQSocketNotifier *>(); | - |
282 | g_source_set_can_recurse(&socketNotifierSource->source, true); | - |
283 | g_source_attach(&socketNotifierSource->source, mainContext); | - |
284 | | - |
285 | | - |
286 | timerSource = reinterpret_cast<GTimerSource *>(g_source_new(&timerSourceFuncs, | - |
287 | sizeof(GTimerSource))); | - |
288 | (void) new (&timerSource->timerList) QTimerInfoList(); | - |
289 | timerSource->processEventsFlags = QEventLoop::AllEvents; | - |
290 | timerSource->runWithIdlePriority = false; | - |
291 | g_source_set_can_recurse(&timerSource->source, true); | - |
292 | g_source_attach(&timerSource->source, mainContext); | - |
293 | | - |
294 | idleTimerSource = reinterpret_cast<GIdleTimerSource *>(g_source_new(&idleTimerSourceFuncs, | - |
295 | sizeof(GIdleTimerSource))); | - |
296 | idleTimerSource->timerSource = timerSource; | - |
297 | g_source_set_can_recurse(&idleTimerSource->source, true); | - |
298 | g_source_set_priority(&idleTimerSource->source, 200); | - |
299 | g_source_attach(&idleTimerSource->source, mainContext); | - |
300 | } executed: } Execution Count:1731380 | 1731380 |
301 | | - |
302 | void QEventDispatcherGlibPrivate::runTimersOnceWithNormalPriority() | - |
303 | { | - |
304 | timerSource->runWithIdlePriority = false; | - |
305 | } executed: } Execution Count:319331 | 319331 |
306 | | - |
307 | QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent) | - |
308 | : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate), parent) | - |
309 | { | - |
310 | } executed: } Execution Count:1731282 | 1731282 |
311 | | - |
312 | QEventDispatcherGlib::QEventDispatcherGlib(GMainContext *mainContext, QObject *parent) | - |
313 | : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate(mainContext)), parent) | - |
314 | { } | 0 |
315 | | - |
316 | QEventDispatcherGlib::~QEventDispatcherGlib() | - |
317 | { | - |
318 | QEventDispatcherGlibPrivate * const d = d_func(); | - |
319 | | - |
320 | | - |
321 | qDeleteAll(d->timerSource->timerList); | - |
322 | d->timerSource->timerList.~QTimerInfoList(); | - |
323 | g_source_destroy(&d->timerSource->source); | - |
324 | g_source_unref(&d->timerSource->source); | - |
325 | d->timerSource = 0; | - |
326 | g_source_destroy(&d->idleTimerSource->source); | - |
327 | g_source_unref(&d->idleTimerSource->source); | - |
328 | d->idleTimerSource = 0; | - |
329 | | - |
330 | | - |
331 | for (int i = 0; i < d->socketNotifierSource->pollfds.count(); ++i) { evaluated: i < d->socketNotifierSource->pollfds.count() yes Evaluation Count:460 | yes Evaluation Count:1731667 |
| 460-1731667 |
332 | GPollFDWithQSocketNotifier *p = d->socketNotifierSource->pollfds[i]; | - |
333 | g_source_remove_poll(&d->socketNotifierSource->source, &p->pollfd); | - |
334 | delete p; | - |
335 | } executed: } Execution Count:460 | 460 |
336 | d->socketNotifierSource->pollfds.~QList<GPollFDWithQSocketNotifier *>(); | - |
337 | g_source_destroy(&d->socketNotifierSource->source); | - |
338 | g_source_unref(&d->socketNotifierSource->source); | - |
339 | d->socketNotifierSource = 0; | - |
340 | | - |
341 | | - |
342 | g_source_destroy(&d->postEventSource->source); | - |
343 | g_source_unref(&d->postEventSource->source); | - |
344 | d->postEventSource = 0; | - |
345 | | - |
346 | qt_noop(); | - |
347 | | - |
348 | g_main_context_pop_thread_default (d->mainContext); | - |
349 | | - |
350 | g_main_context_unref(d->mainContext); | - |
351 | d->mainContext = 0; | - |
352 | } executed: } Execution Count:1731673 | 1731673 |
353 | | - |
354 | bool QEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags) | - |
355 | { | - |
356 | QEventDispatcherGlibPrivate * const d = d_func(); | - |
357 | | - |
358 | const bool canWait = (flags & QEventLoop::WaitForMoreEvents); | - |
359 | if (canWait) evaluated: canWait yes Evaluation Count:102128 | yes Evaluation Count:528067 |
| 102128-528067 |
360 | aboutToBlock(); executed: aboutToBlock(); Execution Count:102131 | 102131 |
361 | else | - |
362 | awake(); executed: awake(); Execution Count:528065 | 528065 |
363 | | - |
364 | | - |
365 | QEventLoop::ProcessEventsFlags savedFlags = d->timerSource->processEventsFlags; | - |
366 | d->timerSource->processEventsFlags = flags; | - |
367 | | - |
368 | if (!(flags & QEventLoop::EventLoopExec)) { evaluated: !(flags & QEventLoop::EventLoopExec) yes Evaluation Count:568390 | yes Evaluation Count:61862 |
| 61862-568390 |
369 | | - |
370 | d->timerSource->runWithIdlePriority = false; | - |
371 | } executed: } Execution Count:568389 | 568389 |
372 | | - |
373 | bool result = g_main_context_iteration(d->mainContext, canWait); | - |
374 | while (!result && canWait) evaluated: !result yes Evaluation Count:291793 | yes Evaluation Count:338374 |
evaluated: canWait yes Evaluation Count:1 | yes Evaluation Count:291816 |
| 1-338374 |
375 | result = g_main_context_iteration(d->mainContext, canWait); executed: result = g_main_context_iteration(d->mainContext, canWait); Execution Count:1 | 1 |
376 | | - |
377 | d->timerSource->processEventsFlags = savedFlags; | - |
378 | | - |
379 | if (canWait) evaluated: canWait yes Evaluation Count:102118 | yes Evaluation Count:528070 |
| 102118-528070 |
380 | awake(); executed: awake(); Execution Count:102117 | 102117 |
381 | | - |
382 | return result; executed: return result; Execution Count:630208 | 630208 |
383 | } | - |
384 | | - |
385 | bool QEventDispatcherGlib::hasPendingEvents() | - |
386 | { | - |
387 | QEventDispatcherGlibPrivate * const d = d_func(); | - |
388 | return g_main_context_pending(d->mainContext); never executed: return g_main_context_pending(d->mainContext); | 0 |
389 | } | - |
390 | | - |
391 | void QEventDispatcherGlib::registerSocketNotifier(QSocketNotifier *notifier) | - |
392 | { | - |
393 | qt_noop(); | - |
394 | int sockfd = notifier->socket(); | - |
395 | int type = notifier->type(); | - |
396 | QEventDispatcherGlibPrivate * const d = d_func(); | - |
397 | | - |
398 | | - |
399 | GPollFDWithQSocketNotifier *p = new GPollFDWithQSocketNotifier; | - |
400 | p->pollfd.fd = sockfd; | - |
401 | switch (type) { | - |
402 | case QSocketNotifier::Read: | - |
403 | p->pollfd.events = G_IO_IN | G_IO_HUP | G_IO_ERR; | - |
404 | break; executed: break; Execution Count:20497 | 20497 |
405 | case QSocketNotifier::Write: | - |
406 | p->pollfd.events = G_IO_OUT | G_IO_ERR; | - |
407 | break; executed: break; Execution Count:23141 | 23141 |
408 | case QSocketNotifier::Exception: | - |
409 | p->pollfd.events = G_IO_PRI | G_IO_ERR; | - |
410 | break; | 0 |
411 | } | - |
412 | p->socketNotifier = notifier; | - |
413 | | - |
414 | d->socketNotifierSource->pollfds.append(p); | - |
415 | | - |
416 | g_source_add_poll(&d->socketNotifierSource->source, &p->pollfd); | - |
417 | } executed: } Execution Count:43642 | 43642 |
418 | | - |
419 | void QEventDispatcherGlib::unregisterSocketNotifier(QSocketNotifier *notifier) | - |
420 | { | - |
421 | qt_noop(); | - |
422 | QEventDispatcherGlibPrivate * const d = d_func(); | - |
423 | | - |
424 | for (int i = 0; i < d->socketNotifierSource->pollfds.count(); ++i) { partially evaluated: i < d->socketNotifierSource->pollfds.count() yes Evaluation Count:100505 | no Evaluation Count:0 |
| 0-100505 |
425 | GPollFDWithQSocketNotifier *p = d->socketNotifierSource->pollfds.at(i); | - |
426 | if (p->socketNotifier == notifier) { evaluated: p->socketNotifier == notifier yes Evaluation Count:43516 | yes Evaluation Count:56990 |
| 43516-56990 |
427 | | - |
428 | g_source_remove_poll(&d->socketNotifierSource->source, &p->pollfd); | - |
429 | | - |
430 | d->socketNotifierSource->pollfds.removeAt(i); | - |
431 | delete p; | - |
432 | | - |
433 | return; executed: return; Execution Count:43515 | 43515 |
434 | } | - |
435 | } executed: } Execution Count:56990 | 56990 |
436 | } | 0 |
437 | | - |
438 | void QEventDispatcherGlib::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) | - |
439 | { | - |
440 | QEventDispatcherGlibPrivate * const d = d_func(); | - |
441 | d->timerSource->timerList.registerTimer(timerId, interval, timerType, object); | - |
442 | } executed: } Execution Count:126699 | 126699 |
443 | | - |
444 | bool QEventDispatcherGlib::unregisterTimer(int timerId) | - |
445 | { | - |
446 | QEventDispatcherGlibPrivate * const d = d_func(); | - |
447 | return d->timerSource->timerList.unregisterTimer(timerId); executed: return d->timerSource->timerList.unregisterTimer(timerId); Execution Count:124324 | 124324 |
448 | } | - |
449 | | - |
450 | bool QEventDispatcherGlib::unregisterTimers(QObject *object) | - |
451 | { | - |
452 | QEventDispatcherGlibPrivate * const d = d_func(); | - |
453 | return d->timerSource->timerList.unregisterTimers(object); executed: return d->timerSource->timerList.unregisterTimers(object); Execution Count:684 | 684 |
454 | } | - |
455 | | - |
456 | QList<QEventDispatcherGlib::TimerInfo> QEventDispatcherGlib::registeredTimers(QObject *object) const | - |
457 | { | - |
458 | if (!object) { partially evaluated: !object no Evaluation Count:0 | yes Evaluation Count:23259 |
| 0-23259 |
459 | QMessageLogger("kernel/qeventdispatcher_glib.cpp", 562, __PRETTY_FUNCTION__).warning("QEventDispatcherUNIX:registeredTimers: invalid argument"); | - |
460 | return QList<TimerInfo>(); never executed: return QList<TimerInfo>(); | 0 |
461 | } | - |
462 | | - |
463 | const QEventDispatcherGlibPrivate * const d = d_func(); | - |
464 | return d->timerSource->timerList.registeredTimers(object); executed: return d->timerSource->timerList.registeredTimers(object); Execution Count:23242 | 23242 |
465 | } | - |
466 | | - |
467 | int QEventDispatcherGlib::remainingTime(int timerId) | - |
468 | { | - |
469 | | - |
470 | | - |
471 | | - |
472 | | - |
473 | | - |
474 | | - |
475 | | - |
476 | QEventDispatcherGlibPrivate * const d = d_func(); | - |
477 | return d->timerSource->timerList.timerRemainingTime(timerId); executed: return d->timerSource->timerList.timerRemainingTime(timerId); Execution Count:1 | 1 |
478 | } | - |
479 | | - |
480 | void QEventDispatcherGlib::interrupt() | - |
481 | { | - |
482 | wakeUp(); | - |
483 | } executed: } Execution Count:2592 | 2592 |
484 | | - |
485 | void QEventDispatcherGlib::wakeUp() | - |
486 | { | - |
487 | QEventDispatcherGlibPrivate * const d = d_func(); | - |
488 | d->postEventSource->serialNumber.ref(); | - |
489 | g_main_context_wakeup(d->mainContext); | - |
490 | } executed: } Execution Count:497529 | 497529 |
491 | | - |
492 | void QEventDispatcherGlib::flush() | - |
493 | { | - |
494 | } | - |
495 | | - |
496 | bool QEventDispatcherGlib::versionSupported() | - |
497 | { | - |
498 | | - |
499 | | - |
500 | | - |
501 | return ((2 << 16) + (24 << 8) + 2) >= 0x020301; executed: return ((2 << 16) + (24 << 8) + 2) >= 0x020301; Execution Count:1731379 | 1731379 |
502 | | - |
503 | } | - |
504 | | - |
505 | QEventDispatcherGlib::QEventDispatcherGlib(QEventDispatcherGlibPrivate &dd, QObject *parent) | - |
506 | : QAbstractEventDispatcher(dd, parent) | - |
507 | { | - |
508 | } executed: } Execution Count:93 | 93 |
509 | | - |
510 | | - |
511 | | - |
| | |