Skip to content

Commit

Permalink
Inline QPropertyBindingDataPointer
Browse files Browse the repository at this point in the history
The only non-inline function of that class was observerCount() which
would use two of the inline functions defined in the header file, so
we can safely inline observerCount() and make the whole class contain
only inline methods

Consequently, inline class doesn't have to be exported in Windows

Change-Id: I41d144d9a50420bbc0091992b36cc36ac2567704
Reviewed-by: Fabian Kosmale <[email protected]>
  • Loading branch information
andrey-golubev committed Nov 1, 2021
1 parent 7cb2159 commit b01f080
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
7 changes: 0 additions & 7 deletions src/corelib/kernel/qproperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,13 +608,6 @@ QPropertyBindingData::NotificationResult QPropertyBindingData::notifyObserver_he
return Evaluated;
}

int QPropertyBindingDataPointer::observerCount() const
{
int count = 0;
for (auto observer = firstObserver(); observer; observer = observer.nextObserver())
++count;
return count;
}

QPropertyObserver::QPropertyObserver(ChangeHandler changeHandler)
{
Expand Down
16 changes: 12 additions & 4 deletions src/corelib/kernel/qproperty_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace QtPrivate {
// we need to allow the compiler to inline where it makes sense.

// This is a helper "namespace"
struct Q_AUTOTEST_EXPORT QPropertyBindingDataPointer
struct QPropertyBindingDataPointer
{
const QtPrivate::QPropertyBindingData *ptr = nullptr;

Expand All @@ -85,10 +85,10 @@ struct Q_AUTOTEST_EXPORT QPropertyBindingDataPointer
}
static void fixupAfterMove(QtPrivate::QPropertyBindingData *ptr);
void Q_ALWAYS_INLINE addObserver(QPropertyObserver *observer);
void setFirstObserver(QPropertyObserver *observer);
QPropertyObserverPointer firstObserver() const;
inline void setFirstObserver(QPropertyObserver *observer);
inline QPropertyObserverPointer firstObserver() const;

int observerCount() const;
inline int observerCount() const;

template <typename T>
static QPropertyBindingDataPointer get(QProperty<T> &property)
Expand Down Expand Up @@ -442,6 +442,14 @@ inline QPropertyObserverPointer QPropertyBindingDataPointer::firstObserver() con
return { reinterpret_cast<QPropertyObserver *>(ptr->d()) };
}

inline int QPropertyBindingDataPointer::observerCount() const
{
int count = 0;
for (auto observer = firstObserver(); observer; observer = observer.nextObserver())
++count;
return count;
}

namespace QtPrivate {
Q_CORE_EXPORT bool isPropertyInBindingWrapper(const QUntypedPropertyData *property);
void Q_CORE_EXPORT initBindingStatusThreadId();
Expand Down

0 comments on commit b01f080

Please sign in to comment.