5#ifndef QQUICKWORKERSCRIPT_P_H
6#define QQUICKWORKERSCRIPT_P_H
21#include <QtQmlWorkerScript/private/qtqmlworkerscriptglobal_p.h>
22#include <QtQml/qqmlparserstatus.h>
23#include <QtCore/qthread.h>
24#include <QtQml/qjsvalue.h>
25#include <QtCore/qurl.h>
30class QQuickWorkerScript;
54 Q_DISABLE_COPY_MOVE(QQuickWorkerScript)
55 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
56 Q_PROPERTY(
bool ready READ ready NOTIFY readyChanged REVISION(2, 15))
58 QML_NAMED_ELEMENT(WorkerScript);
59 QML_ADDED_IN_VERSION(2, 0)
61 Q_INTERFACES(QQmlParserStatus)
63 QQuickWorkerScript(QObject *parent =
nullptr);
64 ~QQuickWorkerScript();
67 void setSource(
const QUrl &);
72 void sendMessage(QQmlV4FunctionPtr);
76 Q_REVISION(2, 15)
void readyChanged();
77 void message(
const QJSValue &messageObject);
80 void classBegin() override;
81 void componentComplete() override;
82 bool event(QEvent *) override;
85 QQuickWorkerScriptEngine *engine();
88 QQuickWorkerScriptEngine *m_engine =
nullptr;
90 bool m_componentComplete =
true;
bool event(QEvent *) override
This virtual function receives events to an object and should return true if the event e was recogniz...
static QV4::ReturnedValue method_sendMessage(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
void reportScriptException(WorkerScript *, const QQmlError &error)
QV4::ExecutionEngine * workerEngine(int id)
void reportScriptReady(WorkerScript *)
QHash< int, QBiPointer< QV4::ExecutionEngine, QQuickWorkerScript > > workers
void executeUrl(int, const QUrl &)
~QQuickWorkerScriptEngine()
void sendMessage(int, const QByteArray &)
void removeWorkerScript(int)
int registerWorkerScript(QQuickWorkerScript *)
WorkerDataEvent(int workerId, const QByteArray &data)
WorkerErrorEvent(const QQmlError &error)
WorkerIdEvent(int workerId, WorkerEventType type)
WorkerLoadEvent(int workerId, const QUrl &url)
WorkerRemoveEvent(int workerId)
V4_DEFINE_EXTENSION(WorkerScript, workerScriptExtension)
void ready(QQmlNotifyingBlob *blob) final
WorkerScript(QV4::ExecutionEngine *engine)
QQuickWorkerScriptEnginePrivate * p
QQuickWorkerScript * owner
QV4::ExecutionEngine * engine