Debugger: Remove option to constantly send tracing data
authorKai Koehne <kai.koehne@nokia.com>
Fri, 11 Nov 2011 13:48:12 +0000 (14:48 +0100)
committerQt by Nokia <qt-info@nokia.com>
Fri, 11 Nov 2011 15:39:03 +0000 (16:39 +0100)
Change-Id: I392277453aa34498549e39182accf7797a262504
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
src/declarative/debugger/qdeclarativedebugtrace.cpp
src/declarative/debugger/qdeclarativedebugtrace_p.h

index c7987d7..b497f6a 100644 (file)
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
 Q_GLOBAL_STATIC(QDeclarativeDebugTrace, traceInstance);
 
 // convert to a QByteArray that can be sent to the debug client
-// use of QDataStream can skew results if m_deferredSend == false
+// use of QDataStream can skew results
 //     (see tst_qdeclarativedebugtrace::trace() benchmark)
 QByteArray QDeclarativeDebugData::toByteArray() const
 {
@@ -75,7 +75,7 @@ QByteArray QDeclarativeDebugData::toByteArray() const
 
 QDeclarativeDebugTrace::QDeclarativeDebugTrace()
     : QDeclarativeDebugService(QLatin1String("CanvasFrameRate")),
-      m_enabled(false), m_deferredSend(true), m_messageReceived(false)
+      m_enabled(false), m_messageReceived(false)
 {
     m_timer.start();
     if (status() == Enabled) {
@@ -235,11 +235,7 @@ void QDeclarativeDebugTrace::animationFrameImpl(qint64 delta)
 void QDeclarativeDebugTrace::processMessage(const QDeclarativeDebugData &message)
 {
     QMutexLocker locker(&m_mutex);
-    if (m_deferredSend
-            || (QThread::currentThread() != QCoreApplication::instance()->thread()))
-        m_data.append(message);
-    else
-        sendMessage(message.toByteArray());
+    m_data.append(message);
 }
 
 /*
@@ -247,19 +243,17 @@ void QDeclarativeDebugTrace::processMessage(const QDeclarativeDebugData &message
 */
 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());
-        m_data.clear();
-
-        //indicate completion
-        QByteArray data;
-        QDataStream ds(&data, QIODevice::WriteOnly);
-        ds << (qint64)-1 << (int)Complete;
-        sendMessage(data);
-    }
+    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());
+    m_data.clear();
+
+    //indicate completion
+    QByteArray data;
+    QDataStream ds(&data, QIODevice::WriteOnly);
+    ds << (qint64)-1 << (int)Complete;
+    sendMessage(data);
 }
 
 void QDeclarativeDebugTrace::messageReceived(const QByteArray &message)
index 51f3e60..07af000 100644 (file)
@@ -147,7 +147,6 @@ private:
     void sendMessages();
     QElapsedTimer m_timer;
     bool m_enabled;
-    bool m_deferredSend;
     bool m_messageReceived;
     QVector<QDeclarativeDebugData> m_data;
     QMutex m_mutex;