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:626990 | no Evaluation Count:0 |
| 0-626990 |
23 | *timeout = -1; executed: *timeout = -1; Execution Count:626981 | 626981 |
24 | return false; executed: return false; Execution Count:627004 | 627004 |
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:1254963 | yes Evaluation Count:19255 |
evaluated: i < src->pollfds.count() yes Evaluation Count:647242 | yes Evaluation Count:607777 |
| 19255-1254963 |
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:647241 |
| 0-647241 |
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:647241 | 647241 |
46 | | - |
47 | return pending; executed: return pending; Execution Count:627035 | 627035 |
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:49293 | yes Evaluation Count:19253 |
| 19253-49293 |
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:19641 | yes Evaluation Count:29652 |
| 19641-29652 |
59 | QCoreApplication::sendEvent(p->socketNotifier, &event); executed: QCoreApplication::sendEvent(p->socketNotifier, &event); Execution Count:19641 | 19641 |
60 | } executed: } Execution Count:49282 | 49282 |
61 | | - |
62 | return true; executed: return true; Execution Count:19253 | 19253 |
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:626543 | yes Evaluation Count:1 |
evaluated: src->timerList.timerWait(tv) yes Evaluation Count:301591 | yes Evaluation Count:324952 |
| 1-626543 |
86 | *timeout = (tv.tv_sec * 1000) + ((tv.tv_usec + 999) / 1000); executed: *timeout = (tv.tv_sec * 1000) + ((tv.tv_usec + 999) / 1000); Execution Count:301591 | 301591 |
87 | else | - |
88 | *timeout = -1; executed: *timeout = -1; Execution Count:324961 | 324961 |
89 | | - |
90 | return (*timeout == 0); executed: return (*timeout == 0); Execution Count:626572 | 626572 |
91 | } | - |
92 | | - |
93 | static gboolean timerSourceCheckHelper(GTimerSource *src) | - |
94 | { | - |
95 | if (src->timerList.isEmpty() evaluated: src->timerList.isEmpty() yes Evaluation Count:324960 | yes Evaluation Count:262290 |
| 262290-324960 |
96 | || (src->processEventsFlags & QEventLoop::X11ExcludeTimers)) evaluated: (src->processEventsFlags & QEventLoop::X11ExcludeTimers) yes Evaluation Count:1 | yes Evaluation Count:262289 |
| 1-262289 |
97 | return false; executed: return false; Execution Count:325004 | 325004 |
98 | | - |
99 | if (src->timerList.updateCurrentTime() < src->timerList.first()->timeout) evaluated: src->timerList.updateCurrentTime() < src->timerList.first()->timeout yes Evaluation Count:259722 | yes Evaluation Count:2567 |
| 2567-259722 |
100 | return false; executed: return false; Execution Count:259722 | 259722 |
101 | | - |
102 | return true; executed: return true; Execution Count:2567 | 2567 |
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:627012 |
| 0-627012 |
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:2730 | yes Evaluation Count:624280 |
| 2730-624280 |
113 | if (timeout) partially evaluated: timeout yes Evaluation Count:2730 | no Evaluation Count:0 |
| 0-2730 |
114 | *timeout = -1; executed: *timeout = -1; Execution Count:2730 | 2730 |
115 | return false; executed: return false; Execution Count:2730 | 2730 |
116 | } | - |
117 | | - |
118 | return timerSourcePrepareHelper(src, timeout); executed: return timerSourcePrepareHelper(src, timeout); Execution Count:624283 | 624283 |
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:2730 | yes Evaluation Count:585873 |
| 2730-585873 |
125 | return false; executed: return false; Execution Count:2730 | 2730 |
126 | return timerSourceCheckHelper(src); executed: return timerSourceCheckHelper(src); Execution Count:585884 | 585884 |
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:40996 |
| 0-40996 |
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:40996 | 40996 |
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:308516 | yes Evaluation Count:2303 |
| 2303-308516 |
159 | | - |
160 | if (timeout) partially evaluated: timeout yes Evaluation Count:308520 | no Evaluation Count:0 |
| 0-308520 |
161 | *timeout = -1; executed: *timeout = -1; Execution Count:308516 | 308516 |
162 | return false; executed: return false; Execution Count:308518 | 308518 |
163 | } | - |
164 | | - |
165 | return timerSourcePrepareHelper(timerSource, timeout); executed: return timerSourcePrepareHelper(timerSource, timeout); Execution Count:2303 | 2303 |
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:275439 | yes Evaluation Count:1404 |
| 1404-275439 |
173 | | - |
174 | return false; executed: return false; Execution Count:275445 | 275445 |
175 | } | - |
176 | return timerSourceCheckHelper(timerSource); executed: return timerSourceCheckHelper(timerSource); Execution Count:1404 | 1404 |
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:1429 | 1429 |
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:940400 |
| 0-940400 |
207 | return false; never executed: return false; | 0 |
208 | | - |
209 | gint dummy; | - |
210 | if (!timeout) evaluated: !timeout yes Evaluation Count:313449 | yes Evaluation Count:626990 |
| 313449-626990 |
211 | timeout = &dummy; executed: timeout = &dummy; Execution Count:313452 | 313452 |
212 | *timeout = data->canWait ? -1 : 0; evaluated: data->canWait yes Evaluation Count:612288 | yes Evaluation Count:328152 |
| 328152-612288 |
213 | | - |
214 | GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s); | - |
215 | return (!data->canWait | 940418 |
216 | || (source->serialNumber.load() != source->lastSerialNumber)); executed: return (!data->canWait || (source->serialNumber.load() != source->lastSerialNumber)); Execution Count:940418 | 940418 |
217 | } | - |
218 | | - |
219 | static gboolean postEventSourceCheck(GSource *source) | - |
220 | { | - |
221 | return postEventSourcePrepare(source, 0); executed: return postEventSourcePrepare(source, 0); Execution Count:313433 | 313433 |
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:332663 | 332663 |
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:1717535 | no Evaluation Count:0 |
| 0-1717535 |
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:1717533 |
| 8-1717533 |
250 | g_thread_init(__null); executed: g_thread_init(__null); Execution Count:8 | 8 |
251 | } executed: } Execution Count:1717541 | 1717541 |
252 | | - |
253 | if (mainContext) { partially evaluated: mainContext no Evaluation Count:0 | yes Evaluation Count:1717541 |
| 0-1717541 |
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:1717509 | yes Evaluation Count:32 |
evaluated: QThread::currentThread() == app->thread() yes Evaluation Count:144 | yes Evaluation Count:1717363 |
| 32-1717509 |
258 | mainContext = g_main_context_default(); | - |
259 | g_main_context_ref(mainContext); | - |
260 | } else { executed: } Execution Count:144 | 144 |
261 | mainContext = g_main_context_new(); | - |
262 | } executed: } Execution Count:1717397 | 1717397 |
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:1717535 | 1717535 |
301 | | - |
302 | void QEventDispatcherGlibPrivate::runTimersOnceWithNormalPriority() | - |
303 | { | - |
304 | timerSource->runWithIdlePriority = false; | - |
305 | } executed: } Execution Count:332662 | 332662 |
306 | | - |
307 | QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent) | - |
308 | : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate), parent) | - |
309 | { | - |
310 | } executed: } Execution Count:1717406 | 1717406 |
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:506 | yes Evaluation Count:1717836 |
| 506-1717836 |
332 | GPollFDWithQSocketNotifier *p = d->socketNotifierSource->pollfds[i]; | - |
333 | g_source_remove_poll(&d->socketNotifierSource->source, &p->pollfd); | - |
334 | delete p; | - |
335 | } executed: } Execution Count:506 | 506 |
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:1717848 | 1717848 |
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:98942 | yes Evaluation Count:528058 |
| 98942-528058 |
360 | aboutToBlock(); executed: aboutToBlock(); Execution Count:98944 | 98944 |
361 | else | - |
362 | awake(); executed: awake(); Execution Count:528053 | 528053 |
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:566988 | yes Evaluation Count:60059 |
| 60059-566988 |
369 | | - |
370 | d->timerSource->runWithIdlePriority = false; | - |
371 | } executed: } Execution Count:566989 | 566989 |
372 | | - |
373 | bool result = g_main_context_iteration(d->mainContext, canWait); | - |
374 | while (!result && canWait) evaluated: !result yes Evaluation Count:275449 | yes Evaluation Count:351585 |
evaluated: canWait yes Evaluation Count:2 | yes Evaluation Count:275457 |
| 2-351585 |
375 | result = g_main_context_iteration(d->mainContext, canWait); executed: result = g_main_context_iteration(d->mainContext, canWait); Execution Count:2 | 2 |
376 | | - |
377 | d->timerSource->processEventsFlags = savedFlags; | - |
378 | | - |
379 | if (canWait) evaluated: canWait yes Evaluation Count:98938 | yes Evaluation Count:528082 |
| 98938-528082 |
380 | awake(); executed: awake(); Execution Count:98942 | 98942 |
381 | | - |
382 | return result; executed: return result; Execution Count:626961 | 626961 |
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:19789 | 19789 |
405 | case QSocketNotifier::Write: | - |
406 | p->pollfd.events = G_IO_OUT | G_IO_ERR; | - |
407 | break; executed: break; Execution Count:23912 | 23912 |
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:43701 | 43701 |
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:101624 | no Evaluation Count:0 |
| 0-101624 |
425 | GPollFDWithQSocketNotifier *p = d->socketNotifierSource->pollfds.at(i); | - |
426 | if (p->socketNotifier == notifier) { evaluated: p->socketNotifier == notifier yes Evaluation Count:43564 | yes Evaluation Count:58062 |
| 43564-58062 |
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:43564 | 43564 |
434 | } | - |
435 | } executed: } Execution Count:58063 | 58063 |
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:132417 | 132417 |
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:129527 | 129527 |
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:1181 | 1181 |
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:23317 |
| 0-23317 |
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:23315 | 23315 |
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:2707 | 2707 |
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:546042 | 546042 |
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:1717525 | 1717525 |
502 | | - |
503 | } | - |
504 | | - |
505 | QEventDispatcherGlib::QEventDispatcherGlib(QEventDispatcherGlibPrivate &dd, QObject *parent) | - |
506 | : QAbstractEventDispatcher(dd, parent) | - |
507 | { | - |
508 | } executed: } Execution Count:105 | 105 |
509 | | - |
510 | | - |
511 | | - |
| | |