QMetaCallEvent::create: extract template-argument-independent code
Extract Method create_impl() with all the stuff that doesn't depend on create()'s template arguments, which will reduce compile time and amount of generated code. Pick-to: 6.6 Change-Id: I9d8f59c168873ac3527b570ef6142079824061cf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
cec711092f
commit
dc7820a296
@ -625,6 +625,25 @@ void QMetaCallEvent::placeMetaCall(QObject *object)
|
||||
}
|
||||
}
|
||||
|
||||
QMetaCallEvent* QMetaCallEvent::create_impl(QtPrivate::QSlotObjectBase *slotObj,
|
||||
const QObject *sender, int signal_index,
|
||||
size_t argc, const void* const argp[],
|
||||
const QMetaType metaTypes[])
|
||||
{
|
||||
auto metaCallEvent = std::make_unique<QMetaCallEvent>(slotObj, sender,
|
||||
signal_index, int(argc));
|
||||
|
||||
void **args = metaCallEvent->args();
|
||||
QMetaType *types = metaCallEvent->types();
|
||||
for (size_t i = 0; i < argc; ++i) {
|
||||
types[i] = metaTypes[i];
|
||||
args[i] = types[i].create(argp[i]);
|
||||
Q_CHECK_PTR(!i || args[i]);
|
||||
}
|
||||
|
||||
return metaCallEvent.release();
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QSignalBlocker
|
||||
\brief Exception-safe wrapper around QObject::blockSignals().
|
||||
|
@ -394,18 +394,7 @@ public:
|
||||
const void* const argp[] = { nullptr, std::addressof(argv)... };
|
||||
const QMetaType metaTypes[] = { QMetaType::fromType<void>(), QMetaType::fromType<Args>()... };
|
||||
constexpr auto argc = sizeof...(Args) + 1;
|
||||
auto metaCallEvent = std::make_unique<QMetaCallEvent>(slotObj, sender,
|
||||
signal_index, int(argc));
|
||||
|
||||
void **args = metaCallEvent->args();
|
||||
QMetaType *types = metaCallEvent->types();
|
||||
for (size_t i = 0; i < argc; ++i) {
|
||||
types[i] = metaTypes[i];
|
||||
args[i] = types[i].create(argp[i]);
|
||||
Q_CHECK_PTR(!i || args[i]);
|
||||
}
|
||||
|
||||
return metaCallEvent.release();
|
||||
return create_impl(slotObj, sender, signal_index, argc, argp, metaTypes);
|
||||
}
|
||||
|
||||
inline int id() const { return d.method_offset_ + d.method_relative_; }
|
||||
@ -417,6 +406,9 @@ public:
|
||||
virtual void placeMetaCall(QObject *object) override;
|
||||
|
||||
private:
|
||||
static QMetaCallEvent *create_impl(QtPrivate::QSlotObjectBase *slotObj, const QObject *sender,
|
||||
int signal_index, size_t argc, const void * const argp[],
|
||||
const QMetaType metaTypes[]);
|
||||
inline void allocArgs();
|
||||
|
||||
struct Data {
|
||||
|
Loading…
Reference in New Issue
Block a user