Patch Detail
Show a patch.
GET /api/1.1/patches/1783/?format=api
{ "id": 1783, "url": "https://patchwork.libcamera.org/api/1.1/patches/1783/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1783/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20190812124642.24287-6-laurent.pinchart@ideasonboard.com>", "date": "2019-08-12T12:46:29", "name": "[libcamera-devel,05/18] libcamera: bound_method: Decouple from Signal implementation", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "38ddb6ea6be1d6db593cb9701039e839b57d864e", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1783/mbox/", "series": [ { "id": 455, "url": "https://patchwork.libcamera.org/api/1.1/series/455/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=455", "date": "2019-08-12T12:46:24", "name": "Object & Thread enhancements", "version": 1, "mbox": "https://patchwork.libcamera.org/series/455/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1783/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1783/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C2D7B61636\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2019 14:46:50 +0200 (CEST)", "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 568C2594\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2019 14:46:50 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1565614010;\n\tbh=2SZrUbhnrxIu5ZgHJv1Puo1eaAVdKs877QcMW84CIiY=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=IpqMv7nVi+5e0ECQXlC7Dt7C3w/xUtuO/oBefInGdRV2ZGbQOswvPi7XP7JvpPxxR\n\tYK0+tYpmXcLsCds6M+mX0n/SutIkjaR8nl9OZr19EShORtkL55JpCxDtOOS4NSK8hh\n\tThI0cr8c61tIOCtY00TrXTk2tAf8BEjdj6lpVTXk=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 12 Aug 2019 15:46:29 +0300", "Message-Id": "<20190812124642.24287-6-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190812124642.24287-1-laurent.pinchart@ideasonboard.com>", "References": "<20190812124642.24287-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 05/18] libcamera: bound_method: Decouple\n\tfrom Signal implementation", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "X-List-Received-Date": "Mon, 12 Aug 2019 12:46:51 -0000" }, "content": "To make the BoundMethod classes more generic, replace direct access to\nprivate member from Signal classes with accessors or helper functions.\nThis allows removal of friend statements from the BoundMethod classes.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/bound_method.h | 11 +++++------\n include/libcamera/signal.h | 12 +++++++-----\n src/libcamera/bound_method.cpp | 6 ------\n 3 files changed, 12 insertions(+), 17 deletions(-)", "diff": "diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h\nindex 38c44b923ba1..54c40fc52e3b 100644\n--- a/include/libcamera/bound_method.h\n+++ b/include/libcamera/bound_method.h\n@@ -13,9 +13,6 @@\n namespace libcamera {\n \n class Object;\n-template<typename... Args>\n-class Signal;\n-class SignalBase;\n \n class BoundMethodBase\n {\n@@ -28,7 +25,7 @@ public:\n \tbool match(T *obj) { return obj == obj_; }\n \tbool match(Object *object) { return object == object_; }\n \n-\tvoid disconnect(SignalBase *signal);\n+\tObject *object() const { return object_; }\n \n \tvoid activatePack(void *pack);\n \tvirtual void invokePack(void *pack) = 0;\n@@ -93,6 +90,8 @@ public:\n \tBoundMemberMethod(T *obj, Object *object, void (T::*func)(Args...))\n \t\t: BoundMethodArgs<Args...>(obj, object), func_(func) {}\n \n+\tbool match(void (T::*func)(Args...)) const { return func == func_; }\n+\n \tvoid activate(Args... args)\n \t{\n \t\tif (this->object_)\n@@ -107,7 +106,6 @@ public:\n \t}\n \n private:\n-\tfriend class Signal<Args...>;\n \tvoid (T::*func_)(Args...);\n };\n \n@@ -118,11 +116,12 @@ public:\n \tBoundStaticMethod(void (*func)(Args...))\n \t\t: BoundMethodArgs<Args...>(nullptr, nullptr), func_(func) {}\n \n+\tbool match(void (*func)(Args...)) const { return func == func_; }\n+\n \tvoid activate(Args... args) { (*func_)(args...); }\n \tvoid invoke(Args... args) {}\n \n private:\n-\tfriend class Signal<Args...>;\n \tvoid (*func_)(Args...);\n };\n \ndiff --git a/include/libcamera/signal.h b/include/libcamera/signal.h\nindex 3b6de30f7d35..b8a60281cceb 100644\n--- a/include/libcamera/signal.h\n+++ b/include/libcamera/signal.h\n@@ -46,7 +46,9 @@ public:\n \t~Signal()\n \t{\n \t\tfor (BoundMethodBase *slot : slots_) {\n-\t\t\tslot->disconnect(this);\n+\t\t\tObject *object = slot->object();\n+\t\t\tif (object)\n+\t\t\t\tobject->disconnect(this);\n \t\t\tdelete slot;\n \t\t}\n \t}\n@@ -95,11 +97,11 @@ public:\n \t\t\t/*\n \t\t\t * If the object matches the slot, the slot is\n \t\t\t * guaranteed to be a member slot, so we can safely\n-\t\t\t * cast it to BoundMemberMethod<T, Args...> and access its\n-\t\t\t * func_ member.\n+\t\t\t * cast it to BoundMemberMethod<T, Args...> to match\n+\t\t\t * func.\n \t\t\t */\n \t\t\tif (slot->match(obj) &&\n-\t\t\t static_cast<BoundMemberMethod<T, Args...> *>(slot)->func_ == func) {\n+\t\t\t static_cast<BoundMemberMethod<T, Args...> *>(slot)->match(func)) {\n \t\t\t\titer = slots_.erase(iter);\n \t\t\t\tdelete slot;\n \t\t\t} else {\n@@ -113,7 +115,7 @@ public:\n \t\tfor (auto iter = slots_.begin(); iter != slots_.end(); ) {\n \t\t\tBoundMethodArgs<Args...> *slot = *iter;\n \t\t\tif (slot->match(nullptr) &&\n-\t\t\t static_cast<BoundStaticMethod<Args...> *>(slot)->func_ == func) {\n+\t\t\t static_cast<BoundStaticMethod<Args...> *>(slot)->match(func)) {\n \t\t\t\titer = slots_.erase(iter);\n \t\t\t\tdelete slot;\n \t\t\t} else {\ndiff --git a/src/libcamera/bound_method.cpp b/src/libcamera/bound_method.cpp\nindex 0a2d61a6c805..23b8f4122283 100644\n--- a/src/libcamera/bound_method.cpp\n+++ b/src/libcamera/bound_method.cpp\n@@ -13,12 +13,6 @@\n \n namespace libcamera {\n \n-void BoundMethodBase::disconnect(SignalBase *signal)\n-{\n-\tif (object_)\n-\t\tobject_->disconnect(signal);\n-}\n-\n void BoundMethodBase::activatePack(void *pack)\n {\n \tif (Thread::current() == object_->thread()) {\n", "prefixes": [ "libcamera-devel", "05/18" ] }