Inline the fast path for removeBinding()
Save a function call in the common case where we don't have a binding This makes a rather large performance difference for setters that do not have a binding. Pick-to: 6.0.0 dev Change-Id: I140f29790f6fe868721a33b9fad37205e547b8e9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
65759c9867
commit
c63901c5f3
@ -328,18 +328,19 @@ void QPropertyBindingData::evaluateIfDirty(const QUntypedPropertyData *property)
|
|||||||
binding->evaluateIfDirtyAndReturnTrueIfValueChanged(property);
|
binding->evaluateIfDirtyAndReturnTrueIfValueChanged(property);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPropertyBindingData::removeBinding()
|
void QPropertyBindingData::removeBinding_helper()
|
||||||
{
|
{
|
||||||
QPropertyBindingDataPointer d{this};
|
QPropertyBindingDataPointer d{this};
|
||||||
|
|
||||||
if (auto *existingBinding = d.bindingPtr()) {
|
auto *existingBinding = d.bindingPtr();
|
||||||
|
Q_ASSERT(existingBinding);
|
||||||
|
|
||||||
auto observer = existingBinding->takeObservers();
|
auto observer = existingBinding->takeObservers();
|
||||||
d_ptr = 0;
|
d_ptr = 0;
|
||||||
if (observer)
|
if (observer)
|
||||||
d.setObservers(observer.ptr);
|
d.setObservers(observer.ptr);
|
||||||
existingBinding->unlinkAndDeref();
|
existingBinding->unlinkAndDeref();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void QPropertyBindingData::registerWithCurrentlyEvaluatingBinding() const
|
void QPropertyBindingData::registerWithCurrentlyEvaluatingBinding() const
|
||||||
{
|
{
|
||||||
|
@ -248,7 +248,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void evaluateIfDirty(const QUntypedPropertyData *property) const;
|
void evaluateIfDirty(const QUntypedPropertyData *property) const;
|
||||||
void removeBinding();
|
void removeBinding()
|
||||||
|
{
|
||||||
|
if (hasBinding())
|
||||||
|
removeBinding_helper();
|
||||||
|
}
|
||||||
|
|
||||||
void registerWithCurrentlyEvaluatingBinding(QtPrivate::BindingEvaluationState *currentBinding) const
|
void registerWithCurrentlyEvaluatingBinding(QtPrivate::BindingEvaluationState *currentBinding) const
|
||||||
{
|
{
|
||||||
@ -257,8 +261,10 @@ public:
|
|||||||
registerWithCurrentlyEvaluatingBinding_helper(currentBinding);
|
registerWithCurrentlyEvaluatingBinding_helper(currentBinding);
|
||||||
}
|
}
|
||||||
void registerWithCurrentlyEvaluatingBinding() const;
|
void registerWithCurrentlyEvaluatingBinding() const;
|
||||||
void registerWithCurrentlyEvaluatingBinding_helper(BindingEvaluationState *currentBinding) const;
|
|
||||||
void notifyObservers(QUntypedPropertyData *propertyDataPtr) const;
|
void notifyObservers(QUntypedPropertyData *propertyDataPtr) const;
|
||||||
|
private:
|
||||||
|
void registerWithCurrentlyEvaluatingBinding_helper(BindingEvaluationState *currentBinding) const;
|
||||||
|
void removeBinding_helper();
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, typename Tag>
|
template <typename T, typename Tag>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user