Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||
2 | ** | - | ||||||
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||
4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||
5 | ** | - | ||||||
6 | ** This file is part of the QtQml module of the Qt Toolkit. | - | ||||||
7 | ** | - | ||||||
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||
9 | ** Commercial License Usage | - | ||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||
15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||
16 | ** | - | ||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
19 | ** General Public License version 3 as published by the Free Software | - | ||||||
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||
21 | ** packaging of this file. Please review the following information to | - | ||||||
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||
24 | ** | - | ||||||
25 | ** GNU General Public License Usage | - | ||||||
26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||
27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||
28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||
29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||
31 | ** included in the packaging of this file. Please review the following | - | ||||||
32 | ** information to ensure the GNU General Public License requirements will | - | ||||||
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||
35 | ** | - | ||||||
36 | ** $QT_END_LICENSE$ | - | ||||||
37 | ** | - | ||||||
38 | ****************************************************************************/ | - | ||||||
39 | - | |||||||
40 | #ifndef QV4DEBUGJOB_H | - | ||||||
41 | #define QV4DEBUGJOB_H | - | ||||||
42 | - | |||||||
43 | #include "qv4datacollector.h" | - | ||||||
44 | #include <private/qv4engine_p.h> | - | ||||||
45 | - | |||||||
46 | #include <QtCore/qjsonarray.h> | - | ||||||
47 | #include <QtCore/qjsonobject.h> | - | ||||||
48 | - | |||||||
49 | QT_BEGIN_NAMESPACE | - | ||||||
50 | - | |||||||
51 | class QV4DataCollector; | - | ||||||
52 | class QV4DebugJob | - | ||||||
53 | { | - | ||||||
54 | public: | - | ||||||
55 | virtual ~QV4DebugJob(); | - | ||||||
56 | virtual void run() = 0; | - | ||||||
57 | }; | - | ||||||
58 | - | |||||||
59 | class JavaScriptJob : public QV4DebugJob | - | ||||||
60 | { | - | ||||||
61 | QV4::ExecutionEngine *engine; | - | ||||||
62 | int frameNr; | - | ||||||
63 | int context; | - | ||||||
64 | const QString &script; | - | ||||||
65 | bool resultIsException; | - | ||||||
66 | - | |||||||
67 | public: | - | ||||||
68 | JavaScriptJob(QV4::ExecutionEngine *engine, int frameNr, int context, const QString &script); | - | ||||||
69 | void run() override; | - | ||||||
70 | bool hasExeption() const; | - | ||||||
71 | - | |||||||
72 | protected: | - | ||||||
73 | virtual void handleResult(QV4::ScopedValue &result) = 0; | - | ||||||
74 | }; | - | ||||||
75 | - | |||||||
76 | class CollectJob : public QV4DebugJob | - | ||||||
77 | { | - | ||||||
78 | protected: | - | ||||||
79 | QV4DataCollector *collector; | - | ||||||
80 | QJsonObject result; | - | ||||||
81 | QJsonArray collectedRefs; // only for redundantRefs | - | ||||||
82 | - | |||||||
83 | void flushRedundantRefs() | - | ||||||
84 | { | - | ||||||
85 | if (collector->redundantRefs())
| 74-98 | ||||||
86 | collectedRefs = collector->flushCollectedRefs(); executed 98 times by 1 test: collectedRefs = collector->flushCollectedRefs(); Executed by:
| 98 | ||||||
87 | } executed 172 times by 1 test: end of block Executed by:
| 172 | ||||||
88 | - | |||||||
89 | public: | - | ||||||
90 | CollectJob(QV4DataCollector *collector) : collector(collector) {} executed 174 times by 1 test: end of block Executed by:
| 174 | ||||||
91 | const QJsonObject &returnValue() const { return result; } executed 172 times by 1 test: return result; Executed by:
| 172 | ||||||
92 | - | |||||||
93 | // TODO: Drop this method once we don't need to support redundantRefs anymore | - | ||||||
94 | const QJsonArray &refs() const | - | ||||||
95 | { | - | ||||||
96 | Q_ASSERT(collector->redundantRefs()); | - | ||||||
97 | return collectedRefs; never executed: return collectedRefs; | 0 | ||||||
98 | } | - | ||||||
99 | }; | - | ||||||
100 | - | |||||||
101 | class BacktraceJob: public CollectJob | - | ||||||
102 | { | - | ||||||
103 | int fromFrame; | - | ||||||
104 | int toFrame; | - | ||||||
105 | public: | - | ||||||
106 | BacktraceJob(QV4DataCollector *collector, int fromFrame, int toFrame); | - | ||||||
107 | void run() override; | - | ||||||
108 | }; | - | ||||||
109 | - | |||||||
110 | class FrameJob: public CollectJob | - | ||||||
111 | { | - | ||||||
112 | int frameNr; | - | ||||||
113 | bool success; | - | ||||||
114 | - | |||||||
115 | public: | - | ||||||
116 | FrameJob(QV4DataCollector *collector, int frameNr); | - | ||||||
117 | void run() override; | - | ||||||
118 | bool wasSuccessful() const; | - | ||||||
119 | }; | - | ||||||
120 | - | |||||||
121 | class ScopeJob: public CollectJob | - | ||||||
122 | { | - | ||||||
123 | int frameNr; | - | ||||||
124 | int scopeNr; | - | ||||||
125 | bool success; | - | ||||||
126 | - | |||||||
127 | public: | - | ||||||
128 | ScopeJob(QV4DataCollector *collector, int frameNr, int scopeNr); | - | ||||||
129 | void run() override; | - | ||||||
130 | bool wasSuccessful() const; | - | ||||||
131 | }; | - | ||||||
132 | - | |||||||
133 | class ValueLookupJob: public CollectJob | - | ||||||
134 | { | - | ||||||
135 | const QJsonArray handles; | - | ||||||
136 | QString exception; | - | ||||||
137 | - | |||||||
138 | public: | - | ||||||
139 | ValueLookupJob(const QJsonArray &handles, QV4DataCollector *collector); | - | ||||||
140 | void run() override; | - | ||||||
141 | const QString &exceptionMessage() const; | - | ||||||
142 | }; | - | ||||||
143 | - | |||||||
144 | class ExpressionEvalJob: public JavaScriptJob | - | ||||||
145 | { | - | ||||||
146 | QV4DataCollector *collector; | - | ||||||
147 | QString exception; | - | ||||||
148 | QJsonObject result; | - | ||||||
149 | QJsonArray collectedRefs; // only for redundantRefs | - | ||||||
150 | - | |||||||
151 | public: | - | ||||||
152 | ExpressionEvalJob(QV4::ExecutionEngine *engine, int frameNr, int context, | - | ||||||
153 | const QString &expression, QV4DataCollector *collector); | - | ||||||
154 | void handleResult(QV4::ScopedValue &value) override; | - | ||||||
155 | const QString &exceptionMessage() const; | - | ||||||
156 | const QJsonObject &returnValue() const; | - | ||||||
157 | const QJsonArray &refs() const; // only for redundantRefs | - | ||||||
158 | }; | - | ||||||
159 | - | |||||||
160 | class GatherSourcesJob: public QV4DebugJob | - | ||||||
161 | { | - | ||||||
162 | QV4::ExecutionEngine *engine; | - | ||||||
163 | QStringList sources; | - | ||||||
164 | - | |||||||
165 | public: | - | ||||||
166 | GatherSourcesJob(QV4::ExecutionEngine *engine); | - | ||||||
167 | void run() override; | - | ||||||
168 | const QStringList &result() const; | - | ||||||
169 | }; | - | ||||||
170 | - | |||||||
171 | class EvalJob: public JavaScriptJob | - | ||||||
172 | { | - | ||||||
173 | bool result; | - | ||||||
174 | - | |||||||
175 | public: | - | ||||||
176 | EvalJob(QV4::ExecutionEngine *engine, const QString &script); | - | ||||||
177 | - | |||||||
178 | void handleResult(QV4::ScopedValue &result) override; | - | ||||||
179 | bool resultAsBoolean() const; | - | ||||||
180 | }; | - | ||||||
181 | - | |||||||
182 | QT_END_NAMESPACE | - | ||||||
183 | - | |||||||
184 | #endif // QV4DEBUGJOB_H | - | ||||||
185 | - | |||||||
Source code | Switch to Preprocessed file |