summaryrefslogtreecommitdiffstats
path: root/src
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-04 19:31:52 +0200
commite5aff7f3d9e90860fe24b8fe931a71e115f5413b (patch)
tree09f9bb3906fc5a6d31608efa99bd1cec49239806 /src
parent5d0095b1c2e60ecfb492c1910df70021128d663c (diff)
Pass QBindingStatus to evaluateBindings
This avoids another round of TLS lookups in evaluateRecursive when we construct the BindingEvaluationState. Pick-to: 6.2 Change-Id: Icfa9fd81fc6f54623d384c4d3fce33f4d4d549b9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qproperty.cpp19
-rw-r--r--src/corelib/kernel/qproperty_p.h4
2 files changed, 11 insertions, 12 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();
}
diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h
index 14dfd513f9..33bcc72ad7 100644
--- a/src/corelib/kernel/qproperty_p.h
+++ b/src/corelib/kernel/qproperty_p.h
@@ -112,7 +112,7 @@ struct QPropertyObserverPointer
#else
void noSelfDependencies(QPropertyBindingPrivate *) {}
#endif
- void evaluateBindings();
+ void evaluateBindings(QBindingStatus *status = nullptr);
void observeProperty(QPropertyBindingDataPointer property);
explicit operator bool() const { return ptr != nullptr; }
@@ -324,7 +324,7 @@ public:
void unlinkAndDeref();
- void evaluateRecursive();
+ void evaluateRecursive(QBindingStatus *status = nullptr);
void notifyRecursive();
static QPropertyBindingPrivate *get(const QUntypedPropertyBinding &binding)