summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qproperty.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-06-28 09:24:05 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2021-08-08 21:59:43 +0200
commit63e1cf916d5f8783634ac3c10c5be114d3711df5 (patch)
tree8bd54f1ebb94a585db106d1e090c1133aeab09f4 /src/corelib/kernel/qproperty.cpp
parent40c536b712556c2a47060615a4a2e3ce09ea84ec (diff)
Pass QBindingStatus to evaluateBindings
This avoids another round of TLS lookups in evaluateRecursive when we construct the BindingEvaluationState. Change-Id: Icfa9fd81fc6f54623d384c4d3fce33f4d4d549b9 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit e5aff7f3d9e90860fe24b8fe931a71e115f5413b)
Diffstat (limited to 'src/corelib/kernel/qproperty.cpp')
-rw-r--r--src/corelib/kernel/qproperty.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp
index 09c74f1ed2..97854f8ac3 100644
--- a/src/corelib/kernel/qproperty.cpp
+++ b/src/corelib/kernel/qproperty.cpp
@@ -283,7 +283,7 @@ void QPropertyBindingPrivate::unlinkAndDeref()
destroyAndFreeMemory(this);
}
-void QPropertyBindingPrivate::evaluateRecursive()
+void QPropertyBindingPrivate::evaluateRecursive(QBindingStatus *status)
{
if (updating) {
error = QPropertyBindingError(QPropertyBindingError::BindingLoop);
@@ -304,7 +304,7 @@ void QPropertyBindingPrivate::evaluateRecursive()
*/
QPropertyBindingPrivatePtr keepAlive {this};
- BindingEvaluationState evaluationFrame(this);
+ BindingEvaluationState evaluationFrame(this, status);
auto bindingFunctor = reinterpret_cast<std::byte *>(this) +
QPropertyBindingPrivate::getSizeEnsuringAlignment();
@@ -322,7 +322,7 @@ void QPropertyBindingPrivate::evaluateRecursive()
return;
firstObserver.noSelfDependencies(this);
- firstObserver.evaluateBindings();
+ firstObserver.evaluateBindings(status);
}
void QPropertyBindingPrivate::notifyRecursive()
@@ -557,15 +557,14 @@ void QPropertyBindingData::notifyObservers(QUntypedPropertyData *propertyDataPtr
if (QPropertyObserverPointer observer = d.firstObserver()) {
auto status = storage ? storage->bindingStatus : nullptr;
QPropertyDelayedNotifications *delay;
- if (status && status->threadId == QThread::currentThreadId())
- delay = status->groupUpdateData;
- else
- delay = bindingStatus.groupUpdateData;
+ if (!status || status->threadId != QThread::currentThreadId())
+ status = &bindingStatus;
+ delay = status->groupUpdateData;
if (delay) {
delay->addProperty(this, propertyDataPtr);
return;
}
- observer.evaluateBindings();
+ observer.evaluateBindings(status);
} else {
return;
}
@@ -766,7 +765,7 @@ void QPropertyObserverPointer::noSelfDependencies(QPropertyBindingPrivate *bindi
}
#endif
-void QPropertyObserverPointer::evaluateBindings()
+void QPropertyObserverPointer::evaluateBindings(QBindingStatus *status)
{
auto observer = const_cast<QPropertyObserver*>(ptr);
// See also comment in notify()
@@ -776,7 +775,7 @@ void QPropertyObserverPointer::evaluateBindings()
if (QPropertyObserver::ObserverTag(observer->next.tag()) == QPropertyObserver::ObserverNotifiesBinding) {
auto bindingToEvaluate = observer->binding;
QPropertyObserverNodeProtector protector(observer);
- bindingToEvaluate->evaluateRecursive();
+ bindingToEvaluate->evaluateRecursive(status);
next = protector.next();
}