QList<QV8ProfilerData> m_data;
bool initialized;
+ bool m_enabled;
};
QV8ProfilerService::QV8ProfilerService(QObject *parent)
{
Q_D(QV8ProfilerService);
+ d->m_enabled = false;
+
if (registerService() == Enabled) {
// ,block mode, client attached
while (!d->initialized)
if (command == "V8PROFILER") {
ds >> title;
- if (option == "start") {
+ if (option == "start" && !d->m_enabled) {
QMetaObject::invokeMethod(this, "startProfiling", Qt::QueuedConnection, Q_ARG(QString, QString::fromUtf8(title)));
- } else if (option == "stop") {
+ d->m_enabled = true;
+ } else if (option == "stop" && d->m_enabled) {
QMetaObject::invokeMethod(this, "stopProfiling", Qt::QueuedConnection, Q_ARG(QString, QString::fromUtf8(title)));
QMetaObject::invokeMethod(this, "sendProfilingData", Qt::QueuedConnection);
+ d->m_enabled = false;
}
d->initialized = true;
}
connect(true);
QTRY_COMPARE(m_client->status(), QDeclarativeDebugClient::Enabled);
- m_client->startProfiling("");
m_client->stopProfiling("");
+ if (QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete()), 1000)) {
+ QString failMsg
+ = QString("Unexpected trace received! App output: %1\n\n").arg(m_process->output());
+ QFAIL(qPrintable(failMsg));
+ }
m_client->startProfiling("");
+ m_client->stopProfiling("");
if (!QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete()))) {
QString failMsg
= QString("No trace received in time. App output: %1\n\n").arg(m_process->output());
connect(false);
QTRY_COMPARE(m_client->status(), QDeclarativeDebugClient::Enabled);
- m_client->stopProfiling("");
m_client->startProfiling("");
+ m_client->stopProfiling("");
if (!QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(complete()))) {
QString failMsg
= QString("No trace received in time. App output: %1\n\n").arg(m_process->output());