diff options
author | hjk <qthjk@ovi.com> | 2012-05-18 02:28:41 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-05-24 14:33:34 +0200 |
commit | e11a3a7697e7b432ac061277694885cf3724f25c (patch) | |
tree | 46a3140ed47b072782541d005d0edbdf1259a554 /src/plugins/debugger/qml/qmlv8debuggerclient.cpp | |
parent | c14c1248ed01f5e16975dc1082b5ce4e58052f8b (diff) | |
download | qt-creator-e11a3a7697e7b432ac061277694885cf3724f25c.tar.gz |
debugger: rework WatchModel
It's one model for all locals, watch, return, tooltip and inspector
data. This allows more streamlined code paths and better isolation
of the model data from the WatchHandler. WatchItems are now registered
in a hash indexed by iname, so inames can be used as the primary
handle to watch data in the WatchHandler interface.
Change-Id: Idac0a808b5d785307496d1de4198a1f2e9ce3880
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
Diffstat (limited to 'src/plugins/debugger/qml/qmlv8debuggerclient.cpp')
-rw-r--r-- | src/plugins/debugger/qml/qmlv8debuggerclient.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp index 1f97e58a54..8d35db37c6 100644 --- a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp +++ b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp @@ -272,7 +272,7 @@ void QmlV8DebuggerClientPrivate::evaluate(const QString expr, bool global, QScriptValue ctxtList = parser.call(QScriptValue(), QScriptValueList() << _(ARRAY )); while (rowCount) { QModelIndex index = localsModel->index(--rowCount, 0); - const WatchData *data = engine->watchHandler()->watchData(LocalsWatch, index); + const WatchData *data = engine->watchHandler()->watchData(index); QScriptValue ctxt = parser.call(QScriptValue(), QScriptValueList() << QScriptValue(_(OBJECT))); ctxt.setProperty(_(NAME), QScriptValue(data->name)); ctxt.setProperty(_(HANDLE), QScriptValue(int(data->id))); @@ -1173,7 +1173,7 @@ void QmlV8DebuggerClient::expandObject(const QByteArray &iname, quint64 objectId { if (objectId == 0) { //We may have got the global object - const WatchData *watch = d->engine->watchHandler()->findItem(iname); + const WatchData *watch = d->engine->watchHandler()->findData(iname); if (watch->value == QLatin1String("global")) { StackHandler *stackHandler = d->engine->stackHandler(); if (stackHandler->isContentsValid() && stackHandler->currentFrame().isUsable()) { @@ -1706,9 +1706,7 @@ void QmlV8DebuggerClient::setCurrentFrameDetails(const QVariant &bodyVal, const data.setHasChildren(true); data.id = 0; } - d->engine->watchHandler()->beginCycle(); d->engine->watchHandler()->insertData(data); - d->engine->watchHandler()->endCycle(); } const QVariantList currentFrameScopes = currentFrame.value(_("scopes")).toList(); @@ -1785,11 +1783,8 @@ void QmlV8DebuggerClient::updateScope(const QVariant &bodyVal, const QVariant &r if (!handlesToLookup.isEmpty()) d->lookup(handlesToLookup); - if (!locals.isEmpty()) { - d->engine->watchHandler()->beginCycle(false); - d->engine->watchHandler()->insertBulkData(locals); - d->engine->watchHandler()->endCycle(); - } + if (!locals.isEmpty()) + d->engine->watchHandler()->insertData(locals); } void QmlV8DebuggerClient::updateEvaluationResult(int sequence, bool success, const QVariant &bodyVal, @@ -1810,7 +1805,7 @@ void QmlV8DebuggerClient::updateEvaluationResult(int sequence, bool success, con d->scope(index); //Also update "this" QByteArray iname("local.this"); - const WatchData *parent = d->engine->watchHandler()->findItem(iname); + const WatchData *parent = d->engine->watchHandler()->findData(iname); d->localsAndWatchers.insertMulti(parent->id, iname); d->lookup(QList<int>() << parent->id); @@ -1833,7 +1828,7 @@ void QmlV8DebuggerClient::updateEvaluationResult(int sequence, bool success, con WatchData data; //Do we have request to evaluate a local? if (exp.startsWith("local.")) { - const WatchData *watch = d->engine->watchHandler()->findItem(exp.toLatin1()); + const WatchData *watch = d->engine->watchHandler()->findData(exp.toLatin1()); watchDataList << createWatchDataList(watch, body.properties, refsVal); } else { QByteArray iname = d->engine->watchHandler()->watcherName(exp.toLatin1()); @@ -1854,9 +1849,7 @@ void QmlV8DebuggerClient::updateEvaluationResult(int sequence, bool success, con watchDataList << data << createWatchDataList(&data, body.properties, refsVal); } //Insert the newly evaluated expression to the Watchers Window - d->engine->watchHandler()->beginCycle(false); - d->engine->watchHandler()->insertBulkData(watchDataList); - d->engine->watchHandler()->endCycle(); + d->engine->watchHandler()->insertData(watchDataList); } } } @@ -1933,7 +1926,7 @@ void QmlV8DebuggerClient::expandLocalsAndWatchers(const QVariant &bodyVal, const if (prepend.startsWith("local.") || prepend.startsWith("watch.")) { //Data for expanded local/watch //Could be an object or function - const WatchData *parent = d->engine->watchHandler()->findItem(prepend); + const WatchData *parent = d->engine->watchHandler()->findData(prepend); watchDataList << createWatchDataList(parent, bodyObjectData.properties, refsVal); } else { //rest @@ -1952,9 +1945,7 @@ void QmlV8DebuggerClient::expandLocalsAndWatchers(const QVariant &bodyVal, const } } - d->engine->watchHandler()->beginCycle(false); - d->engine->watchHandler()->insertBulkData(watchDataList); - d->engine->watchHandler()->endCycle(); + d->engine->watchHandler()->insertData(watchDataList); } QList<WatchData> QmlV8DebuggerClient::createWatchDataList(const WatchData *parent, |