QmlProfiler: fix broken recording logic from the client side

This patch should not be applied back to the master branch,
since the issues are already fixed by b7304e2f2e.

Task-number: QTCREATORBUG-7091

Change-Id: I6f0b7752f3446b412c5bd9ae6e3d7e1847472e56
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Christiaan Janssen
2012-03-14 17:35:40 +01:00
parent bd451b3c20
commit f3b4c428cd
5 changed files with 32 additions and 8 deletions

View File

@@ -644,9 +644,14 @@ void QmlProfilerEventList::setTraceStartTime( qint64 time )
void QmlProfilerEventList::complete()
{
setState(ProcessingData);
d->collectV8Statistics();
postProcess();
if (currentState() == AcquiringData) {
setState(ProcessingData);
d->collectV8Statistics();
postProcess();
} else {
setState(Empty);
}
}
void QmlProfilerEventList::QmlProfilerEventListPrivate::clearQmlRootEvent()

View File

@@ -321,7 +321,7 @@ Rectangle {
id: elapsedTimer
property date startDate
property bool reset: true
running: connection.recording && connection.enabled
running: connection ? (connection.recording && connection.enabled) : false
repeat: true
onRunningChanged: {
if (running) reset = true;

View File

@@ -533,7 +533,8 @@ QWidget *QmlProfilerTool::createWidgets()
void QmlProfilerTool::connectClient(int port)
{
QTC_ASSERT(!d->m_client, return;)
if (d->m_client)
delete d->m_client;
d->m_client = new QDeclarativeDebugConnection;
d->m_traceWindow->reset(d->m_client);
connect(d->m_client, SIGNAL(stateChanged(QAbstractSocket::SocketState)),

View File

@@ -154,6 +154,8 @@ TraceWindow::TraceWindow(QWidget *parent)
setMinimumHeight(170);
m_currentZoomLevel = 0;
m_profiledTime = 0;
initializeQmlViews();
}
TraceWindow::~TraceWindow()
@@ -276,6 +278,14 @@ void TraceWindow::reset(QDeclarativeDebugConnection *conn)
connectClientSignals();
m_v8DataReady = false;
m_qmlDataReady = false;
m_mainView->rootContext()->setContextProperty("connection", m_plugin.data());
}
void TraceWindow::initializeQmlViews()
{
m_mainView->rootContext()->setContextProperty("connection", m_plugin.data());
m_mainView->rootContext()->setContextProperty("zoomControl", m_zoomControl.data());
m_timebar->rootContext()->setContextProperty("zoomControl", m_zoomControl.data());
@@ -307,9 +317,6 @@ void TraceWindow::reset(QDeclarativeDebugConnection *conn)
connect(this, SIGNAL(internalClearDisplay()), m_mainView->rootObject(), SLOT(clearAll()));
connect(this,SIGNAL(internalClearDisplay()), m_overview->rootObject(), SLOT(clearDisplay()));
m_v8DataReady = false;
m_qmlDataReady = false;
}
void TraceWindow::connectClientSignals()
@@ -476,6 +483,11 @@ void TraceWindow::qmlComplete()
m_qmlDataReady = true;
if (!m_v8plugin || m_v8plugin.data()->status() != QDeclarativeDebugClient::Enabled || m_v8DataReady) {
m_eventList->complete();
// if no data was received, still notify completion
if (m_eventList->currentState() == QmlProfilerEventList::Empty)
emit viewUpdated();
// once complete is sent, reset the flags
m_qmlDataReady = false;
m_v8DataReady = false;
@@ -487,6 +499,11 @@ void TraceWindow::v8Complete()
m_v8DataReady = true;
if (!m_plugin || m_plugin.data()->status() != QDeclarativeDebugClient::Enabled || m_qmlDataReady) {
m_eventList->complete();
// if no data was received, still notify completion
if (m_eventList->currentState() == QmlProfilerEventList::Empty)
emit viewUpdated();
// once complete is sent, reset the flags
m_v8DataReady = false;
m_qmlDataReady = false;

View File

@@ -170,6 +170,7 @@ private:
QWidget *createZoomToolbar();
void connectClientSignals();
void disconnectClientSignals();
void initializeQmlViews();
protected:
virtual void resizeEvent(QResizeEvent *event);