QmlJSInspector: Query Root Objects

As parentIds are now known, query only root objects initially and
build the object tree lazily.

Change-Id: Ic6895ad8a0dd8dc2a2b1d8aa71fdf6766974eea5
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Aurindam Jana
2012-04-10 10:36:00 +02:00
parent a7c1f55eba
commit c74458765d
3 changed files with 10 additions and 7 deletions

View File

@@ -528,7 +528,7 @@ quint32 ClientProxy::fetchContextObject(const QmlDebugObjectReference& obj)
return m_engineClient->queryObject(obj);
}
void ClientProxy::fetchContextObjectRecursive(
void ClientProxy::fetchRootObjects(
const QmlDebugContextReference& context, bool clear)
{
if (!isConnected())
@@ -541,16 +541,19 @@ void ClientProxy::fetchContextObjectRecursive(
quint32 queryId = 0;
using namespace QmlJsDebugClient::Constants;
if (m_engineClient->objectName() == QML_DEBUGGER &&
m_engineClient->serviceVersion() >= CURRENT_SUPPORTED_VERSION)
m_engineClient->serviceVersion() >= CURRENT_SUPPORTED_VERSION) {
//Fetch only root objects
if (obj.parentId() == -1)
queryId = fetchContextObject(obj);
else
} else {
queryId = m_engineClient->queryObjectRecursive(obj);
}
if (queryId)
m_objectTreeQueryIds << queryId;
}
foreach (const QmlDebugContextReference& child, context.contexts()) {
fetchContextObjectRecursive(child, false);
fetchRootObjects(child, false);
}
}

View File

@@ -96,7 +96,7 @@ public:
quint32 fetchContextObject(const QmlDebugObjectReference& obj);
void addObjectToTree(const QmlDebugObjectReference &obj);
void fetchContextObjectRecursive(const QmlDebugContextReference &context, bool clear);
void fetchRootObjects(const QmlDebugContextReference &context, bool clear);
void insertObjectInTreeIfNeeded(const QmlDebugObjectReference &object);
QDeclarativeDebugClient *qmlDebugger() const;

View File

@@ -371,7 +371,7 @@ void InspectorUi::disconnected()
void InspectorUi::onRootContext(const QVariant &value)
{
if (m_crumblePath->dataForLastIndex().toInt() < 0) {
m_clientProxy->fetchContextObjectRecursive(
m_clientProxy->fetchRootObjects(
qvariant_cast<QmlDebugContextReference>(
value), true);
} else {