| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | QFutureWatcherBase::QFutureWatcherBase(QObject *parent) | - |
| 8 | :QObject(*new QFutureWatcherBasePrivate, parent) | - |
| 9 | { } executed: }Execution Count:22 | 22 |
| 10 | void QFutureWatcherBase::cancel() | - |
| 11 | { | - |
| 12 | futureInterface().cancel(); | - |
| 13 | } executed: }Execution Count:5 | 5 |
| 14 | void QFutureWatcherBase::setPaused(bool paused) | - |
| 15 | { | - |
| 16 | futureInterface().setPaused(paused); | - |
| 17 | } | 0 |
| 18 | void QFutureWatcherBase::pause() | - |
| 19 | { | - |
| 20 | futureInterface().setPaused(true); | - |
| 21 | } executed: }Execution Count:4 | 4 |
| 22 | void QFutureWatcherBase::resume() | - |
| 23 | { | - |
| 24 | futureInterface().setPaused(false); | - |
| 25 | } executed: }Execution Count:4 | 4 |
| 26 | void QFutureWatcherBase::togglePaused() | - |
| 27 | { | - |
| 28 | futureInterface().togglePaused(); | - |
| 29 | } executed: }Execution Count:3 | 3 |
| 30 | int QFutureWatcherBase::progressValue() const | - |
| 31 | { | - |
| 32 | return futureInterface().progressValue(); executed: return futureInterface().progressValue();Execution Count:6 | 6 |
| 33 | } | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | | - |
| 41 | int QFutureWatcherBase::progressMinimum() const | - |
| 42 | { | - |
| 43 | return futureInterface().progressMinimum(); executed: return futureInterface().progressMinimum();Execution Count:6 | 6 |
| 44 | } | - |
| 45 | | - |
| 46 | | - |
| 47 | | - |
| 48 | | - |
| 49 | | - |
| 50 | | - |
| 51 | | - |
| 52 | int QFutureWatcherBase::progressMaximum() const | - |
| 53 | { | - |
| 54 | return futureInterface().progressMaximum(); executed: return futureInterface().progressMaximum();Execution Count:6 | 6 |
| 55 | } | - |
| 56 | QString QFutureWatcherBase::progressText() const | - |
| 57 | { | - |
| 58 | return futureInterface().progressText(); executed: return futureInterface().progressText();Execution Count:6 | 6 |
| 59 | } | - |
| 60 | | - |
| 61 | | - |
| 62 | | - |
| 63 | | - |
| 64 | | - |
| 65 | | - |
| 66 | bool QFutureWatcherBase::isStarted() const | - |
| 67 | { | - |
| 68 | return futureInterface().queryState(QFutureInterfaceBase::Started); executed: return futureInterface().queryState(QFutureInterfaceBase::Started);Execution Count:6 | 6 |
| 69 | } | - |
| 70 | | - |
| 71 | | - |
| 72 | | - |
| 73 | | - |
| 74 | | - |
| 75 | | - |
| 76 | bool QFutureWatcherBase::isFinished() const | - |
| 77 | { | - |
| 78 | const QFutureWatcherBasePrivate * const d = d_func(); | - |
| 79 | return d->finished; executed: return d->finished;Execution Count:10 | 10 |
| 80 | } | - |
| 81 | | - |
| 82 | | - |
| 83 | | - |
| 84 | | - |
| 85 | | - |
| 86 | | - |
| 87 | bool QFutureWatcherBase::isRunning() const | - |
| 88 | { | - |
| 89 | return futureInterface().queryState(QFutureInterfaceBase::Running); executed: return futureInterface().queryState(QFutureInterfaceBase::Running);Execution Count:6 | 6 |
| 90 | } | - |
| 91 | bool QFutureWatcherBase::isCanceled() const | - |
| 92 | { | - |
| 93 | return futureInterface().queryState(QFutureInterfaceBase::Canceled); executed: return futureInterface().queryState(QFutureInterfaceBase::Canceled);Execution Count:6 | 6 |
| 94 | } | - |
| 95 | bool QFutureWatcherBase::isPaused() const | - |
| 96 | { | - |
| 97 | return futureInterface().queryState(QFutureInterfaceBase::Paused); executed: return futureInterface().queryState(QFutureInterfaceBase::Paused);Execution Count:6 | 6 |
| 98 | } | - |
| 99 | | - |
| 100 | | - |
| 101 | | - |
| 102 | | - |
| 103 | | - |
| 104 | | - |
| 105 | void QFutureWatcherBase::waitForFinished() | - |
| 106 | { | - |
| 107 | futureInterface().waitForFinished(); | - |
| 108 | } executed: }Execution Count:4 | 4 |
| 109 | bool QFutureWatcherBase::event(QEvent *event) | - |
| 110 | { | - |
| 111 | QFutureWatcherBasePrivate * const d = d_func(); | - |
| 112 | if (event->type() == QEvent::FutureCallOut) { partially evaluated: event->type() == QEvent::FutureCallOut| yes Evaluation Count:1521 | no Evaluation Count:0 |
| 0-1521 |
| 113 | QFutureCallOutEvent *callOutEvent = static_cast<QFutureCallOutEvent *>(event); | - |
| 114 | | - |
| 115 | if (futureInterface().isPaused()) { evaluated: futureInterface().isPaused()| yes Evaluation Count:6 | yes Evaluation Count:1515 |
| 6-1515 |
| 116 | d->pendingCallOutEvents.append(callOutEvent->clone()); | - |
| 117 | return true; executed: return true;Execution Count:6 | 6 |
| 118 | } | - |
| 119 | | - |
| 120 | if (callOutEvent->callOutType == QFutureCallOutEvent::Resumed evaluated: callOutEvent->callOutType == QFutureCallOutEvent::Resumed| yes Evaluation Count:1 | yes Evaluation Count:1514 |
| 1-1514 |
| 121 | && !d->pendingCallOutEvents.isEmpty()) { partially evaluated: !d->pendingCallOutEvents.isEmpty()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 122 | | - |
| 123 | d->sendCallOutEvent(callOutEvent); | - |
| 124 | | - |
| 125 | | - |
| 126 | for (int i = 0; i < d->pendingCallOutEvents.count(); ++i) evaluated: i < d->pendingCallOutEvents.count()| yes Evaluation Count:6 | yes Evaluation Count:1 |
| 1-6 |
| 127 | d->sendCallOutEvent(d->pendingCallOutEvents.at(i)); executed: d->sendCallOutEvent(d->pendingCallOutEvents.at(i));Execution Count:6 | 6 |
| 128 | qDeleteAll(d->pendingCallOutEvents); | - |
| 129 | d->pendingCallOutEvents.clear(); | - |
| 130 | } else { executed: }Execution Count:1 | 1 |
| 131 | d->sendCallOutEvent(callOutEvent); | - |
| 132 | } executed: }Execution Count:1514 | 1514 |
| 133 | return true; executed: return true;Execution Count:1515 | 1515 |
| 134 | } | - |
| 135 | return QObject::event(event); never executed: return QObject::event(event); | 0 |
| 136 | } | - |
| 137 | | - |
| 138 | void QFutureWatcherBase::setPendingResultsLimit(int limit) | - |
| 139 | { | - |
| 140 | QFutureWatcherBasePrivate * const d = d_func(); | - |
| 141 | d->maximumPendingResultsReady = limit; | - |
| 142 | } | 0 |
| 143 | | - |
| 144 | void QFutureWatcherBase::connectNotify(const QMetaMethod &signal) | - |
| 145 | { | - |
| 146 | QFutureWatcherBasePrivate * const d = d_func(); | - |
| 147 | static const QMetaMethod resultReadyAtSignal = QMetaMethod::fromSignal(&QFutureWatcherBase::resultReadyAt); | - |
| 148 | if (signal == resultReadyAtSignal) evaluated: signal == resultReadyAtSignal| yes Evaluation Count:19 | yes Evaluation Count:23 |
| 19-23 |
| 149 | d->resultAtConnected.ref(); executed: d->resultAtConnected.ref();Execution Count:19 | 19 |
| 150 | } executed: }Execution Count:42 | 42 |
| 151 | | - |
| 152 | void QFutureWatcherBase::disconnectNotify(const QMetaMethod &signal) | - |
| 153 | { | - |
| 154 | QFutureWatcherBasePrivate * const d = d_func(); | - |
| 155 | static const QMetaMethod resultReadyAtSignal = QMetaMethod::fromSignal(&QFutureWatcherBase::resultReadyAt); | - |
| 156 | if (signal == resultReadyAtSignal) evaluated: signal == resultReadyAtSignal| yes Evaluation Count:16 | yes Evaluation Count:15 |
| 15-16 |
| 157 | d->resultAtConnected.deref(); executed: d->resultAtConnected.deref();Execution Count:16 | 16 |
| 158 | } executed: }Execution Count:31 | 31 |
| 159 | | - |
| 160 | | - |
| 161 | | - |
| 162 | | - |
| 163 | QFutureWatcherBasePrivate::QFutureWatcherBasePrivate() | - |
| 164 | : maximumPendingResultsReady(QThread::idealThreadCount() * 2), | - |
| 165 | resultAtConnected(0) | - |
| 166 | { } executed: }Execution Count:22 | 22 |
| 167 | | - |
| 168 | | - |
| 169 | | - |
| 170 | | - |
| 171 | void QFutureWatcherBase::connectOutputInterface() | - |
| 172 | { | - |
| 173 | futureInterface().d->connectOutputInterface(d_func()); | - |
| 174 | } executed: }Execution Count:28 | 28 |
| 175 | | - |
| 176 | | - |
| 177 | | - |
| 178 | | - |
| 179 | void QFutureWatcherBase::disconnectOutputInterface(bool pendingAssignment) | - |
| 180 | { | - |
| 181 | if (pendingAssignment) { evaluated: pendingAssignment| yes Evaluation Count:28 | yes Evaluation Count:22 |
| 22-28 |
| 182 | QFutureWatcherBasePrivate * const d = d_func(); | - |
| 183 | d->pendingResultsReady.store(0); | - |
| 184 | qDeleteAll(d->pendingCallOutEvents); | - |
| 185 | d->pendingCallOutEvents.clear(); | - |
| 186 | d->finished = false; | - |
| 187 | } executed: }Execution Count:28 | 28 |
| 188 | | - |
| 189 | futureInterface().d->disconnectOutputInterface(d_func()); | - |
| 190 | } executed: }Execution Count:50 | 50 |
| 191 | | - |
| 192 | void QFutureWatcherBasePrivate::postCallOutEvent(const QFutureCallOutEvent &callOutEvent) | - |
| 193 | { | - |
| 194 | QFutureWatcherBase * const q = q_func(); | - |
| 195 | | - |
| 196 | if (callOutEvent.callOutType == QFutureCallOutEvent::ResultsReady) { evaluated: callOutEvent.callOutType == QFutureCallOutEvent::ResultsReady| yes Evaluation Count:1424 | yes Evaluation Count:153 |
| 153-1424 |
| 197 | if (pendingResultsReady.fetchAndAddRelaxed(1) >= maximumPendingResultsReady) evaluated: pendingResultsReady.fetchAndAddRelaxed(1) >= maximumPendingResultsReady| yes Evaluation Count:1355 | yes Evaluation Count:69 |
| 69-1355 |
| 198 | q->futureInterface().d->internal_setThrottled(true); executed: q->futureInterface().d->internal_setThrottled(true);Execution Count:1355 | 1355 |
| 199 | } executed: }Execution Count:1424 | 1424 |
| 200 | | - |
| 201 | QCoreApplication::postEvent(q, callOutEvent.clone()); | - |
| 202 | } executed: }Execution Count:1577 | 1577 |
| 203 | | - |
| 204 | void QFutureWatcherBasePrivate::callOutInterfaceDisconnected() | - |
| 205 | { | - |
| 206 | QCoreApplication::removePostedEvents(q_func(), QEvent::FutureCallOut); | - |
| 207 | } executed: }Execution Count:28 | 28 |
| 208 | | - |
| 209 | void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event) | - |
| 210 | { | - |
| 211 | QFutureWatcherBase * const q = q_func(); | - |
| 212 | | - |
| 213 | switch (event->callOutType) { | - |
| 214 | case QFutureCallOutEvent::Started: | - |
| 215 | q->started(); | - |
| 216 | break; executed: break;Execution Count:20 | 20 |
| 217 | case QFutureCallOutEvent::Finished: | - |
| 218 | finished = true; | - |
| 219 | q->finished(); | - |
| 220 | break; executed: break;Execution Count:17 | 17 |
| 221 | case QFutureCallOutEvent::Canceled: | - |
| 222 | pendingResultsReady.store(0); | - |
| 223 | q->canceled(); | - |
| 224 | break; executed: break;Execution Count:5 | 5 |
| 225 | case QFutureCallOutEvent::Paused: | - |
| 226 | if (q->futureInterface().isCanceled()) partially evaluated: q->futureInterface().isCanceled()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 227 | break; | 0 |
| 228 | q->paused(); | - |
| 229 | break; executed: break;Execution Count:1 | 1 |
| 230 | case QFutureCallOutEvent::Resumed: | - |
| 231 | if (q->futureInterface().isCanceled()) partially evaluated: q->futureInterface().isCanceled()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 232 | break; | 0 |
| 233 | q->resumed(); | - |
| 234 | break; executed: break;Execution Count:1 | 1 |
| 235 | case QFutureCallOutEvent::ResultsReady: { | - |
| 236 | if (q->futureInterface().isCanceled()) evaluated: q->futureInterface().isCanceled()| yes Evaluation Count:1 | yes Evaluation Count:1418 |
| 1-1418 |
| 237 | break; executed: break;Execution Count:1 | 1 |
| 238 | | - |
| 239 | if (pendingResultsReady.fetchAndAddRelaxed(-1) <= maximumPendingResultsReady) evaluated: pendingResultsReady.fetchAndAddRelaxed(-1) <= maximumPendingResultsReady| yes Evaluation Count:63 | yes Evaluation Count:1355 |
| 63-1355 |
| 240 | q->futureInterface().setThrottled(false); executed: q->futureInterface().setThrottled(false);Execution Count:63 | 63 |
| 241 | | - |
| 242 | const int beginIndex = event->index1; | - |
| 243 | const int endIndex = event->index2; | - |
| 244 | | - |
| 245 | q->resultsReadyAt(beginIndex, endIndex); | - |
| 246 | | - |
| 247 | if (resultAtConnected.load() <= 0) evaluated: resultAtConnected.load() <= 0| yes Evaluation Count:1001 | yes Evaluation Count:417 |
| 417-1001 |
| 248 | break; executed: break;Execution Count:1001 | 1001 |
| 249 | | - |
| 250 | for (int i = beginIndex; i < endIndex; ++i) evaluated: i < endIndex| yes Evaluation Count:15008 | yes Evaluation Count:417 |
| 417-15008 |
| 251 | q->resultReadyAt(i); executed: q->resultReadyAt(i);Execution Count:15008 | 15008 |
| 252 | | - |
| 253 | } break; executed: break;Execution Count:417 | 417 |
| 254 | case QFutureCallOutEvent::Progress: | - |
| 255 | if (q->futureInterface().isCanceled()) evaluated: q->futureInterface().isCanceled()| yes Evaluation Count:5 | yes Evaluation Count:32 |
| 5-32 |
| 256 | break; executed: break;Execution Count:5 | 5 |
| 257 | | - |
| 258 | q->progressValueChanged(event->index1); | - |
| 259 | if (!event->text.isNull()) evaluated: !event->text.isNull()| yes Evaluation Count:4 | yes Evaluation Count:28 |
| 4-28 |
| 260 | q->progressTextChanged(event->text); executed: q->progressTextChanged(event->text);Execution Count:4 | 4 |
| 261 | break; executed: break;Execution Count:32 | 32 |
| 262 | case QFutureCallOutEvent::ProgressRange: | - |
| 263 | q->progressRangeChanged(event->index1, event->index2); | - |
| 264 | break; executed: break;Execution Count:21 | 21 |
| 265 | default: break; | 0 |
| 266 | } | - |
| 267 | } executed: }Execution Count:1521 | 1521 |
| 268 | | - |
| 269 | | - |
| | |