OpenCoverage

qquickworkerscript.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/types/qquickworkerscript.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11class WorkerDataEvent : public QEvent-
12{-
13public:-
14 enum Type { WorkerData = QEvent::User };-
15-
16 WorkerDataEvent(int workerId, const QByteArray &data);-
17 virtual ~WorkerDataEvent();-
18-
19 int workerId() const;-
20 QByteArray data() const;-
21-
22private:-
23 int m_id;-
24 QByteArray m_data;-
25};-
26-
27class WorkerLoadEvent : public QEvent-
28{-
29public:-
30 enum Type { WorkerLoad = WorkerDataEvent::WorkerData + 1 };-
31-
32 WorkerLoadEvent(int workerId, const QUrl &url);-
33-
34 int workerId() const;-
35 QUrl url() const;-
36-
37private:-
38 int m_id;-
39 QUrl m_url;-
40};-
41-
42class WorkerRemoveEvent : public QEvent-
43{-
44public:-
45 enum Type { WorkerRemove = WorkerLoadEvent::WorkerLoad + 1 };-
46-
47 WorkerRemoveEvent(int workerId);-
48-
49 int workerId() const;-
50-
51private:-
52 int m_id;-
53};-
54-
55class WorkerErrorEvent : public QEvent-
56{-
57public:-
58 enum Type { WorkerError = WorkerRemoveEvent::WorkerRemove + 1 };-
59-
60 WorkerErrorEvent(const QQmlError &error);-
61-
62 QQmlError error() const;-
63-
64private:-
65 QQmlError m_error;-
66};-
67-
68class QQuickWorkerScriptEnginePrivate : public QObject-
69{-
70 public:-
71#pragma GCC diagnostic push-
72 -
73#pragma GCC diagnostic ignored "-Wsuggest-override"-
74 static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private:-
75#pragma GCC diagnostic ignored "-Wattributes"-
76 __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
77#pragma GCC diagnostic pop-
78 struct QPrivateSignal {};-
79public:-
80 enum WorkerEventTypes {-
81 WorkerDestroyEvent = QEvent::User + 100-
82 };-
83-
84 QQuickWorkerScriptEnginePrivate(QQmlEngine *eng);-
85-
86 class WorkerEngine : public QV8Engine-
87 {-
88 public:-
89 WorkerEngine(QQuickWorkerScriptEnginePrivate *parent);-
90 ~WorkerEngine();-
91-
92 void init();-
93-
94-
95 QNetworkAccessManager *networkAccessManager() override;-
96-
97-
98 QQuickWorkerScriptEnginePrivate *p;-
99-
100 QV4::ReturnedValue sendFunction(int id);-
101-
102 QV4::PersistentValue onmessage;-
103 private:-
104 QV4::PersistentValue createsend;-
105-
106 QNetworkAccessManager *accessManager;-
107-
108 };-
109-
110 WorkerEngine *workerEngine;-
111 static QQuickWorkerScriptEnginePrivate *get(QV8Engine *e) {-
112 return
executed 8 times by 1 test: return static_cast<WorkerEngine *>(e)->p;
Executed by:
  • tst_qquickworkerscript
static_cast<WorkerEngine *>(e)->p;
executed 8 times by 1 test: return static_cast<WorkerEngine *>(e)->p;
Executed by:
  • tst_qquickworkerscript
8
113 }-
114-
115 QQmlEngine *qmlengine;-
116-
117 QMutex m_lock;-
118 QWaitCondition m_wait;-
119-
120 struct WorkerScript {-
121 WorkerScript();-
122 ~WorkerScript();-
123-
124 int id;-
125 QUrl source;-
126 bool initialized;-
127 QQuickWorkerScript *owner;-
128 QV4::PersistentValue qmlContext;-
129 };-
130-
131 QHash<int, WorkerScript *> workers;-
132 QV4::ReturnedValue getWorker(WorkerScript *);-
133-
134 int m_nextId;-
135-
136 static QV4::ReturnedValue method_sendMessage(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
137-
138public :-
139 void stopThread();-
140-
141protected:-
142 bool event(QEvent *) override;-
143-
144private:-
145 void processMessage(int, const QByteArray &);-
146 void processLoad(int, const QUrl &);-
147 void reportScriptException(WorkerScript *, const QQmlError &error);-
148};-
149-
150QQuickWorkerScriptEnginePrivate::WorkerEngine::WorkerEngine(QQuickWorkerScriptEnginePrivate *parent)-
151 : QV8Engine(new QV4::ExecutionEngine), p(parent)-
152-
153, accessManager(nullptr)-
154-
155{-
156 m_v4Engine->v8Engine = this;-
157}
executed 1110 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1110
158-
159QQuickWorkerScriptEnginePrivate::WorkerEngine::~WorkerEngine()-
160{-
161-
162 delete accessManager;-
163-
164 delete m_v4Engine;-
165}
executed 1110 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1110
166-
167void QQuickWorkerScriptEnginePrivate::WorkerEngine::init()-
168{-
169 initQmlGlobalObject();-
170 QV4::Scope scope(m_v4Engine);-
171 QV4::ExecutionContext *globalContext = scope.engine->rootContext();-
172 onmessage.set(scope.engine, QV4::Script(globalContext, QV4::Compiler::ContextType::Global, QString::fromUtf8("(function(object, message) { " "var isfunction = false; " "try { " "isfunction = object.WorkerScript.onMessage instanceof Function; " "} catch (e) {}" "if (isfunction) " "object.WorkerScript.onMessage(message); " "})")).run());-
173 ((!scope.engine->hasException) ? static_cast<void>(0) : qt_assert("!scope.engine->hasException", __FILE__, 248));-
174 QV4::Script createsendscript(globalContext, QV4::Compiler::ContextType::Global, QString::fromUtf8("(function(method, engine) { " "return (function(id) { " "return (function(message) { " "if (arguments.length) method(engine, id, message); " "}); " "}); " "})"));-
175 QV4::ScopedFunctionObject createsendconstructor(scope, createsendscript.run());-
176 ((!scope.engine->hasException) ? static_cast<void>(0) : qt_assert("!scope.engine->hasException", __FILE__, 251));-
177 QV4::ScopedString name(scope, m_v4Engine->newString(([]() noexcept -> QString { enum { Size = sizeof(u"" "sendMessage")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "sendMessage" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 1110 times by 5 tests: return qstring_literal_temp;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
qstring_literal_temp;
executed 1110 times by 5 tests: return qstring_literal_temp;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
}())));
1110
178 QV4::ScopedValue function(scope, QV4::FunctionObject::createBuiltinFunction(m_v4Engine, name, method_sendMessage, 1));-
179 QV4::JSCallData jsCallData(scope, 1);-
180 jsCallData->args[0] = function;-
181 *jsCallData->thisObject = m_v4Engine->global();-
182 createsend.set(scope.engine, createsendconstructor->call(jsCallData));-
183}
executed 1110 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1110
184-
185-
186QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::WorkerEngine::sendFunction(int id)-
187{-
188 QV4::ExecutionEngine *v4 = createsend.engine();-
189 if (!v4
!v4Description
TRUEnever evaluated
FALSEevaluated 1152 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
)
0-1152
190 return
never executed: return QV4::Encode::undefined();
QV4::Encode::undefined();
never executed: return QV4::Encode::undefined();
0
191-
192 QV4::Scope scope(v4);-
193 QV4::ScopedFunctionObject f(scope, createsend.value());-
194-
195 QV4::ScopedValue v(scope);-
196 QV4::JSCallData jsCallData(scope, 1);-
197 jsCallData->args[0] = QV4::Primitive::fromInt32(id);-
198 *jsCallData->thisObject = m_v4Engine->global();-
199 v = f->call(jsCallData);-
200 if (scope.hasException()
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 1152 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
)
0-1152
201 v = scope.engine->catchException();
never executed: v = scope.engine->catchException();
0
202 return
executed 1152 times by 5 tests: return v->asReturnedValue();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
v->asReturnedValue();
executed 1152 times by 5 tests: return v->asReturnedValue();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
203}-
204-
205-
206QNetworkAccessManager *QQuickWorkerScriptEnginePrivate::WorkerEngine::networkAccessManager()-
207{-
208 if (!accessManager
!accessManagerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
209 if (p->qmlengine
p->qmlengineDescription
TRUEnever evaluated
FALSEnever evaluated
&& p->qmlengine->networkAccessManagerFactory()
p->qmlengine->...nagerFactory()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
210 accessManager = p->qmlengine->networkAccessManagerFactory()->create(p);-
211 }
never executed: end of block
else {
0
212 accessManager = new QNetworkAccessManager(p);-
213 }
never executed: end of block
0
214 }-
215 return
never executed: return accessManager;
accessManager;
never executed: return accessManager;
0
216}-
217-
218-
219QQuickWorkerScriptEnginePrivate::QQuickWorkerScriptEnginePrivate(QQmlEngine *engine)-
220: workerEngine(nullptr), qmlengine(engine), m_nextId(0)-
221{-
222}
executed 1110 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1110
223-
224QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::method_sendMessage(const QV4::FunctionObject *b,-
225 const QV4::Value *, const QV4::Value *argv, int argc)-
226{-
227 QV4::Scope scope(b);-
228 WorkerEngine *engine = static_cast<WorkerEngine *>(scope.engine->v8Engine);-
229-
230 int id = argc > 1
argc > 1Description
TRUEevaluated 976 times by 4 tests
Evaluated by:
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEnever evaluated
? argv[1].toInt32() : 0;
0-976
231-
232 QV4::ScopedValue v(scope, argc > 2 ? argv[2] : QV4::Primitive::undefinedValue());-
233 QByteArray data = QV4::Serialize::serialize(v, scope.engine);-
234-
235 QMutexLocker locker(&engine->p->m_lock);-
236 WorkerScript *script = engine->p->workers.value(id);-
237 if (script
scriptDescription
TRUEevaluated 976 times by 4 tests
Evaluated by:
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEnever evaluated
&& script->owner
script->ownerDescription
TRUEevaluated 972 times by 4 tests
Evaluated by:
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmllistmodelworkerscript
)
0-976
238 QCoreApplication::postEvent(script->owner, new WorkerDataEvent(0, data));
executed 972 times by 4 tests: QCoreApplication::postEvent(script->owner, new WorkerDataEvent(0, data));
Executed by:
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
972
239-
240 return
executed 976 times by 4 tests: return QV4::Encode::undefined();
Executed by:
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
QV4::Encode::undefined();
executed 976 times by 4 tests: return QV4::Encode::undefined();
Executed by:
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
976
241}-
242-
243QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::getWorker(WorkerScript *script)-
244{-
245 if (!script->initialized
!script->initializedDescription
TRUEevaluated 1152 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
) {
2-1152
246 script->initialized = true;-
247-
248 QV4::ExecutionEngine *v4 = QV8Engine::getV4(workerEngine);-
249 QV4::Scope scope(v4);-
250 QV4::ScopedValue v(scope, workerEngine->sendFunction(script->id));-
251 script->qmlContext.set(v4, QV4::QmlContext::createWorkerContext(v4->rootContext(), script->source, v));-
252 }
executed 1152 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
253-
254 return
executed 1154 times by 5 tests: return script->qmlContext.value();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
script->qmlContext.value();
executed 1154 times by 5 tests: return script->qmlContext.value();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1154
255}-
256-
257bool QQuickWorkerScriptEnginePrivate::event(QEvent *event)-
258{-
259 if (event->type() == (QEvent::Type)WorkerDataEvent::WorkerData
event->type() ...nt::WorkerDataDescription
TRUEevaluated 1182 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 4526 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
1182-4526
260 WorkerDataEvent *workerEvent = static_cast<WorkerDataEvent *>(event);-
261 processMessage(workerEvent->workerId(), workerEvent->data());-
262 return
executed 1182 times by 5 tests: return true;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
true;
executed 1182 times by 5 tests: return true;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1182
263 } else if (event->type() == (QEvent::Type)WorkerLoadEvent::WorkerLoad
event->type() ...nt::WorkerLoadDescription
TRUEevaluated 1154 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 3372 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
1154-3372
264 WorkerLoadEvent *workerEvent = static_cast<WorkerLoadEvent *>(event);-
265 processLoad(workerEvent->workerId(), workerEvent->url());-
266 return
executed 1154 times by 5 tests: return true;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
true;
executed 1154 times by 5 tests: return true;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1154
267 } else if (event->type() == (QEvent::Type)WorkerDestroyEvent
event->type() ...erDestroyEventDescription
TRUEevaluated 1110 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 2262 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
1110-2262
268 stopThread();-
269 return
executed 1110 times by 5 tests: return true;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
true;
executed 1110 times by 5 tests: return true;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1110
270 } else if (event->type() == (QEvent::Type)WorkerRemoveEvent::WorkerRemove
event->type() ...::WorkerRemoveDescription
TRUEevaluated 1152 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 1110 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
1110-1152
271 WorkerRemoveEvent *workerEvent = static_cast<WorkerRemoveEvent *>(event);-
272 QHash<int, WorkerScript *>::iterator itr = workers.find(workerEvent->workerId());-
273 if (itr != workers.end()
itr != workers.end()Description
TRUEevaluated 1152 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEnever evaluated
) {
0-1152
274 delete itr.value();-
275 workers.erase(itr);-
276 }
executed 1152 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
277 return
executed 1152 times by 5 tests: return true;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
true;
executed 1152 times by 5 tests: return true;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
278 } else {-
279 return
executed 1110 times by 5 tests: return QObject::event(event);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
QObject::event(event);
executed 1110 times by 5 tests: return QObject::event(event);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1110
280 }-
281}-
282-
283void QQuickWorkerScriptEnginePrivate::processMessage(int id, const QByteArray &data)-
284{-
285 WorkerScript *script = workers.value(id);-
286 if (!script
!scriptDescription
TRUEnever evaluated
FALSEevaluated 1182 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
)
0-1182
287 return;
never executed: return;
0
288-
289 QV4::ExecutionEngine *v4 = QV8Engine::getV4(workerEngine);-
290 QV4::Scope scope(v4);-
291 QV4::ScopedFunctionObject f(scope, workerEngine->onmessage.value());-
292-
293 QV4::ScopedValue value(scope, QV4::Serialize::deserialize(data, v4));-
294 QV4::Scoped<QV4::QmlContext> qmlContext(scope, script->qmlContext.value());-
295 ((!!qmlContext) ? static_cast<void>(0) : qt_assert("!!qmlContext", __FILE__, 370));-
296-
297 QV4::JSCallData jsCallData(scope, 2);-
298 *jsCallData->thisObject = v4->global();-
299 jsCallData->args[0] = qmlContext->d()->qml();-
300 jsCallData->args[1] = value;-
301 f->call(jsCallData);-
302 if (scope.hasException()
scope.hasException()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
FALSEevaluated 1178 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
4-1178
303 QQmlError error = scope.engine->catchExceptionAsQmlError();-
304 reportScriptException(script, error);-
305 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickworkerscript
4
306}
executed 1182 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1182
307-
308void QQuickWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url)-
309{-
310 if (url.isRelative()
url.isRelative()Description
TRUEnever evaluated
FALSEevaluated 1154 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
)
0-1154
311 return;
never executed: return;
0
312-
313 QString fileName = QQmlFile::urlToLocalFileOrQrc(url);-
314-
315 QV4::ExecutionEngine *v4 = QV8Engine::getV4(workerEngine);-
316 QV4::Scope scope(v4);-
317 QScopedPointer<QV4::Script> program;-
318-
319 WorkerScript *script = workers.value(id);-
320 if (!script
!scriptDescription
TRUEnever evaluated
FALSEevaluated 1154 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
)
0-1154
321 return;
never executed: return;
0
322 script->source = url;-
323-
324 QV4::Scoped<QV4::QmlContext> qmlContext(scope, getWorker(script));-
325 ((!!qmlContext) ? static_cast<void>(0) : qt_assert("!!qmlContext", __FILE__, 400));-
326-
327 QString error;-
328 program.reset(QV4::Script::createFromFileOrCache(v4, qmlContext, fileName, url, &error));-
329 if (program.isNull()
program.isNull()Description
TRUEnever evaluated
FALSEevaluated 1154 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
0-1154
330 if (!error.isEmpty()
!error.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
331 QMessageLogger(__FILE__, 406, __PRETTY_FUNCTION__).warning().nospace() << error;
never executed: QMessageLogger(__FILE__, 406, __PRETTY_FUNCTION__).warning().nospace() << error;
0
332 return;
never executed: return;
0
333 }-
334-
335 if (!v4->hasException
!v4->hasExceptionDescription
TRUEevaluated 1152 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
)
2-1152
336 program->run();
executed 1152 times by 5 tests: program->run();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
337-
338 if (v4->hasException
v4->hasExceptionDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
FALSEevaluated 1150 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
4-1150
339 QQmlError error = v4->catchExceptionAsQmlError();-
340 reportScriptException(script, error);-
341 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickworkerscript
4
342}
executed 1154 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1154
343-
344void QQuickWorkerScriptEnginePrivate::reportScriptException(WorkerScript *script,-
345 const QQmlError &error)-
346{-
347 QQuickWorkerScriptEnginePrivate *p = QQuickWorkerScriptEnginePrivate::get(workerEngine);-
348-
349 QMutexLocker locker(&p->m_lock);-
350 if (script->owner
script->ownerDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
FALSEnever evaluated
)
0-8
351 QCoreApplication::postEvent(script->owner, new WorkerErrorEvent(error));
executed 8 times by 1 test: QCoreApplication::postEvent(script->owner, new WorkerErrorEvent(error));
Executed by:
  • tst_qquickworkerscript
8
352}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickworkerscript
8
353-
354WorkerDataEvent::WorkerDataEvent(int workerId, const QByteArray &data)-
355: QEvent((QEvent::Type)WorkerData), m_id(workerId), m_data(data)-
356{-
357}
executed 2154 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
2154
358-
359WorkerDataEvent::~WorkerDataEvent()-
360{-
361}-
362-
363int WorkerDataEvent::workerId() const-
364{-
365 return
executed 1182 times by 5 tests: return m_id;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
m_id;
executed 1182 times by 5 tests: return m_id;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1182
366}-
367-
368QByteArray WorkerDataEvent::data() const-
369{-
370 return
executed 2154 times by 5 tests: return m_data;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
m_data;
executed 2154 times by 5 tests: return m_data;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
2154
371}-
372-
373WorkerLoadEvent::WorkerLoadEvent(int workerId, const QUrl &url)-
374: QEvent((QEvent::Type)WorkerLoad), m_id(workerId), m_url(url)-
375{-
376}
executed 1154 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1154
377-
378int WorkerLoadEvent::workerId() const-
379{-
380 return
executed 1154 times by 5 tests: return m_id;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
m_id;
executed 1154 times by 5 tests: return m_id;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1154
381}-
382-
383QUrl WorkerLoadEvent::url() const-
384{-
385 return
executed 1154 times by 5 tests: return m_url;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
m_url;
executed 1154 times by 5 tests: return m_url;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1154
386}-
387-
388WorkerRemoveEvent::WorkerRemoveEvent(int workerId)-
389: QEvent((QEvent::Type)WorkerRemove), m_id(workerId)-
390{-
391}
executed 1152 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
392-
393int WorkerRemoveEvent::workerId() const-
394{-
395 return
executed 1152 times by 5 tests: return m_id;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
m_id;
executed 1152 times by 5 tests: return m_id;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
396}-
397-
398WorkerErrorEvent::WorkerErrorEvent(const QQmlError &error)-
399: QEvent((QEvent::Type)WorkerError), m_error(error)-
400{-
401}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickworkerscript
8
402-
403QQmlError WorkerErrorEvent::error() const-
404{-
405 return
executed 8 times by 1 test: return m_error;
Executed by:
  • tst_qquickworkerscript
m_error;
executed 8 times by 1 test: return m_error;
Executed by:
  • tst_qquickworkerscript
8
406}-
407-
408QQuickWorkerScriptEngine::QQuickWorkerScriptEngine(QQmlEngine *parent)-
409: QThread(parent), d(new QQuickWorkerScriptEnginePrivate(parent))-
410{-
411 d->m_lock.lock();-
412 connect(d, qFlagLocation("2""stopThread()" "\0" __FILE__ ":" "487"), this, qFlagLocation("1""quit()" "\0" __FILE__ ":" "487"), Qt::DirectConnection);-
413 start(QThread::LowestPriority);-
414 d->m_wait.wait(&d->m_lock);-
415 d->moveToThread(this);-
416 d->m_lock.unlock();-
417}
executed 1110 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1110
418-
419QQuickWorkerScriptEngine::~QQuickWorkerScriptEngine()-
420{-
421 d->m_lock.lock();-
422 QCoreApplication::postEvent(d, new QEvent((QEvent::Type)QQuickWorkerScriptEnginePrivate::WorkerDestroyEvent));-
423 d->m_lock.unlock();-
424-
425-
426-
427-
428 while (!isFinished()
!isFinished()Description
TRUEevaluated 136696 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 1110 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
1110-136696
429-
430-
431 QCoreApplication::processEvents();-
432 yieldCurrentThread();-
433 }
executed 136696 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
136696
434-
435 d->deleteLater();-
436}
executed 1110 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1110
437-
438QQuickWorkerScriptEnginePrivate::WorkerScript::WorkerScript()-
439: id(-1), initialized(false), owner(nullptr)-
440{-
441}
executed 1152 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
442-
443QQuickWorkerScriptEnginePrivate::WorkerScript::~WorkerScript()-
444{-
445}-
446-
447int QQuickWorkerScriptEngine::registerWorkerScript(QQuickWorkerScript *owner)-
448{-
449 typedef QQuickWorkerScriptEnginePrivate::WorkerScript WorkerScript;-
450 WorkerScript *script = new WorkerScript;-
451-
452 script->id = d->m_nextId++;-
453 script->owner = owner;-
454-
455 d->m_lock.lock();-
456 d->workers.insert(script->id, script);-
457 d->m_lock.unlock();-
458-
459 return
executed 1152 times by 5 tests: return script->id;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
script->id;
executed 1152 times by 5 tests: return script->id;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
460}-
461-
462void QQuickWorkerScriptEngine::removeWorkerScript(int id)-
463{-
464 QQuickWorkerScriptEnginePrivate::WorkerScript* script = d->workers.value(id);-
465 if (script
scriptDescription
TRUEevaluated 1152 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEnever evaluated
) {
0-1152
466 script->owner = nullptr;-
467 QCoreApplication::postEvent(d, new WorkerRemoveEvent(id));-
468 }
executed 1152 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
469}
executed 1152 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
470-
471void QQuickWorkerScriptEngine::executeUrl(int id, const QUrl &url)-
472{-
473 QCoreApplication::postEvent(d, new WorkerLoadEvent(id, url));-
474}
executed 1154 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1154
475-
476void QQuickWorkerScriptEngine::sendMessage(int id, const QByteArray &data)-
477{-
478 QCoreApplication::postEvent(d, new WorkerDataEvent(id, data));-
479}
executed 1182 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1182
480-
481void QQuickWorkerScriptEngine::run()-
482{-
483 d->m_lock.lock();-
484-
485 d->workerEngine = new QQuickWorkerScriptEnginePrivate::WorkerEngine(d);-
486 d->workerEngine->init();-
487-
488 d->m_wait.wakeAll();-
489-
490 d->m_lock.unlock();-
491-
492 exec();-
493-
494 qDeleteAll(d->workers);-
495 d->workers.clear();-
496-
497 delete d->workerEngine; d->workerEngine = nullptr;-
498}
executed 1110 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1110
499QQuickWorkerScript::QQuickWorkerScript(QObject *parent)-
500: QObject(parent), m_engine(nullptr), m_scriptId(-1), m_componentComplete(true)-
501{-
502}
executed 1152 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
503-
504QQuickWorkerScript::~QQuickWorkerScript()-
505{-
506 if (m_scriptId != -1
m_scriptId != -1Description
TRUEevaluated 1152 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEnever evaluated
) m_engine->removeWorkerScript(m_scriptId);
executed 1152 times by 5 tests: m_engine->removeWorkerScript(m_scriptId);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
0-1152
507}
executed 1152 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
508-
509-
510-
511-
512-
513-
514-
515QUrl QQuickWorkerScript::source() const-
516{-
517 return
executed 2 times by 1 test: return m_source;
Executed by:
  • tst_qquickworkerscript
m_source;
executed 2 times by 1 test: return m_source;
Executed by:
  • tst_qquickworkerscript
2
518}-
519-
520void QQuickWorkerScript::setSource(const QUrl &source)-
521{-
522 if (m_source == source
m_source == sourceDescription
TRUEnever evaluated
FALSEevaluated 1154 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
)
0-1154
523 return;
never executed: return;
0
524-
525 m_source = source;-
526-
527 if (engine()
engine()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
FALSEevaluated 1152 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
)
2-1152
528 m_engine->executeUrl(m_scriptId, m_source);
executed 2 times by 1 test: m_engine->executeUrl(m_scriptId, m_source);
Executed by:
  • tst_qquickworkerscript
2
529-
530 sourceChanged();-
531}
executed 1154 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1154
532void QQuickWorkerScript::sendMessage(QQmlV4Function *args)-
533{-
534 if (!engine()
!engine()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 1182 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
4-1182
535 QMessageLogger(__FILE__, 679, __PRETTY_FUNCTION__).warning("QQuickWorkerScript: Attempt to send message before WorkerScript establishment");-
536 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_examples
4
537 }-
538-
539 QV4::Scope scope(args->v4engine());-
540 QV4::ScopedValue argument(scope, QV4::Primitive::undefinedValue());-
541 if (args->length() != 0
args->length() != 0Description
TRUEevaluated 1182 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEnever evaluated
)
0-1182
542 argument = (*args)[0];
executed 1182 times by 5 tests: argument = (*args)[0];
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1182
543-
544 m_engine->sendMessage(m_scriptId, QV4::Serialize::serialize(argument, scope.engine));-
545}
executed 1182 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1182
546-
547void QQuickWorkerScript::classBegin()-
548{-
549 m_componentComplete = false;-
550}
executed 1152 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
551-
552QQuickWorkerScriptEngine *QQuickWorkerScript::engine()-
553{-
554 if (m_engine
m_engineDescription
TRUEevaluated 1184 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 2308 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) return
executed 1184 times by 5 tests: return m_engine;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
m_engine;
executed 1184 times by 5 tests: return m_engine;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1184-2308
555 if (m_componentComplete
m_componentCompleteDescription
TRUEevaluated 1152 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 1156 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
1152-1156
556 QQmlEngine *engine = qmlEngine(this);-
557 if (!engine
!engineDescription
TRUEnever evaluated
FALSEevaluated 1152 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
) {
0-1152
558 QMessageLogger(__FILE__, 702, __PRETTY_FUNCTION__).warning("QQuickWorkerScript: engine() called without qmlEngine() set");-
559 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
560 }-
561-
562 m_engine = QQmlEnginePrivate::get(engine)->getWorkerScriptEngine();-
563 m_scriptId = m_engine->registerWorkerScript(this);-
564-
565 if (m_source.isValid()
m_source.isValid()Description
TRUEevaluated 1152 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEnever evaluated
)
0-1152
566 m_engine->executeUrl(m_scriptId, m_source);
executed 1152 times by 5 tests: m_engine->executeUrl(m_scriptId, m_source);
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
567-
568 return
executed 1152 times by 5 tests: return m_engine;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
m_engine;
executed 1152 times by 5 tests: return m_engine;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
569 }-
570 return
executed 1156 times by 5 tests: return nullptr;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
nullptr;
executed 1156 times by 5 tests: return nullptr;
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1156
571}-
572-
573void QQuickWorkerScript::componentComplete()-
574{-
575 m_componentComplete = true;-
576 engine();-
577}
executed 1152 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
1152
578bool QQuickWorkerScript::event(QEvent *event)-
579{-
580 if (event->type() == (QEvent::Type)WorkerDataEvent::WorkerData
event->type() ...nt::WorkerDataDescription
TRUEevaluated 972 times by 4 tests
Evaluated by:
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
) {
8-972
581 QQmlEngine *engine = qmlEngine(this);-
582 if (engine
engineDescription
TRUEevaluated 972 times by 4 tests
Evaluated by:
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
FALSEnever evaluated
) {
0-972
583 WorkerDataEvent *workerEvent = static_cast<WorkerDataEvent *>(event);-
584 QV4::Scope scope(engine->handle());-
585 QV4::ScopedValue value(scope, QV4::Serialize::deserialize(workerEvent->data(), scope.engine));-
586 message(QQmlV4Handle(value));-
587 }
executed 972 times by 4 tests: end of block
Executed by:
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
972
588 return
executed 972 times by 4 tests: return true;
Executed by:
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
true;
executed 972 times by 4 tests: return true;
Executed by:
  • tst_qmlcachegen
  • tst_qqmlecmascript
  • tst_qqmllistmodelworkerscript
  • tst_qquickworkerscript
972
589 } else if (event->type() == (QEvent::Type)WorkerErrorEvent::WorkerError
event->type() ...t::WorkerErrorDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickworkerscript
FALSEnever evaluated
) {
0-8
590 WorkerErrorEvent *workerEvent = static_cast<WorkerErrorEvent *>(event);-
591 QQmlEnginePrivate::warning(qmlEngine(this), workerEvent->error());-
592 return
executed 8 times by 1 test: return true;
Executed by:
  • tst_qquickworkerscript
true;
executed 8 times by 1 test: return true;
Executed by:
  • tst_qquickworkerscript
8
593 } else {-
594 return
never executed: return QObject::event(event);
QObject::event(event);
never executed: return QObject::event(event);
0
595 }-
596}-
597-
598-
599-
600-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0