aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-03-09 18:53:23 +0100
committerUlf Hermann <ulf.hermann@qt.io>2017-03-14 09:02:51 +0000
commitffe538a565e2f14ad276078891f18ec90d09be82 (patch)
treedd69cbe8e6d635159203d0f066ea5ea670bb1ea4 /src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h
parent9180241819a9ea5e517977efc5bb031521a56cc6 (diff)
QV4DebugService: Reduce unnecessary recursion and redundancy
Large parts of the protocol are unnecessary. There is no reason to send a separate chunk of "handles" with almost every reply. The refs are given as part of the regular data and if the client wants to find out more, it can do further lookups. Also, it makes no sense to encode the function and script names as objects, as they are in fact not JavaScript objects. Unfortunately these cleanups require some cooperation from the client. Older clients will misbehave if we just drop the redundancy. Therefore, we introduce parameters which the client can explicitly set with the "connect" message. redundantRefs tells the service if redundant references are required, namesAsObjects tells it if script and function names have to be sent as objects/ Once we can require clients that support these options, we can drop the code that generates redundant data. Also, fix tst_qv4debugger::evaluateExpression() to actually check all the expressions evaluated, not only the first and second one. Task-number: QTBUG-42435 Change-Id: If93d2a2b9d0b8035f85dbef871bc1b03f199171d Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h')
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h
index fd6356f22e..2c2514a1b3 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h
@@ -66,34 +66,42 @@ public:
QV4DataCollector(QV4::ExecutionEngine *engine);
- Ref collect(const QV4::ScopedValue &value);
- Ref addFunctionRef(const QString &functionName);
- Ref addScriptRef(const QString &scriptName);
+ Ref collect(const QV4::ScopedValue &value); // only for redundantRefs
+ Ref addFunctionRef(const QString &functionName); // only for namesAsObjects
+ Ref addScriptRef(const QString &scriptName); // only for namesAsObjects
+
+ void setNamesAsObjects(bool namesAsObjects) { m_namesAsObjects = namesAsObjects; }
+ bool namesAsObjects() const { return m_namesAsObjects; }
+
+ void setRedundantRefs(bool redundantRefs) { m_redundantRefs = redundantRefs; }
+ bool redundantRefs() const { return m_redundantRefs; }
bool isValidRef(Ref ref) const;
- QJsonObject lookupRef(Ref ref);
+ QJsonObject lookupRef(Ref ref, bool deep);
bool collectScope(QJsonObject *dict, int frameNr, int scopeNr);
QJsonObject buildFrame(const QV4::StackFrame &stackFrame, int frameNr);
QV4::ExecutionEngine *engine() const { return m_engine; }
- QJsonArray flushCollectedRefs();
+ QJsonArray flushCollectedRefs(); // only for redundantRefs
void clear();
private:
Ref addRef(QV4::Value value, bool deduplicate = true);
QV4::ReturnedValue getValue(Ref ref);
- bool lookupSpecialRef(Ref ref, QJsonObject *dict);
+ bool lookupSpecialRef(Ref ref, QJsonObject *dict); // only for namesAsObjects
QJsonArray collectProperties(const QV4::Object *object);
QJsonObject collectAsJson(const QString &name, const QV4::ScopedValue &value);
void collectArgumentsInContext();
QV4::ExecutionEngine *m_engine;
- Refs m_collectedRefs;
+ Refs m_collectedRefs; // only for redundantRefs
QV4::PersistentValue m_values;
- typedef QHash<Ref, QJsonObject> SpecialRefs;
- SpecialRefs m_specialRefs;
+ typedef QHash<Ref, QJsonObject> SpecialRefs; // only for namesAsObjects
+ SpecialRefs m_specialRefs; // only for namesAsObjects
+ bool m_namesAsObjects;
+ bool m_redundantRefs;
};
QT_END_NAMESPACE