diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-07-13 15:09:42 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-07-21 08:33:27 +0000 |
commit | 4d581ceb1d589d603224733275995d14c795a8c9 (patch) | |
tree | bb59d15b92ea1ebdc71ec38f6cf62c7a1f79d8dc /src/qml/debugger/qqmldebugservice_p.h | |
parent | 134d980a7fcf61c5440019bcfb3fdfc39c3f5f3c (diff) |
Simplify object/id lookup in QQmlDebugService
By tracking object destruction we can avoid looping over all cached
objects to find out which ones are still OK and we don't have to
manually clear the cache anymore. Looking up objects by source location
is specific to the engine debug service and should be done there.
Change-Id: I7dab73a7bf9c17087784f1bd9c5aef513b31e2c1
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/debugger/qqmldebugservice_p.h')
-rw-r--r-- | src/qml/debugger/qqmldebugservice_p.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/qml/debugger/qqmldebugservice_p.h b/src/qml/debugger/qqmldebugservice_p.h index a84237c109..af58168fff 100644 --- a/src/qml/debugger/qqmldebugservice_p.h +++ b/src/qml/debugger/qqmldebugservice_p.h @@ -36,6 +36,7 @@ #include <QtCore/qobject.h> #include <QtCore/qdatastream.h> +#include <QtCore/qhash.h> #include <private/qtqmlglobal_p.h> @@ -73,12 +74,9 @@ public: void sendMessage(const QByteArray &); void sendMessages(const QList<QByteArray> &); + static const QHash<int, QObject *> &objectsForIds(); static int idForObject(QObject *); - static QObject *objectForId(int); - static QList<QObject*> objectForLocationInfo(const QString &filename, - int lineNumber, int columnNumber); - static void removeInvalidObjectsFromHash(); - static void clearObjectsFromHash(); + static QObject *objectForId(int id) { return objectsForIds().value(id); } static QString objectToString(QObject *obj); |