diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-11-25 13:05:37 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-11-30 23:02:29 +0000 |
commit | ba0e0129023a4454ddb03f6375dbbe5eb2b8dabb (patch) | |
tree | a3957f4347db54611a8bbfe6bdb67b2ddca2c0c3 /src/corelib/kernel/qpropertyprivate.h | |
parent | 76743374e75df72311f25349b1274256eaddfc75 (diff) |
Inline the fast path of a few methods
No need to do function calls for the case where we return immediately
after checking a boolean.
Change-Id: I3e449850a10fcf82acb843cce6da6dfd98de32ad
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e165f416a752398079590161a18255f9a0058a3e)
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/kernel/qpropertyprivate.h')
-rw-r--r-- | src/corelib/kernel/qpropertyprivate.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h index 8887b86ce3..69e88b599f 100644 --- a/src/corelib/kernel/qpropertyprivate.h +++ b/src/corelib/kernel/qpropertyprivate.h @@ -158,6 +158,7 @@ template <typename T> class QPropertyData; namespace QtPrivate { +struct BindingEvaluationState; struct BindingFunctionVTable { @@ -238,14 +239,26 @@ public: QPropertyObserverCallback staticObserverCallback = nullptr, QPropertyBindingWrapper bindingWrapper = nullptr); - QPropertyBindingPrivate *binding() const; + QPropertyBindingPrivate *binding() const + { + if (d_ptr & BindingBit) + return reinterpret_cast<QPropertyBindingPrivate*>(d_ptr - BindingBit); + return nullptr; + + } void evaluateIfDirty(const QUntypedPropertyData *property) const; void removeBinding(); + void registerWithCurrentlyEvaluatingBinding(QtPrivate::BindingEvaluationState *currentBinding) const + { + if (!currentBinding) + return; + registerWithCurrentlyEvaluatingBinding_helper(currentBinding); + } void registerWithCurrentlyEvaluatingBinding() const; + void registerWithCurrentlyEvaluatingBinding_helper(BindingEvaluationState *currentBinding) const; void notifyObservers(QUntypedPropertyData *propertyDataPtr) const; - }; template <typename T, typename Tag> |