| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QQMLENGINECONTROLSERVICE_H |
| 5 | #define QQMLENGINECONTROLSERVICE_H |
| 6 | |
| 7 | #include <QMutex> |
| 8 | #include <private/qqmldebugserviceinterfaces_p.h> |
| 9 | |
| 10 | // |
| 11 | // W A R N I N G |
| 12 | // ------------- |
| 13 | // |
| 14 | // This file is not part of the Qt API. It exists purely as an |
| 15 | // implementation detail. This header file may change from version to |
| 16 | // version without notice, or even be removed. |
| 17 | // |
| 18 | // We mean it. |
| 19 | // |
| 20 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | class QQmlEngineControlServiceImpl : public QQmlEngineControlService |
| 24 | { |
| 25 | public: |
| 26 | enum MessageType { |
| 27 | EngineAboutToBeAdded, |
| 28 | EngineAdded, |
| 29 | EngineAboutToBeRemoved, |
| 30 | EngineRemoved |
| 31 | }; |
| 32 | |
| 33 | enum CommandType { |
| 34 | StartWaitingEngine, |
| 35 | StopWaitingEngine |
| 36 | }; |
| 37 | |
| 38 | QQmlEngineControlServiceImpl(QObject *parent = nullptr); |
| 39 | |
| 40 | protected: |
| 41 | friend class QQmlProfilerServiceFactory; |
| 42 | |
| 43 | QMutex dataMutex; |
| 44 | QList<QJSEngine *> startingEngines; |
| 45 | QList<QJSEngine *> stoppingEngines; |
| 46 | bool blockingMode; |
| 47 | |
| 48 | void messageReceived(const QByteArray &) override; |
| 49 | void engineAboutToBeAdded(QJSEngine *) override; |
| 50 | void engineAboutToBeRemoved(QJSEngine *) override; |
| 51 | void engineAdded(QJSEngine *) override; |
| 52 | void engineRemoved(QJSEngine *) override; |
| 53 | |
| 54 | void sendMessage(MessageType type, QJSEngine *engine); |
| 55 | |
| 56 | void stateChanged(State) override; |
| 57 | }; |
| 58 | |
| 59 | QT_END_NAMESPACE |
| 60 | |
| 61 | #endif // QQMLENGINECONTROLSERVICE_H |
| 62 |
