forked from qt-creator/qt-creator
QmlProfiler: Avoid some 0 as nullptr warnings
Change-Id: I4763a22c6624eaffbb583bf26bf74a3e282b042f Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -71,7 +71,7 @@ FlameGraphModel::FlameGraphModel(QmlProfilerModelManager *modelManager,
|
|||||||
void FlameGraphModel::clear()
|
void FlameGraphModel::clear()
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_stackBottom = FlameGraphData(0, -1, 0);
|
m_stackBottom = FlameGraphData(nullptr, -1, 0);
|
||||||
m_callStack.clear();
|
m_callStack.clear();
|
||||||
m_compileStack.clear();
|
m_compileStack.clear();
|
||||||
m_callStack.append(QmlEvent());
|
m_callStack.append(QmlEvent());
|
||||||
@@ -283,7 +283,7 @@ QModelIndex FlameGraphModel::index(int row, int column, const QModelIndex &paren
|
|||||||
FlameGraphData *parentData = static_cast<FlameGraphData *>(parent.internalPointer());
|
FlameGraphData *parentData = static_cast<FlameGraphData *>(parent.internalPointer());
|
||||||
return createIndex(row, column, parentData->children[row]);
|
return createIndex(row, column, parentData->children[row]);
|
||||||
} else {
|
} else {
|
||||||
return createIndex(row, column, row >= 0 ? m_stackBottom.children[row] : 0);
|
return createIndex(row, column, row >= 0 ? m_stackBottom.children[row] : nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ namespace QmlProfiler {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
struct FlameGraphData {
|
struct FlameGraphData {
|
||||||
FlameGraphData(FlameGraphData *parent = 0, int typeIndex = -1, qint64 duration = 0);
|
FlameGraphData(FlameGraphData *parent = nullptr, int typeIndex = -1, qint64 duration = 0);
|
||||||
~FlameGraphData();
|
~FlameGraphData();
|
||||||
|
|
||||||
qint64 duration;
|
qint64 duration;
|
||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
MaxRole
|
MaxRole
|
||||||
};
|
};
|
||||||
|
|
||||||
FlameGraphModel(QmlProfilerModelManager *modelManager, QObject *parent = 0);
|
FlameGraphModel(QmlProfilerModelManager *modelManager, QObject *parent = nullptr);
|
||||||
|
|
||||||
QModelIndex index(int row, int column,
|
QModelIndex index(int row, int column,
|
||||||
const QModelIndex &parent = QModelIndex()) const override;
|
const QModelIndex &parent = QModelIndex()) const override;
|
||||||
|
@@ -85,7 +85,7 @@ void FlameGraphView::onVisibleFeaturesChanged(quint64 features)
|
|||||||
void FlameGraphView::contextMenuEvent(QContextMenuEvent *ev)
|
void FlameGraphView::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction *getGlobalStatsAction = 0;
|
QAction *getGlobalStatsAction = nullptr;
|
||||||
|
|
||||||
QPoint position = ev->globalPos();
|
QPoint position = ev->globalPos();
|
||||||
|
|
||||||
|
@@ -103,7 +103,7 @@ QVariantMap MemoryUsageModel::details(int index) const
|
|||||||
else
|
else
|
||||||
result.insert(QLatin1String("displayName"), tr("Memory Freed"));
|
result.insert(QLatin1String("displayName"), tr("Memory Freed"));
|
||||||
|
|
||||||
result.insert(tr("Total"), tr("%n bytes", 0, ev->size));
|
result.insert(tr("Total"), tr("%n byte(s)", nullptr, ev->size));
|
||||||
if (ev->allocations > 0) {
|
if (ev->allocations > 0) {
|
||||||
result.insert(tr("Allocated"), tr("%1 bytes").arg(ev->allocated));
|
result.insert(tr("Allocated"), tr("%1 bytes").arg(ev->allocated));
|
||||||
result.insert(tr("Allocations"), QString::number(ev->allocations));
|
result.insert(tr("Allocations"), QString::number(ev->allocations));
|
||||||
|
@@ -39,7 +39,7 @@ class QmlProfilerAttachDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QmlProfilerAttachDialog(QWidget *parent = 0);
|
explicit QmlProfilerAttachDialog(QWidget *parent = nullptr);
|
||||||
~QmlProfilerAttachDialog();
|
~QmlProfilerAttachDialog();
|
||||||
|
|
||||||
int port() const;
|
int port() const;
|
||||||
|
@@ -70,7 +70,7 @@ struct BindlingLoopsGeometry {
|
|||||||
static const QSGGeometry::AttributeSet &point2DWithOffset();
|
static const QSGGeometry::AttributeSet &point2DWithOffset();
|
||||||
static const int maxEventsPerNode = 0xffff / 18;
|
static const int maxEventsPerNode = 0xffff / 18;
|
||||||
|
|
||||||
BindlingLoopsGeometry() : allocatedVertices(0), usedVertices(0), currentY(-1), node(0) {}
|
BindlingLoopsGeometry() : allocatedVertices(0), usedVertices(0), currentY(-1), node(nullptr) {}
|
||||||
uint allocatedVertices;
|
uint allocatedVertices;
|
||||||
uint usedVertices;
|
uint usedVertices;
|
||||||
float currentY;
|
float currentY;
|
||||||
@@ -170,7 +170,7 @@ Timeline::TimelineRenderPass::State *QmlProfilerBindingLoopsRenderPass::update(
|
|||||||
return oldState;
|
return oldState;
|
||||||
|
|
||||||
BindingLoopsRenderPassState *state;
|
BindingLoopsRenderPassState *state;
|
||||||
if (oldState == 0)
|
if (oldState == nullptr)
|
||||||
state = new BindingLoopsRenderPassState(model);
|
state = new BindingLoopsRenderPassState(model);
|
||||||
else
|
else
|
||||||
state = static_cast<BindingLoopsRenderPassState *>(oldState);
|
state = static_cast<BindingLoopsRenderPassState *>(oldState);
|
||||||
@@ -327,7 +327,7 @@ void BindingLoopMaterialShader::updateState(const RenderState &state, QSGMateria
|
|||||||
|
|
||||||
char const *const *BindingLoopMaterialShader::attributeNames() const
|
char const *const *BindingLoopMaterialShader::attributeNames() const
|
||||||
{
|
{
|
||||||
static const char *const attr[] = {"vertexCoord", "postScaleOffset", 0};
|
static const char *const attr[] = {"vertexCoord", "postScaleOffset", nullptr};
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ class QmlProfilerClientManager : public QmlDebug::QmlDebugConnectionManager
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlProfilerClientManager(QObject *parent = 0);
|
explicit QmlProfilerClientManager(QObject *parent = nullptr);
|
||||||
void setProfilerStateManager(QmlProfilerStateManager *profilerState);
|
void setProfilerStateManager(QmlProfilerStateManager *profilerState);
|
||||||
void clearEvents();
|
void clearEvents();
|
||||||
void setModelManager(QmlProfilerModelManager *modelManager);
|
void setModelManager(QmlProfilerModelManager *modelManager);
|
||||||
|
@@ -41,7 +41,7 @@ class QmlProfilerConfigWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QmlProfilerConfigWidget(QmlProfilerSettings *settings, QWidget *parent = 0);
|
explicit QmlProfilerConfigWidget(QmlProfilerSettings *settings, QWidget *parent = nullptr);
|
||||||
~QmlProfilerConfigWidget();
|
~QmlProfilerConfigWidget();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -37,7 +37,7 @@ class QMLPROFILER_EXPORT QmlProfilerEventsView : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QmlProfilerEventsView(QWidget *parent = 0) : QWidget(parent) {}
|
QmlProfilerEventsView(QWidget *parent = nullptr) : QWidget(parent) {}
|
||||||
|
|
||||||
virtual void selectByTypeId(int typeIndex) = 0;
|
virtual void selectByTypeId(int typeIndex) = 0;
|
||||||
virtual void onVisibleFeaturesChanged(quint64 features) = 0;
|
virtual void onVisibleFeaturesChanged(quint64 features) = 0;
|
||||||
|
@@ -58,7 +58,7 @@ public:
|
|||||||
typedef std::function<void(const QmlEvent &, const QmlEventType &)> EventLoader;
|
typedef std::function<void(const QmlEvent &, const QmlEventType &)> EventLoader;
|
||||||
typedef std::function<void()> Finalizer;
|
typedef std::function<void()> Finalizer;
|
||||||
|
|
||||||
explicit QmlProfilerModelManager(QObject *parent = 0);
|
explicit QmlProfilerModelManager(QObject *parent = nullptr);
|
||||||
~QmlProfilerModelManager();
|
~QmlProfilerModelManager();
|
||||||
|
|
||||||
State state() const;
|
State state() const;
|
||||||
|
@@ -40,7 +40,7 @@ public:
|
|||||||
AppDying,
|
AppDying,
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit QmlProfilerStateManager(QObject *parent = 0);
|
explicit QmlProfilerStateManager(QObject *parent = nullptr);
|
||||||
~QmlProfilerStateManager();
|
~QmlProfilerStateManager();
|
||||||
|
|
||||||
QmlProfilerState currentState();
|
QmlProfilerState currentState();
|
||||||
|
@@ -118,7 +118,7 @@ void QmlProfilerStateWidget::updateDisplay()
|
|||||||
// Heuristic to not show the number if the application will only send the events when it
|
// Heuristic to not show the number if the application will only send the events when it
|
||||||
// stops. The number is still > 0 then because we get some StartTrace etc.
|
// stops. The number is still > 0 then because we get some StartTrace etc.
|
||||||
uint numEvents = d->m_modelManager->numEvents();
|
uint numEvents = d->m_modelManager->numEvents();
|
||||||
showText(numEvents > 256 ? tr("Profiling application: %n events", 0, numEvents) :
|
showText(numEvents > 256 ? tr("Profiling application: %n events", nullptr, numEvents) :
|
||||||
tr("Profiling application"));
|
tr("Profiling application"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ void QmlProfilerStateWidget::updateDisplay()
|
|||||||
if (d->m_profilerState->currentState() != QmlProfilerStateManager::Idle) {
|
if (d->m_profilerState->currentState() != QmlProfilerStateManager::Idle) {
|
||||||
if (state == QmlProfilerModelManager::AcquiringData) {
|
if (state == QmlProfilerModelManager::AcquiringData) {
|
||||||
// we don't know how much more, so progress numbers are strange here
|
// we don't know how much more, so progress numbers are strange here
|
||||||
showText(tr("Loading buffered data: %n events", 0,
|
showText(tr("Loading buffered data: %n events", nullptr,
|
||||||
d->m_modelManager->numEvents()));
|
d->m_modelManager->numEvents()));
|
||||||
} else if (state == QmlProfilerModelManager::ClearingData) {
|
} else if (state == QmlProfilerModelManager::ClearingData) {
|
||||||
// when starting a second recording from the same process without aggregation
|
// when starting a second recording from the same process without aggregation
|
||||||
@@ -143,7 +143,7 @@ void QmlProfilerStateWidget::updateDisplay()
|
|||||||
}
|
}
|
||||||
} else if (state == QmlProfilerModelManager::AcquiringData) {
|
} else if (state == QmlProfilerModelManager::AcquiringData) {
|
||||||
// Application died before all data could be read
|
// Application died before all data could be read
|
||||||
showText(tr("Loading offline data: %n events", 0,
|
showText(tr("Loading offline data: %n events", nullptr,
|
||||||
d->m_modelManager->numEvents()));
|
d->m_modelManager->numEvents()));
|
||||||
} else if (state == QmlProfilerModelManager::ClearingData) {
|
} else if (state == QmlProfilerModelManager::ClearingData) {
|
||||||
showText(tr("Clearing old trace"));
|
showText(tr("Clearing old trace"));
|
||||||
|
@@ -38,7 +38,8 @@ class QmlProfilerStateWidget : public QFrame
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlProfilerStateWidget(QmlProfilerStateManager *stateManager,
|
explicit QmlProfilerStateWidget(QmlProfilerStateManager *stateManager,
|
||||||
QmlProfilerModelManager *modelManager, QWidget *parent = 0);
|
QmlProfilerModelManager *modelManager,
|
||||||
|
QWidget *parent = nullptr);
|
||||||
~QmlProfilerStateWidget();
|
~QmlProfilerStateWidget();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -130,10 +130,10 @@ QStringList QmlProfilerStatisticsView::details(int typeId) const
|
|||||||
void QmlProfilerStatisticsView::contextMenuEvent(QContextMenuEvent *ev)
|
void QmlProfilerStatisticsView::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction *copyRowAction = 0;
|
QAction *copyRowAction = nullptr;
|
||||||
QAction *copyTableAction = 0;
|
QAction *copyTableAction = nullptr;
|
||||||
QAction *showExtendedStatsAction = 0;
|
QAction *showExtendedStatsAction = nullptr;
|
||||||
QAction *getGlobalStatsAction = 0;
|
QAction *getGlobalStatsAction = nullptr;
|
||||||
|
|
||||||
QPoint position = ev->globalPos();
|
QPoint position = ev->globalPos();
|
||||||
|
|
||||||
|
@@ -98,31 +98,31 @@ namespace Internal {
|
|||||||
class QmlProfilerTool::QmlProfilerToolPrivate
|
class QmlProfilerTool::QmlProfilerToolPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmlProfilerStateManager *m_profilerState = 0;
|
QmlProfilerStateManager *m_profilerState = nullptr;
|
||||||
QmlProfilerClientManager *m_profilerConnections = 0;
|
QmlProfilerClientManager *m_profilerConnections = nullptr;
|
||||||
QmlProfilerModelManager *m_profilerModelManager = 0;
|
QmlProfilerModelManager *m_profilerModelManager = nullptr;
|
||||||
|
|
||||||
QmlProfilerViewManager *m_viewContainer = 0;
|
QmlProfilerViewManager *m_viewContainer = nullptr;
|
||||||
QToolButton *m_recordButton = 0;
|
QToolButton *m_recordButton = nullptr;
|
||||||
QMenu *m_recordFeaturesMenu = 0;
|
QMenu *m_recordFeaturesMenu = nullptr;
|
||||||
|
|
||||||
QAction *m_startAction = 0;
|
QAction *m_startAction = nullptr;
|
||||||
QAction *m_stopAction = 0;
|
QAction *m_stopAction = nullptr;
|
||||||
QToolButton *m_clearButton = 0;
|
QToolButton *m_clearButton = nullptr;
|
||||||
|
|
||||||
// open search
|
// open search
|
||||||
QToolButton *m_searchButton = 0;
|
QToolButton *m_searchButton = nullptr;
|
||||||
|
|
||||||
// hide and show categories
|
// hide and show categories
|
||||||
QToolButton *m_displayFeaturesButton = 0;
|
QToolButton *m_displayFeaturesButton = nullptr;
|
||||||
QMenu *m_displayFeaturesMenu = 0;
|
QMenu *m_displayFeaturesMenu = nullptr;
|
||||||
|
|
||||||
// save and load actions
|
// save and load actions
|
||||||
QAction *m_saveQmlTrace = 0;
|
QAction *m_saveQmlTrace = nullptr;
|
||||||
QAction *m_loadQmlTrace = 0;
|
QAction *m_loadQmlTrace = nullptr;
|
||||||
|
|
||||||
// elapsed time display
|
// elapsed time display
|
||||||
QLabel *m_timeLabel = 0;
|
QLabel *m_timeLabel = nullptr;
|
||||||
QTimer m_recordingTimer;
|
QTimer m_recordingTimer;
|
||||||
QTime m_recordingElapsedTime;
|
QTime m_recordingElapsedTime;
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ QmlProfilerTool::QmlProfilerTool()
|
|||||||
this, &QmlProfilerTool::onLoadSaveFinished);
|
this, &QmlProfilerTool::onLoadSaveFinished);
|
||||||
|
|
||||||
d->m_profilerConnections->setModelManager(d->m_profilerModelManager);
|
d->m_profilerConnections->setModelManager(d->m_profilerModelManager);
|
||||||
Command *command = 0;
|
Command *command = nullptr;
|
||||||
|
|
||||||
ActionContainer *menu = ActionManager::actionContainer(M_DEBUG_ANALYZER);
|
ActionContainer *menu = ActionManager::actionContainer(M_DEBUG_ANALYZER);
|
||||||
ActionContainer *options = ActionManager::createMenu("Analyzer.Menu.QMLOptions");
|
ActionContainer *options = ActionManager::createMenu("Analyzer.Menu.QMLOptions");
|
||||||
|
@@ -266,7 +266,7 @@ void QmlProfilerTraceView::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
void QmlProfilerTraceView::showContextMenu(QPoint position)
|
void QmlProfilerTraceView::showContextMenu(QPoint position)
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction *viewAllAction = 0;
|
QAction *viewAllAction = nullptr;
|
||||||
|
|
||||||
menu.addActions(QmlProfilerTool::profilerContextMenuActions());
|
menu.addActions(QmlProfilerTool::profilerContextMenuActions());
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
@@ -51,7 +51,7 @@ QmlProfilerViewManager::QmlProfilerViewManager(QObject *parent,
|
|||||||
QTC_ASSERT(m_profilerModelManager, return);
|
QTC_ASSERT(m_profilerModelManager, return);
|
||||||
QTC_ASSERT(m_profilerState, return);
|
QTC_ASSERT(m_profilerState, return);
|
||||||
|
|
||||||
m_traceView = new QmlProfilerTraceView(0, this, m_profilerModelManager);
|
m_traceView = new QmlProfilerTraceView(nullptr, this, m_profilerModelManager);
|
||||||
connect(m_traceView, &QmlProfilerTraceView::gotoSourceLocation,
|
connect(m_traceView, &QmlProfilerTraceView::gotoSourceLocation,
|
||||||
this, &QmlProfilerViewManager::gotoSourceLocation);
|
this, &QmlProfilerViewManager::gotoSourceLocation);
|
||||||
connect(m_traceView, &QmlProfilerTraceView::typeSelected,
|
connect(m_traceView, &QmlProfilerTraceView::typeSelected,
|
||||||
@@ -96,7 +96,7 @@ QmlProfilerViewManager::QmlProfilerViewManager(QObject *parent,
|
|||||||
}
|
}
|
||||||
perspective->addOperation({m_statisticsView->objectName().toLatin1(), m_statisticsView,
|
perspective->addOperation({m_statisticsView->objectName().toLatin1(), m_statisticsView,
|
||||||
anchorDockId, Perspective::AddToTab});
|
anchorDockId, Perspective::AddToTab});
|
||||||
perspective->addOperation({anchorDockId, 0, {}, Perspective::Raise});
|
perspective->addOperation({anchorDockId, nullptr, {}, Perspective::Raise});
|
||||||
|
|
||||||
Debugger::registerPerspective(Constants::QmlProfilerPerspectiveId, perspective);
|
Debugger::registerPerspective(Constants::QmlProfilerPerspectiveId, perspective);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user