From: Ulf Hermann Date: Thu, 16 Jul 2015 09:04:39 +0000 (+0200) Subject: Don't ask QQmlDebugService for name() when we already know it X-Git-Tag: v5.5.90+alpha1~85 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=20d06b5e822cc301e31f77a87915eed62195eb92;p=platform%2Fupstream%2Fqtdeclarative.git Don't ask QQmlDebugService for name() when we already know it Change-Id: Ibae6602bd1725d98ddaa751bfc00391a20a1460e Reviewed-by: Simon Hausmann --- diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp index 2d79777..91982b4 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp @@ -231,11 +231,13 @@ void QQmlDebugServerImpl::cleanup() if (!server) return; - foreach (QQmlDebugService *service, server->m_plugins.values()) { + for (QHash::ConstIterator i = server->m_plugins.constBegin(); + i != server->m_plugins.constEnd(); ++i) { server->m_changeServiceStateCalls.ref(); QMetaObject::invokeMethod(server, "changeServiceState", Qt::QueuedConnection, - Q_ARG(QString, service->name()), - Q_ARG(QQmlDebugService::State, QQmlDebugService::NotConnected)); + Q_ARG(QString, i.key()), + Q_ARG(QQmlDebugService::State, + QQmlDebugService::NotConnected)); } // Wait for changeServiceState calls to finish @@ -458,13 +460,13 @@ void QQmlDebugServerImpl::receiveMessage() QQmlDebugStream out(&helloAnswer, QIODevice::WriteOnly); QStringList pluginNames; QList pluginVersions; - const QList debugServices = m_plugins.values(); - const int count = debugServices.count(); + const int count = m_plugins.count(); pluginNames.reserve(count); pluginVersions.reserve(count); - foreach (QQmlDebugService *service, debugServices) { - pluginNames << service->name(); - pluginVersions << service->version(); + for (QHash::ConstIterator i = m_plugins.constBegin(); + i != m_plugins.constEnd(); ++i) { + pluginNames << i.key(); + pluginVersions << i.value()->version(); } out << QString(QStringLiteral("QDeclarativeDebugClient")) << 0 << protocolVersion @@ -483,7 +485,7 @@ void QQmlDebugServerImpl::receiveMessage() if (m_clientPlugins.contains(iter.key())) newState = QQmlDebugService::Enabled; m_changeServiceStateCalls.ref(); - changeServiceState(iter.value()->name(), newState); + changeServiceState(iter.key(), newState); } m_helloCondition.wakeAll(); @@ -502,7 +504,7 @@ void QQmlDebugServerImpl::receiveMessage() if (oldClientPlugins.contains(pluginName) != m_clientPlugins.contains(pluginName)) { m_changeServiceStateCalls.ref(); - changeServiceState(iter.value()->name(), newState); + changeServiceState(iter.key(), newState); } }