#include <QtCore/qdatastream.h>
#include <QtCore/qurl.h>
#include <QtCore/qtimer.h>
+#include <QtCore/qthread.h>
+#include <QtCore/qcoreapplication.h>
QT_BEGIN_NAMESPACE
}
}
+void QDeclarativeDebugTrace::addEngine(QDeclarativeEngine * /*engine*/)
+{
+ // just make sure that the service is properly registered
+ traceInstance();
+}
+
+void QDeclarativeDebugTrace::removeEngine(QDeclarativeEngine */*engine*/)
+{
+}
+
void QDeclarativeDebugTrace::addEvent(EventType t)
{
if (QDeclarativeDebugService::isDebuggingEnabled())
*/
void QDeclarativeDebugTrace::processMessage(const QDeclarativeDebugData &message)
{
- if (m_deferredSend)
+ QMutexLocker locker(&m_mutex);
+ if (m_deferredSend
+ || (QThread::currentThread() != QCoreApplication::instance()->thread()))
m_data.append(message);
else
sendMessage(message.toByteArray());
void QDeclarativeDebugTrace::sendMessages()
{
if (m_deferredSend) {
+ QMutexLocker locker(&m_mutex);
//### this is a suboptimal way to send batched messages
for (int i = 0; i < m_data.count(); ++i)
sendMessage(m_data.at(i).toByteArray());
#include <private/qdeclarativedebugservice_p.h>
#include <QtCore/qelapsedtimer.h>
+#include <QtCore/qmutex.h>
QT_BEGIN_HEADER
};
class QUrl;
+class QDeclarativeEngine;
+
class Q_DECLARATIVE_EXPORT QDeclarativeDebugTrace : public QDeclarativeDebugService
{
public:
MaximumRangeType
};
+ static void addEngine(QDeclarativeEngine *engine);
+ static void removeEngine(QDeclarativeEngine *engine);
+
static void addEvent(EventType);
static void startRange(RangeType);
bool m_deferredSend;
bool m_messageReceived;
QList<QDeclarativeDebugData> m_data;
+ QMutex m_mutex;
};
QT_END_NAMESPACE
QDeclarativeEngineDebugService::instance()->addEngine(q);
QV8DebugService::instance()->addEngine(q);
QV8ProfilerService::instance()->addEngine(q);
+ QDeclarativeDebugTrace::addEngine(q);
}
}
QDeclarativeEngineDebugService::instance()->remEngine(this);
QV8DebugService::instance()->removeEngine(this);
QV8ProfilerService::instance()->removeEngine(this);
+ QDeclarativeDebugTrace::removeEngine(this);
}
// if we are the parent of any of the qobject module api instances,