OpenCoverage

qqmldelayedcallqueue.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmldelayedcallqueue.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9void QQmlDelayedCallQueue::DelayedFunctionCall::execute(QV4::ExecutionEngine *engine) const-
10{-
11 if (!m_guarded
!m_guardedDescription
TRUEnever evaluated
FALSEevaluated 94 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
||
0-94
12 (!m_objectGuard.isNull()
!m_objectGuard.isNull()Description
TRUEevaluated 82 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qqmlqt
&&
12-82
13 !QQmlData::wasDeleted(m_objectGuard)
!QQmlData::was...m_objectGuard)Description
TRUEevaluated 82 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEnever evaluated
&&
0-82
14 QQmlData::get(m_objectGuard)
QQmlData::get(m_objectGuard)Description
TRUEevaluated 82 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEnever evaluated
&&
0-82
15 !QQmlData::get(m_objectGuard)->isQueuedForDeletion
!QQmlData::get...uedForDeletionDescription
TRUEevaluated 82 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEnever evaluated
)) {
0-82
16-
17 QV4::Scope scope(engine);-
18-
19 QV4::ArrayObject *array = m_args.as<QV4::ArrayObject>();-
20 const QV4::FunctionObject *callback = m_function.as<QV4::FunctionObject>();-
21 ((callback) ? static_cast<void>(0) : qt_assert("callback", __FILE__, 68));-
22 const int argCount = array
arrayDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qqmlqt
FALSEevaluated 76 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
? array->getLength() : 0;
6-76
23 QV4::JSCallData jsCallData(scope, argCount);-
24 *jsCallData->thisObject = QV4::Encode::undefined();-
25-
26 for (int i = 0; i < argCount
i < argCountDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qqmlqt
FALSEevaluated 82 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
; i++) {
10-82
27 jsCallData->args[i] = array->get(i);-
28 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qqmlqt
10
29-
30 callback->call(jsCallData);-
31-
32 if (scope.engine->hasException
scope.engine->hasExceptionDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlqt
FALSEevaluated 80 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
) {
2-80
33 QQmlError error = scope.engine->catchExceptionAsQmlError();-
34 error.setDescription(error.description() + QLatin1String(" (exception occurred during delayed function evaluation)"));-
35 QQmlEnginePrivate::warning(QQmlEnginePrivate::get(scope.engine->qmlEngine()), error);-
36 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlqt
2
37 }
executed 82 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlqt
82
38}
executed 94 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlqt
94
39-
40-
41-
42-
43-
44QQmlDelayedCallQueue::QQmlDelayedCallQueue()-
45 : QObject(nullptr), m_engine(nullptr), m_callbackOutstanding(false)-
46{-
47}
executed 11448 times by 151 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • ...
11448
48-
49QQmlDelayedCallQueue::~QQmlDelayedCallQueue()-
50{-
51}-
52-
53void QQmlDelayedCallQueue::init(QV4::ExecutionEngine* engine)-
54{-
55 m_engine = engine;-
56-
57 const QMetaObject &metaObject = QQmlDelayedCallQueue::staticMetaObject;-
58 int methodIndex = metaObject.indexOfSlot("ticked()");-
59 m_tickedMethod = metaObject.method(methodIndex);-
60}
executed 11448 times by 151 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • ...
11448
61-
62QV4::ReturnedValue QQmlDelayedCallQueue::addUniquelyAndExecuteLater(const QV4::FunctionObject *b, const QV4::Value *, const QV4::Value *argv, int argc)-
63{-
64 QV4::Scope scope(b);-
65 if (argc == 0
argc == 0Description
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
)
0-454
66 return
never executed: return scope.engine->throwError(QString::fromUtf8("Qt.callLater: no arguments given"));
scope.engine->throwError(QString::fromUtf8("Qt.callLater: no arguments given"));
never executed: return scope.engine->throwError(QString::fromUtf8("Qt.callLater: no arguments given"));
0
67-
68 const QV4::FunctionObject *func = argv[0].as<QV4::FunctionObject>();-
69-
70 if (!func
!funcDescription
TRUEnever evaluated
FALSEevaluated 454 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
)
0-454
71 return
never executed: return scope.engine->throwError(QString::fromUtf8("Qt.callLater: first argument not a function or signal"));
scope.engine->throwError(QString::fromUtf8("Qt.callLater: first argument not a function or signal"));
never executed: return scope.engine->throwError(QString::fromUtf8("Qt.callLater: first argument not a function or signal"));
0
72-
73 QPair<QObject *, int> functionData = QV4::QObjectMethod::extractQtMethod(func);-
74 QV4::ReturnedValue arg0 = argc
argcDescription
TRUEevaluated 454 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEnever evaluated
? argv[0].asReturnedValue() : QV4::Encode::undefined();
0-454
75-
76 QVector<DelayedFunctionCall>::Iterator iter;-
77 if (functionData.second != -1
functionData.second != -1Description
TRUEevaluated 236 times by 1 test
Evaluated by:
  • tst_qqmlqt
FALSEevaluated 218 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
) {
218-236
78-
79 iter = m_delayedFunctionCalls.begin();-
80 while (iter != m_delayedFunctionCalls.end()
iter != m_dela...ionCalls.end()Description
TRUEevaluated 410 times by 1 test
Evaluated by:
  • tst_qqmlqt
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qqmlqt
) {
42-410
81 DelayedFunctionCall& dfc = *iter;-
82 QPair<QObject *, int> storedFunctionData = QV4::QObjectMethod::extractQtMethod(dfc.m_function.as<QV4::FunctionObject>());-
83 if (storedFunctionData == functionData
storedFunction...= functionDataDescription
TRUEevaluated 194 times by 1 test
Evaluated by:
  • tst_qqmlqt
FALSEevaluated 216 times by 1 test
Evaluated by:
  • tst_qqmlqt
) {
194-216
84 break;
executed 194 times by 1 test: break;
Executed by:
  • tst_qqmlqt
194
85 }-
86 ++iter;-
87 }
executed 216 times by 1 test: end of block
Executed by:
  • tst_qqmlqt
216
88 }
executed 236 times by 1 test: end of block
Executed by:
  • tst_qqmlqt
else {
236
89-
90 iter = m_delayedFunctionCalls.begin();-
91 while (iter != m_delayedFunctionCalls.end()
iter != m_dela...ionCalls.end()Description
TRUEevaluated 500 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEevaluated 62 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
) {
62-500
92 DelayedFunctionCall& dfc = *iter;-
93 if (arg0 == dfc.m_function.value()
arg0 == dfc.m_function.value()Description
TRUEevaluated 156 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEevaluated 344 times by 1 test
Evaluated by:
  • tst_qqmlqt
) {
156-344
94 break;
executed 156 times by 2 tests: break;
Executed by:
  • tst_examples
  • tst_qqmlqt
156
95 }-
96 ++iter;-
97 }
executed 344 times by 1 test: end of block
Executed by:
  • tst_qqmlqt
344
98 }
executed 218 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlqt
218
99-
100 const bool functionAlreadyStored = (iter != m_delayedFunctionCalls.end());-
101 if (functionAlreadyStored
functionAlreadyStoredDescription
TRUEevaluated 350 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEevaluated 104 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
) {
104-350
102 DelayedFunctionCall dfc = *iter;-
103 m_delayedFunctionCalls.erase(iter);-
104 m_delayedFunctionCalls.append(dfc);-
105 }
executed 350 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlqt
else {
350
106 m_delayedFunctionCalls.append(QV4::PersistentValue(m_engine, arg0));-
107 }
executed 104 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlqt
104
108-
109 DelayedFunctionCall& dfc = m_delayedFunctionCalls.last();-
110 if (dfc.m_objectGuard.isNull()
dfc.m_objectGuard.isNull()Description
TRUEevaluated 104 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEevaluated 350 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
) {
104-350
111 if (functionData.second != -1
functionData.second != -1Description
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qqmlqt
FALSEevaluated 62 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
) {
42-62
112-
113 dfc.m_objectGuard = QQmlGuard<QObject>(functionData.first);-
114 dfc.m_guarded = true;-
115 }
executed 42 times by 1 test: end of block
Executed by:
  • tst_qqmlqt
else if (func->scope()->type == QV4::Heap::ExecutionContext::Type_QmlContext
func->scope()-...ype_QmlContextDescription
TRUEevaluated 60 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlqt
) {
2-60
116 QV4::QmlContext::Data *g = static_cast<QV4::QmlContext::Data *>(func->scope());-
117 ((g->qml()->scopeObject) ? static_cast<void>(0) : qt_assert("g->qml()->scopeObject", __FILE__, 164));-
118 dfc.m_objectGuard = QQmlGuard<QObject>(g->qml()->scopeObject);-
119 dfc.m_guarded = true;-
120 }
executed 60 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlqt
60
121 }
executed 104 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlqt
104
122 storeAnyArguments(dfc, argv, argc, 1, m_engine);-
123-
124 if (!m_callbackOutstanding
!m_callbackOutstandingDescription
TRUEevaluated 24 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEevaluated 430 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
) {
24-430
125 m_tickedMethod.invoke(this, Qt::QueuedConnection);-
126 m_callbackOutstanding = true;-
127 }
executed 24 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlqt
24
128 return
executed 454 times by 2 tests: return QV4::Encode::undefined();
Executed by:
  • tst_examples
  • tst_qqmlqt
QV4::Encode::undefined();
executed 454 times by 2 tests: return QV4::Encode::undefined();
Executed by:
  • tst_examples
  • tst_qqmlqt
454
129}-
130-
131void QQmlDelayedCallQueue::storeAnyArguments(DelayedFunctionCall &dfc, const QV4::Value *argv, int argc, int offset, QV4::ExecutionEngine *engine)-
132{-
133 const int length = argc - offset;-
134 if (length == 0
length == 0Description
TRUEevaluated 442 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qqmlqt
) {
12-442
135 dfc.m_args.clear();-
136 return;
executed 442 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qqmlqt
442
137 }-
138 QV4::Scope scope(engine);-
139 QV4::ScopedArrayObject array(scope, engine->newArrayObject(length));-
140 uint i = 0;-
141 for (int j = offset, ej = argc; j < ej
j < ejDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qqmlqt
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qqmlqt
; ++i, ++j)
12-24
142 array->put(i, argv[j]);
executed 24 times by 1 test: array->put(i, argv[j]);
Executed by:
  • tst_qqmlqt
24
143 dfc.m_args.set(engine, array);-
144}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qqmlqt
12
145-
146void QQmlDelayedCallQueue::executeAllExpired_Later()-
147{-
148-
149-
150 QVector<DelayedFunctionCall> delayedCalls = m_delayedFunctionCalls;-
151 m_delayedFunctionCalls.clear();-
152-
153 QVector<DelayedFunctionCall>::Iterator iter = delayedCalls.begin();-
154 while (iter != delayedCalls.end()
iter != delayedCalls.end()Description
TRUEevaluated 94 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qqmlqt
) {
22-94
155 DelayedFunctionCall& dfc = *iter;-
156 dfc.execute(m_engine);-
157 ++iter;-
158 }
executed 94 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlqt
94
159}
executed 22 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlqt
22
160-
161void QQmlDelayedCallQueue::ticked()-
162{-
163 m_callbackOutstanding = false;-
164 executeAllExpired_Later();-
165}
executed 22 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlqt
22
166-
167-
168-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0