diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-11-30 12:04:59 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-01-21 14:49:39 +0000 |
commit | ebb08ee84e8141042ed16dfc5892697ef96077c4 (patch) | |
tree | 1d7aecd7540d9e015215a2f00d2482800185822a /src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h | |
parent | 706238e037da37a28514336e1e264709f049fba7 (diff) |
V4 Debugger: Avoid looking up values in debugger thread
To avoid interaction with the engine from the debugger thread we
move the value lookup functionality into the data collector, and
drop the RefHolder. Also, we define some more debugger jobs to
move the work the request handlers do into the GUI thread.
Task-number: QTBUG-50481
Change-Id: Id93548dc65133246deac71f73188c715e9dc01e4
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h | 91 |
1 files changed, 44 insertions, 47 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h index e48b5b1e5e..a1adbeff40 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h @@ -72,88 +72,86 @@ protected: virtual void handleResult(QV4::ScopedValue &result) = 0; }; -class ValueLookupJob: public QV4DebugJob +class CollectJob : public QV4DebugJob { +protected: QV4DataCollector *collector; - const QJsonArray handles; QJsonObject result; QJsonArray collectedRefs; - QString exception; +public: + CollectJob(QV4DataCollector *collector) : collector(collector) {} + const QJsonObject &returnValue() const { return result; } + const QJsonArray &refs() const { return collectedRefs; } +}; +class BacktraceJob: public CollectJob +{ + int fromFrame; + int toFrame; public: - ValueLookupJob(const QJsonArray &handles, QV4DataCollector *collector); + BacktraceJob(QV4DataCollector *collector, int fromFrame, int toFrame); void run(); - const QString &exceptionMessage() const; - const QJsonObject &returnValue() const; - const QJsonArray &refs() const; }; -class ExpressionEvalJob: public JavaScriptJob +class FrameJob: public CollectJob { - QV4DataCollector *collector; - QString exception; - QJsonObject result; - QJsonArray collectedRefs; + int frameNr; + bool success; public: - ExpressionEvalJob(QV4::ExecutionEngine *engine, int frameNr, const QString &expression, - QV4DataCollector *collector); - virtual void handleResult(QV4::ScopedValue &value); - const QString &exceptionMessage() const; - const QJsonObject &returnValue() const; - const QJsonArray &refs() const; + FrameJob(QV4DataCollector *collector, int frameNr); + void run(); + bool wasSuccessful() const; }; -class GatherSourcesJob: public QV4DebugJob +class ScopeJob: public CollectJob { - QV4::ExecutionEngine *engine; - QStringList sources; + int frameNr; + int scopeNr; + bool success; public: - GatherSourcesJob(QV4::ExecutionEngine *engine); + ScopeJob(QV4DataCollector *collector, int frameNr, int scopeNr); void run(); - const QStringList &result() const; + bool wasSuccessful() const; }; -class ArgumentCollectJob: public QV4DebugJob +class ValueLookupJob: public CollectJob { - QV4::ExecutionEngine *engine; - QV4DataCollector *collector; - QStringList *names; - int frameNr; - int scopeNr; + const QJsonArray handles; + QString exception; public: - ArgumentCollectJob(QV4::ExecutionEngine *engine, QV4DataCollector *collector, - QStringList *names, int frameNr, int scopeNr); + ValueLookupJob(const QJsonArray &handles, QV4DataCollector *collector); void run(); + const QString &exceptionMessage() const; }; -class LocalCollectJob: public QV4DebugJob +class ExpressionEvalJob: public JavaScriptJob { - QV4::ExecutionEngine *engine; QV4DataCollector *collector; - QStringList *names; - int frameNr; - int scopeNr; + QString exception; + QJsonObject result; + QJsonArray collectedRefs; public: - LocalCollectJob(QV4::ExecutionEngine *engine, QV4DataCollector *collector, QStringList *names, - int frameNr, int scopeNr); - void run(); + ExpressionEvalJob(QV4::ExecutionEngine *engine, int frameNr, const QString &expression, + QV4DataCollector *collector); + virtual void handleResult(QV4::ScopedValue &value); + const QString &exceptionMessage() const; + const QJsonObject &returnValue() const; + const QJsonArray &refs() const; }; -class ThisCollectJob: public QV4DebugJob +class GatherSourcesJob: public QV4DebugJob { QV4::ExecutionEngine *engine; - QV4DataCollector *collector; - int frameNr; - QV4DataCollector::Ref thisRef; + QStringList sources; public: - ThisCollectJob(QV4::ExecutionEngine *engine, QV4DataCollector *collector, int frameNr); + GatherSourcesJob(QV4::ExecutionEngine *engine); void run(); - QV4DataCollector::Ref foundRef() const; + const QStringList &result() const; }; class ExceptionCollectJob: public QV4DebugJob @@ -176,8 +174,7 @@ public: EvalJob(QV4::ExecutionEngine *engine, const QString &script); virtual void handleResult(QV4::ScopedValue &result); - bool resultAsBoolean() const -; + bool resultAsBoolean() const; }; QT_END_NAMESPACE |