libcamera: object: Use bound method activePack() for invokeMethod()

The BoundMethodBase::activatePack() and the internal
Object::invokeMethod() are duplicate implementation of the same
mechanism. Use the former to replace the latter.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart
2019-10-28 05:44:14 +02:00
parent 8524e62611
commit 06008b9156
4 changed files with 9 additions and 16 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ public:
Object *object() const { return object_; }
ConnectionType connectionType() const { return connectionType_; }
void activatePack(void *pack);
void activatePack(void *pack, bool deleteMethod);
virtual void invokePack(void *pack) = 0;
protected:
@@ -109,7 +109,7 @@ public:
void activate(Args... args)
{
if (this->object_)
BoundMethodBase::activatePack(new PackType{ args... });
BoundMethodBase::activatePack(new PackType{ args... }, false);
else
(static_cast<T *>(this->obj_)->*func_)(args...);
}
+4 -4
View File
@@ -33,10 +33,12 @@ public:
void invokeMethod(void (T::*func)(Args...), Args... args)
{
T *obj = static_cast<T *>(this);
BoundMethodBase *method = new BoundMemberMethod<T, Args...>(obj, this, func);
BoundMethodBase *method =
new BoundMemberMethod<T, Args...>(obj, this, func,
ConnectionTypeQueued);
void *pack = new typename BoundMemberMethod<T, Args...>::PackType{ args... };
invokeMethod(method, pack);
method->activatePack(pack, true);
}
Thread *thread() const { return thread_; }
@@ -53,8 +55,6 @@ private:
friend class BoundMethodBase;
friend class Thread;
void invokeMethod(BoundMethodBase *method, void *pack);
void notifyThreadMove();
void connect(SignalBase *signal);