aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/debugger/qqmlprofilerservice_p.h
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-03-23 14:31:47 +0100
committerKent Hansen <kent.hansen@nokia.com>2012-03-23 14:31:47 +0100
commit0655209fdad022bd0f6eb20ce85522cb56506bf0 (patch)
treecdba0c1590655f5cb75a68cedff74f8a683db3a2 /src/qml/debugger/qqmlprofilerservice_p.h
parentc3babc03c99c6ca5fa210486e133eb456a405bab (diff)
parent3d8f103c2641f35e7681485102a1b59886db8934 (diff)
Merge master into api_changes
Conflicts: src/qml/qml/qqmlboundsignal.cpp src/qml/qml/qqmlpropertycache.cpp Change-Id: I5193a193fa301c0b518291645bf626a5fa07118f
Diffstat (limited to 'src/qml/debugger/qqmlprofilerservice_p.h')
-rw-r--r--src/qml/debugger/qqmlprofilerservice_p.h59
1 files changed, 23 insertions, 36 deletions
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h
index 7a708456ba..2b4cafb615 100644
--- a/src/qml/debugger/qqmlprofilerservice_p.h
+++ b/src/qml/debugger/qqmlprofilerservice_p.h
@@ -54,12 +54,15 @@
//
#include <private/qqmldebugservice_p.h>
-#include <QtQml/qtqmlglobal.h>
+#include "qqmlexpression.h"
+
#include <QtCore/qelapsedtimer.h>
+#include <QtCore/qmetaobject.h>
#include <QtCore/qmutex.h>
#include <QtCore/qvector.h>
#include <QtCore/qstringbuilder.h>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -194,47 +197,30 @@ struct QQmlBindingProfiler {
QQmlProfilerService::instance->endRange(QQmlProfilerService::Binding);
}
- void addDetail(const QString &details)
- {
- if (enabled)
- QQmlProfilerService::instance->rangeData(QQmlProfilerService::Binding,
- details);
- }
-\
bool enabled;
};
struct QQmlHandlingSignalProfiler {
- QQmlHandlingSignalProfiler()
+ QQmlHandlingSignalProfiler(const QMetaMethod &signal, QQmlExpression *expression)
{
enabled = QQmlProfilerService::instance
? QQmlProfilerService::instance->profilingEnabled() : false;
if (enabled) {
- QQmlProfilerService::instance->startRange(
- QQmlProfilerService::HandlingSignal);
+ QQmlProfilerService *service = QQmlProfilerService::instance;
+ service->startRange(QQmlProfilerService::HandlingSignal);
+ service->rangeData(QQmlProfilerService::HandlingSignal,
+ QString::fromLatin1(signal.methodSignature()) + QLatin1String(": ")
+ + expression->expression());
+ service->rangeLocation(QQmlProfilerService::HandlingSignal,
+ expression->sourceFile(), expression->lineNumber(),
+ expression->columnNumber());
}
}
- void setSignalInfo(const QString &name, const QString &expression)
- {
- if (enabled)
- QQmlProfilerService::instance->rangeData(
- QQmlProfilerService::HandlingSignal,
- name % QLatin1String(": ") % expression);
- }
-
- void setLocation(const QString &file, int line, int column)
- {
- if (enabled)
- QQmlProfilerService::instance->rangeLocation(
- QQmlProfilerService::HandlingSignal, file, line, column);
- }
-
~QQmlHandlingSignalProfiler()
{
if (enabled)
- QQmlProfilerService::instance->endRange(
- QQmlProfilerService::HandlingSignal);
+ QQmlProfilerService::instance->endRange(QQmlProfilerService::HandlingSignal);
}
bool enabled;
@@ -243,22 +229,23 @@ struct QQmlHandlingSignalProfiler {
struct QQmlObjectCreatingProfiler {
QQmlObjectCreatingProfiler()
{
- QQmlProfilerService *instance = QQmlProfilerService::instance;
- enabled = instance ?
- instance->profilingEnabled() : false;
- if (enabled)
- instance->startRange(QQmlProfilerService::Creating);
+ enabled = QQmlProfilerService::instance
+ ? QQmlProfilerService::instance->profilingEnabled() : false;
+ if (enabled) {
+ QQmlProfilerService *service = QQmlProfilerService::instance;
+ service->startRange(QQmlProfilerService::Creating);
+ }
}
void setTypeName(const QString &typeName)
{
- if (enabled)
- QQmlProfilerService::instance->rangeData(
- QQmlProfilerService::Creating, typeName);
+ Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled.");
+ QQmlProfilerService::instance->rangeData(QQmlProfilerService::Creating, typeName);
}
void setLocation(const QUrl &url, int line, int column)
{
+ Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled.");
if (enabled)
QQmlProfilerService::instance->rangeLocation(
QQmlProfilerService::Creating, url, line, column);