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 QV4DEBUGSERVICE_H |
5 | #define QV4DEBUGSERVICE_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include "qv4debuggeragent.h" |
19 | #include "qv4datacollector.h" |
20 | #include <private/qqmlconfigurabledebugservice_p.h> |
21 | #include <private/qqmldebugserviceinterfaces_p.h> |
22 | #include <private/qv4debugging_p.h> |
23 | |
24 | #include <QtCore/QJsonValue> |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | namespace QV4 { struct ExecutionEngine; } |
29 | |
30 | class VariableCollector; |
31 | class V4CommandHandler; |
32 | class UnknownV4CommandHandler; |
33 | class QV4DebugServiceImpl; |
34 | |
35 | class QV4DebugServiceImpl : public QQmlConfigurableDebugService<QV4DebugService> |
36 | { |
37 | Q_OBJECT |
38 | public: |
39 | explicit QV4DebugServiceImpl(QObject *parent = nullptr); |
40 | ~QV4DebugServiceImpl() override; |
41 | |
42 | void engineAdded(QJSEngine *engine) override; |
43 | void engineAboutToBeRemoved(QJSEngine *engine) override; |
44 | |
45 | void stateAboutToBeChanged(State state) override; |
46 | |
47 | void signalEmitted(const QString &signal) override; |
48 | void send(QJsonObject v4Payload); |
49 | |
50 | int selectedFrame() const; |
51 | void selectFrame(int frameNr); |
52 | |
53 | QV4DebuggerAgent debuggerAgent; |
54 | |
55 | protected: |
56 | void messageReceived(const QByteArray &) override; |
57 | void sendSomethingToSomebody(const char *type, int magicNumber = 1); |
58 | |
59 | private: |
60 | friend class QQmlDebuggerServiceFactory; |
61 | |
62 | void handleV4Request(const QByteArray &payload); |
63 | static QByteArray packMessage(const QByteArray &command, |
64 | const QByteArray &message = QByteArray()); |
65 | void processCommand(const QByteArray &command, const QByteArray &data); |
66 | V4CommandHandler *v4CommandHandler(const QString &command) const; |
67 | |
68 | QStringList breakOnSignals; |
69 | static int sequence; |
70 | int theSelectedFrame; |
71 | |
72 | void addHandler(V4CommandHandler* handler); |
73 | QHash<QString, V4CommandHandler*> handlers; |
74 | QScopedPointer<UnknownV4CommandHandler> unknownV4CommandHandler; |
75 | }; |
76 | |
77 | QT_END_NAMESPACE |
78 | |
79 | #endif // QV4DEBUGSERVICE_H |
80 | |