Patch Detail
Show a patch.
GET /api/patches/1823/?format=api
{ "id": 1823, "url": "https://patchwork.libcamera.org/api/patches/1823/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1823/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20190817152104.10834-6-laurent.pinchart@ideasonboard.com>", "date": "2019-08-17T15:20:51", "name": "[libcamera-devel,v2,05/18] libcamera: bound_method: Decouple from Signal implementation", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "38ddb6ea6be1d6db593cb9701039e839b57d864e", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1823/mbox/", "series": [ { "id": 463, "url": "https://patchwork.libcamera.org/api/series/463/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=463", "date": "2019-08-17T15:20:46", "name": "Object & Thread enhancements", "version": 2, "mbox": "https://patchwork.libcamera.org/series/463/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1823/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1823/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 C5082600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 17 Aug 2019 17:21:14 +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 6B57998C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 17 Aug 2019 17:21:14 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1566055274;\n\tbh=oD5QHK0Yrq1ylVr09HqOHB99alYYy2U9yIb2fV+c2eE=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=isQspv+QCc8o5mRn/ymNgFczLHEQfB0kMCNyj6bgfZvG0H4sCmnN/qjzYot4z/pmF\n\tT7aIhE/us7yoOrkH0AB12/+65KgN499bh9pvi+WxH2HrrTDOVnUWcR3p/D3qk8sCqd\n\tRAzGX5N+krHtoyoCBHEVlAl7Lgr2ZynvZk1iVMzo=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 17 Aug 2019 18:20:51 +0300", "Message-Id": "<20190817152104.10834-6-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190817152104.10834-1-laurent.pinchart@ideasonboard.com>", "References": "<20190817152104.10834-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 05/18] libcamera: bound_method:\n\tDecouple from 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": "Sat, 17 Aug 2019 15:21:15 -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>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\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", "v2", "05/18" ] }