diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-08-05 18:23:06 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-09-15 15:25:32 +0000 |
commit | e821115888f0e6b176d6c45eec507920eee514c8 (patch) | |
tree | 1bf21109cae1e6f6fbde7776395339864a6c7b43 /src/qml/debugger | |
parent | abe9fce03abd2e175533a64639d29aa989f5bce3 (diff) |
Add public methods to set debug services to be loaded
Task-number: QTBUG-47623
Change-Id: I94adba27e1220df6b6f0690df83ea32f956ef917
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/debugger')
-rw-r--r-- | src/qml/debugger/qqmldebug.cpp | 55 | ||||
-rw-r--r-- | src/qml/debugger/qqmldebug.h | 7 |
2 files changed, 62 insertions, 0 deletions
diff --git a/src/qml/debugger/qqmldebug.cpp b/src/qml/debugger/qqmldebug.cpp index a70e9dd966..64004fc86a 100644 --- a/src/qml/debugger/qqmldebug.cpp +++ b/src/qml/debugger/qqmldebug.cpp @@ -33,6 +33,7 @@ #include "qqmldebug.h" #include "qqmldebugconnector_p.h" +#include "qqmldebugserviceinterfaces_p.h" #include <private/qqmlengine_p.h> @@ -52,6 +53,60 @@ QQmlDebuggingEnabler::QQmlDebuggingEnabler(bool printWarning) } /*! + * Retrieves the plugin keys of the debugger services provided by default. The debugger services + * enable a debug client to use a Qml/JavaScript debugger, in order to set breakpoints, pause + * execution, evaluate expressions and similar debugging tasks. + * \return List of plugin keys of default debugger services. + */ +QStringList QQmlDebuggingEnabler::debuggerServices() +{ + return QStringList() << QV4DebugService::s_key << QQmlEngineDebugService::s_key + << QDebugMessageService::s_key; +} + +/*! + * Retrieves the plugin keys of the inspector services provided by default. The inspector services + * enable a debug client to use a visual inspector tool for Qt Quick. + * \return List of plugin keys of default inspector services. + */ +QStringList QQmlDebuggingEnabler::inspectorServices() +{ + return QStringList() << QQmlInspectorService::s_key; +} + +/*! + * Retrieves the names of the profiler services provided by default. The profiler services enable a + * debug client to use a profiler and track the time taken by various QML and JavaScript constructs, + * as well as the QtQuick SceneGraph. + * \return List of plugin keys of default profiler services. + */ +QStringList QQmlDebuggingEnabler::profilerServices() +{ + return QStringList() << QQmlProfilerService::s_key << QQmlEngineControlService::s_key; +} + +/*! + * Restricts the services available from the debug connector. The connector will scan plugins in the + * "qmltooling" subdirectory of the default plugin path. If this function is not called before the + * debug connector is enabled, all services found that way will be available to any client. If this + * function is called, only the services with plugin keys given in \a services will be available. + * + * Use this method to disable debugger and inspector services when profiling to get better + * performance and more realistic profiles. The debugger service will put any JavaScript engine it + * connects to into interpreted mode, disabling the JIT compiler. + * + * \sa debuggerServices(), profilerServices(), inspectorServices() + */ +void QQmlDebuggingEnabler::setServices(const QStringList &services) +{ +#ifndef QQML_NO_DEBUG_PROTOCOL + QQmlDebugConnector::setServices(services); +#else + Q_UNUSED(services); +#endif +} + +/*! * \enum QQmlDebuggingEnabler::StartMode * * Defines the debug connector's start behavior. You can interrupt QML engines starting while a diff --git a/src/qml/debugger/qqmldebug.h b/src/qml/debugger/qqmldebug.h index 5d65982a49..6316ebd195 100644 --- a/src/qml/debugger/qqmldebug.h +++ b/src/qml/debugger/qqmldebug.h @@ -48,6 +48,13 @@ struct Q_QML_EXPORT QQmlDebuggingEnabler }; QQmlDebuggingEnabler(bool printWarning = true); + + static QStringList debuggerServices(); + static QStringList inspectorServices(); + static QStringList profilerServices(); + + static void setServices(const QStringList &services); + static bool startTcpDebugServer(int port, StartMode mode = DoNotWaitForClient, const QString &hostName = QString()); static bool connectToLocalDebugger(const QString &socketFileName, |