aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-01-14 18:06:27 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-14 20:04:43 +0100
commit679ea13790f217df0bb240fb80fd4ee5208e2084 (patch)
tree06008436e14fea1c0ac367af6f0bdd79ded967be /src/qml
parent8e17ab6dc6c51339e824f2f1a2cbdf445b482887 (diff)
parentcc0eb9c2aa9032c6a7bf2ab05d1eb913a09fa4f1 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/debugger/qqmlprofilerservice.cpp102
-rw-r--r--src/qml/debugger/qqmlprofilerservice_p.h72
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc2
-rw-r--r--src/qml/qml.pro3
-rw-r--r--src/qml/qml/qqmlvme.cpp34
5 files changed, 66 insertions, 147 deletions
diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp
index b83de937c6..3c066bd380 100644
--- a/src/qml/debugger/qqmlprofilerservice.cpp
+++ b/src/qml/debugger/qqmlprofilerservice.cpp
@@ -431,58 +431,29 @@ void QQmlProfilerService::messageReceived(const QByteArray &message)
*/
void QQmlVmeProfiler::Data::clear()
{
- url = QUrl();
+ url.clear();
line = 0;
column = 0;
- typeName = QString();
-}
-
-/*!
- * \brief QQmlVmeProfiler::start Start profiler and set data
- * \param url URL of file being executed
- * \param line Curent line in file
- * \param column Current column in file
- * \param typeName Type of object be created
- * Stops the profiler previously running in the foreground if there is one, then starts a
- * new one and sets it up with the data given.
- * Preconditions: Profiling must be enabled.
- */
-void QQmlVmeProfiler::start(const QUrl &url, int line, int column, const QString &typeName)
-{
- Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled.");
- if (enabled) {
- switchRange();
- updateLocation(url, line, column);
- updateTypeName(typeName);
- }
+ typeName.clear();
}
/*!
* \brief QQmlVmeProfiler::start Start profiler without data
* Clears the current range data, then stops the profiler previously running in the
* foreground if any, then starts a new one.
- * Preconditions: Profiling must be enabled.
*/
-void QQmlVmeProfiler::start()
+bool QQmlVmeProfiler::start()
{
- Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled.");
- if (enabled) {
+ if (QQmlProfilerService::enabled) {
currentRange.clear();
- switchRange();
+ if (running)
+ QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating);
+ else
+ running = true;
+ QQmlProfilerService::instance->startRange(QQmlProfilerService::Creating);
+ return true;
}
-}
-
-/*!
- * \brief QQmlVmeProfiler::switchRange Switch foreground profilers
- * Stops the current profiler if any, and starts a new one.
- */
-void QQmlVmeProfiler::switchRange()
-{
- if (running)
- QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating);
- else
- running = true;
- QQmlProfilerService::instance->startRange(QQmlProfilerService::Creating);
+ return false;
}
/*!
@@ -491,13 +462,10 @@ void QQmlVmeProfiler::switchRange()
* \param line line Curent line in file
* \param column column Current column in file
* Updates the current profiler's location information.
- * Preconditions: Profiling must be enabled and a profiler must be running in the foreground.
*/
void QQmlVmeProfiler::updateLocation(const QUrl &url, int line, int column)
{
- Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled.");
- Q_ASSERT_X(running, Q_FUNC_INFO, "trying to update location on stopped profiler");
- if (enabled && running) {
+ if (QQmlProfilerService::enabled && running) {
currentRange.url = url;
currentRange.line = line;
currentRange.column = column;
@@ -510,13 +478,10 @@ void QQmlVmeProfiler::updateLocation(const QUrl &url, int line, int column)
* \brief QQmlVmeProfiler::updateTypeName Update current type information
* \param typeName Type of object being created
* Updates the current profiler's type information.
- * Preconditions: Profiling must be enabled and a profiler must be running in the foreground.
*/
void QQmlVmeProfiler::updateTypeName(const QString &typeName)
{
- Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled.");
- Q_ASSERT_X(running, Q_FUNC_INFO, "trying to update typeName on stopped profiler");
- if (enabled && running) {
+ if (QQmlProfilerService::enabled && running) {
currentRange.typeName = typeName;
QQmlProfilerService::instance->rangeData(QQmlProfilerService::Creating, typeName);
}
@@ -526,14 +491,10 @@ void QQmlVmeProfiler::updateTypeName(const QString &typeName)
* \brief QQmlVmeProfiler::pop Pops a paused profiler from the stack and restarts it
* Stops the currently running profiler, if any, then retrieves an old one from the stack
* of paused profilers and starts that.
- * Preconditions: Profiling must be enabled and there must be at least one profiler on the
- * stack.
*/
void QQmlVmeProfiler::pop()
{
- Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled.");
- Q_ASSERT_X(ranges.count() > 0, Q_FUNC_INFO, "trying to pop an invalid profiler");
- if (enabled && ranges.count() > 0) {
+ if (QQmlProfilerService::enabled && ranges.count() > 0) {
start();
currentRange = ranges.pop();
QQmlProfilerService::instance->rangeLocation(
@@ -547,13 +508,10 @@ void QQmlVmeProfiler::pop()
* Pushes the currently running profiler on the stack of paused profilers. Note: The profiler
* isn't paused here. That's a separate step. If it's never paused, but pop()'ed later that
* won't do any harm, though.
- * Preconditions: Profiling must be enabled and a profiler must be running in the foreground.
*/
void QQmlVmeProfiler::push()
{
- Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled.");
- Q_ASSERT_X(running, Q_FUNC_INFO, "trying to push stopped profiler");
- if (enabled && running)
+ if (QQmlProfilerService::enabled && running)
ranges.push(currentRange);
}
@@ -561,29 +519,26 @@ void QQmlVmeProfiler::push()
* \brief QQmlVmeProfiler::clear Stop all running profilers and clear all data.
* Stops the currently running (foreground and background) profilers and removes all saved
* data about paused profilers.
- * Precondtions: Profiling must be enabled.
*/
void QQmlVmeProfiler::clear()
{
- Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled.");
- if (enabled) {
- stop();
- ranges.clear();
+ stop();
+ ranges.clear();
+ if (QQmlProfilerService::enabled) {
for (int i = 0; i < backgroundRanges.count(); ++i) {
QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating);
}
- backgroundRanges.clear();
}
+ backgroundRanges.clear();
+ running = false;
}
/*!
* \brief QQmlVmeProfiler::stop Stop profiler running in the foreground, if any.
- * Precondition: Profiling must be enabled.
*/
void QQmlVmeProfiler::stop()
{
- Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled.");
- if (enabled && running) {
+ if (QQmlProfilerService::enabled && running) {
QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating);
currentRange.clear();
running = false;
@@ -595,13 +550,10 @@ void QQmlVmeProfiler::stop()
* Push the profiler currently running in the foreground to the background so that it
* won't be stopped by stop() or start(). There can be multiple profilers in the background.
* You can retrieve them in reverse order by calling foreground().
- * Precondition: Profiling must be enabled and a profiler must be running in the foreground.
*/
void QQmlVmeProfiler::background()
{
- Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled.");
- Q_ASSERT_X(running, Q_FUNC_INFO, "trying to push stopped profiler to the background.");
- if (enabled && running) {
+ if (QQmlProfilerService::enabled && running) {
backgroundRanges.push(currentRange);
running = false;
}
@@ -611,18 +563,16 @@ void QQmlVmeProfiler::background()
* \brief QQmlVmeProfiler::foreground Retrieve a profiler from the background
* Stop the profiler currently running in the foreground, if any and put the next profiler
* from the background in its place.
- * Preconditions: Profiling must be enabled and there must be at least one profiler in the
- * background.
*/
-void QQmlVmeProfiler::foreground()
+bool QQmlVmeProfiler::foreground()
{
- Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled.");
- Q_ASSERT_X(backgroundRanges.count() > 0, Q_FUNC_INFO, "trying to foreground stopped profiler.");
- if (enabled && backgroundRanges.count() > 0) {
+ if (QQmlProfilerService::enabled && backgroundRanges.count() > 0) {
stop();
currentRange = backgroundRanges.pop();
running = true;
+ return true;
}
+ return false;
}
QT_END_NAMESPACE
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h
index 5959a526bb..86807eacec 100644
--- a/src/qml/debugger/qqmlprofilerservice_p.h
+++ b/src/qml/debugger/qqmlprofilerservice_p.h
@@ -237,32 +237,25 @@ private:
struct QQmlBindingProfiler {
QQmlBindingProfiler(const QString &url, int line, int column, QQmlProfilerService::BindingType bindingType)
{
- QQmlProfilerService *instance = QQmlProfilerService::instance;
- enabled = instance ? instance->profilingEnabled() : false;
- if (enabled) {
- instance->startRange(QQmlProfilerService::Binding, bindingType);
- instance->rangeLocation(QQmlProfilerService::Binding, url, line, column);
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::instance->startRange(QQmlProfilerService::Binding, bindingType);
+ QQmlProfilerService::instance->rangeLocation(QQmlProfilerService::Binding, url, line, column);
}
}
~QQmlBindingProfiler()
{
- if (enabled)
+ if (QQmlProfilerService::enabled)
QQmlProfilerService::instance->endRange(QQmlProfilerService::Binding);
}
-
- bool enabled;
};
struct QQmlHandlingSignalProfiler {
QQmlHandlingSignalProfiler(QQmlBoundSignalExpression *expression)
{
- enabled = QQmlProfilerService::instance
- ? QQmlProfilerService::instance->profilingEnabled() : false;
- if (enabled) {
- QQmlProfilerService *service = QQmlProfilerService::instance;
- service->startRange(QQmlProfilerService::HandlingSignal);
- service->rangeLocation(QQmlProfilerService::HandlingSignal,
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::instance->startRange(QQmlProfilerService::HandlingSignal);
+ QQmlProfilerService::instance->rangeLocation(QQmlProfilerService::HandlingSignal,
expression->sourceFile(), expression->lineNumber(),
expression->columnNumber());
}
@@ -270,38 +263,30 @@ struct QQmlHandlingSignalProfiler {
~QQmlHandlingSignalProfiler()
{
- if (enabled)
+ if (QQmlProfilerService::enabled)
QQmlProfilerService::instance->endRange(QQmlProfilerService::HandlingSignal);
}
-
- bool enabled;
};
struct QQmlCompilingProfiler {
QQmlCompilingProfiler(const QString &name)
{
- QQmlProfilerService *instance = QQmlProfilerService::instance;
- enabled = instance ?
- instance->profilingEnabled() : false;
- if (enabled) {
- instance->startRange(QQmlProfilerService::Compiling);
- instance->rangeLocation(QQmlProfilerService::Compiling, name, 1, 1);
- instance->rangeData(QQmlProfilerService::Compiling, name);
+ if (QQmlProfilerService::enabled) {
+ QQmlProfilerService::instance->startRange(QQmlProfilerService::Compiling);
+ QQmlProfilerService::instance->rangeLocation(QQmlProfilerService::Compiling, name, 1, 1);
+ QQmlProfilerService::instance->rangeData(QQmlProfilerService::Compiling, name);
}
}
~QQmlCompilingProfiler()
{
- if (enabled)
+ if (QQmlProfilerService::enabled)
QQmlProfilerService::instance->endRange(QQmlProfilerService::Compiling);
}
-
- bool enabled;
};
struct QQmlVmeProfiler {
public:
- const bool enabled;
struct Data {
Data() : line(0), column(0) {}
@@ -313,20 +298,18 @@ public:
};
QQmlVmeProfiler() :
- enabled(QQmlProfilerService::instance ? QQmlProfilerService::instance->profilingEnabled() : false),
running(false)
{}
~QQmlVmeProfiler()
{
- if (enabled)
+ if (QQmlProfilerService::enabled)
clear();
}
void clear();
- void start(const QUrl &url, int line, int column, const QString &typeName);
- void start();
+ bool start();
void stop();
void updateLocation(const QUrl &url, int line, int column);
@@ -336,10 +319,9 @@ public:
void push();
void background();
- void foreground();
+ bool foreground();
private:
- void switchRange();
Data currentRange;
QStack<Data> ranges;
@@ -348,46 +330,36 @@ private:
};
struct QQmlPixmapProfiler {
- QQmlPixmapProfiler() {
- QQmlProfilerService *instance = QQmlProfilerService::instance;
- enabled = instance ?
- instance->profilingEnabled() : false;
- }
-
- ~QQmlPixmapProfiler() {}
-
void startLoading(const QUrl &pixmapUrl) {
- if (enabled) {
+ if (QQmlProfilerService::enabled) {
QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingStarted, pixmapUrl);
}
}
void finishLoading(const QUrl &pixmapUrl) {
- if (enabled) {
+ if (QQmlProfilerService::enabled) {
QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingFinished, pixmapUrl);
}
}
void errorLoading(const QUrl &pixmapUrl) {
- if (enabled) {
+ if (QQmlProfilerService::enabled) {
QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingError, pixmapUrl);
}
}
void cacheCountChanged(const QUrl &pixmapUrl, int cacheCount) {
- if (enabled) {
+ if (QQmlProfilerService::enabled) {
QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapCacheCountChanged, pixmapUrl, cacheCount);
}
}
void referenceCountChanged(const QUrl &pixmapUrl, int referenceCount) {
- if (enabled) {
+ if (QQmlProfilerService::enabled) {
QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapReferenceCountChanged, pixmapUrl, referenceCount);
}
}
void setSize(const QUrl &pixmapUrl, const QSize &size) {
- if (enabled && size.width() > 0) {
+ if (QQmlProfilerService::enabled && size.width() > 0) {
QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapSizeKnown, pixmapUrl, size.width(), size.height());
}
}
-
- bool enabled;
};
QT_END_NAMESPACE
diff --git a/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc b/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
index 6803901efd..653fe2391e 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
@@ -30,7 +30,7 @@
\title Property Binding
\brief binding object properties
-To make the fullest use of QML and its built-in support for implementing dynamic object behavioral changes, most QML objects will use \e {property binding}. This is a core feature of QML that allows objects to automatically update their properties in response to changing attributes in other objects or the occurence of some external event.
+To make the fullest use of QML and its built-in support for implementing dynamic object behavioral changes, most QML objects will use \e {property binding}. This is a core feature of QML that allows objects to automatically update their properties in response to changing attributes in other objects or the occurrence of some external event.
When an object's property is assigned a value, it can either be assigned a static value, or \e bound to a JavaScript expression. In the first case, the property's value will not change unless a new value is assigned to the property. In the latter case, a \e {property binding} is created and the property's value is automatically updated by the QML engine whenever the value of the evaluated expression changes.
diff --git a/src/qml/qml.pro b/src/qml/qml.pro
index d0f655609e..79e83a1d47 100644
--- a/src/qml/qml.pro
+++ b/src/qml/qml.pro
@@ -21,7 +21,8 @@ QMAKE_DOCS = $$PWD/doc/qtqml.qdocconf
# 2415: variable "xx" of static storage duration was declared but never referenced
# unused variable 'xx' [-Werror,-Wunused-const-variable]
intel_icc: WERROR += -ww2415
-clang: WERROR += -Wno-error=unused-const-variable
+clang:if(greaterThan(QT_CLANG_MAJOR_VERSION, 3)|greaterThan(QT_CLANG_MINOR_VERSION, 3)): \
+ WERROR += -Wno-error=unused-const-variable
load(qt_module)
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index ad1e9d862e..1881b554ed 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -503,8 +503,7 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
const QQmlCompiledData::TypeReference &type = TYPES.at(instr.type);
Q_ASSERT(type.component);
- if (profiler.enabled) {
- profiler.start();
+ if (profiler.start()) {
profiler.updateTypeName(type.component->name);
profiler.background();
}
@@ -530,10 +529,8 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_END_INSTR(CreateQMLObject)
QML_BEGIN_INSTR(CompleteQMLObject)
- if (profiler.enabled) {
- profiler.foreground();
+ if (profiler.foreground())
profiler.updateLocation(CTXT->url, instr.line, instr.column);
- }
QObject *o = objects.top();
Q_ASSERT(o);
@@ -577,8 +574,10 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_BEGIN_INSTR(CreateCppObject)
const QQmlCompiledData::TypeReference &type = TYPES.at(instr.type);
Q_ASSERT(type.type);
- if (profiler.enabled)
- profiler.start(CTXT->url, instr.line, instr.column, type.type->qmlTypeName());
+ if (profiler.start()) {
+ profiler.updateLocation(CTXT->url, instr.line, instr.column);
+ profiler.updateTypeName(type.type->qmlTypeName());
+ }
QObject *o = 0;
void *memory = 0;
@@ -651,8 +650,10 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_BEGIN_INSTR(CreateSimpleObject)
const QQmlCompiledData::TypeReference &ref = TYPES.at(instr.type);
- if (profiler.enabled)
- profiler.start(CTXT->url, instr.line, instr.column, ref.type->qmlTypeName());
+ if (profiler.start()) {
+ profiler.updateLocation(CTXT->url, instr.line, instr.column);
+ profiler.updateTypeName(ref.type->qmlTypeName());
+ }
QObject *o = (QObject *)operator new(instr.typeSize + sizeof(QQmlData));
::memset(static_cast<void *>(o), 0, instr.typeSize + sizeof(QQmlData));
instr.create(o);
@@ -832,8 +833,7 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_END_INSTR(StoreScriptString)
QML_BEGIN_INSTR(BeginObject)
- if (profiler.enabled)
- profiler.push();
+ profiler.push();
QObject *target = objects.top();
QQmlParserStatus *status = reinterpret_cast<QQmlParserStatus *>(reinterpret_cast<char *>(target) + instr.castValue);
parserStatus.push(status);
@@ -1091,8 +1091,7 @@ normalExit:
objects.deallocate();
lists.deallocate();
states.clear();
- if (profiler.enabled)
- profiler.stop();
+ profiler.stop();
return rv;
}
@@ -1130,8 +1129,7 @@ void QQmlVME::reset()
states.clear();
rootContext = 0;
creationContext = 0;
- if (profiler.enabled)
- profiler.clear();
+ profiler.clear();
}
#ifdef QML_THREADED_VME_INTERPRETER
@@ -1191,8 +1189,7 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt)
if (componentCompleteEnabled()) { // the qml designer does the component complete later
QQmlTrace trace("VME Component Complete");
while (!parserStatus.isEmpty()) {
- if (profiler.enabled)
- profiler.pop();
+ profiler.pop();
QQmlParserStatus *status = parserStatus.pop();
#ifdef QML_ENABLE_TRACE
QQmlData *data = parserStatusData.pop();
@@ -1212,8 +1209,7 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt)
return 0;
}
parserStatus.deallocate();
- if (profiler.enabled)
- profiler.clear();
+ profiler.clear();
}
{