[{"id":2476,"web_url":"https://patchwork.libcamera.org/comment/2476/","msgid":"<20190819090615.ifz2m4ghjrxmzxsp@uno.localdomain>","date":"2019-08-19T09:06:15","subject":"Re: [libcamera-devel] [PATCH 09/14] android: Pass Camera shared\n\tpointer to CameraDevice by const reference","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Sun, Aug 18, 2019 at 04:13:24AM +0300, Laurent Pinchart wrote:\n> The CameraDevice is constructed with a Camera instance passed through a\n\nIt's actually the CameraProxy that receives the camera parameter by\nvalue to then pass it to the CameraDevice constructor, which already\ntakes a reference.\n\nApart from this\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> shared pointer. It makes an internal copy of the pointer, which can be\n> passed by const reference instead of value. This optimises the\n> constructor slightly.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/android/camera_device.cpp | 2 +-\n>  src/android/camera_device.h   | 2 +-\n>  src/android/camera_proxy.cpp  | 2 +-\n>  src/android/camera_proxy.h    | 2 +-\n>  4 files changed, 4 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 999c51e6ba4a..9acfed694abc 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -49,7 +49,7 @@ CameraDevice::Camera3RequestDescriptor::~Camera3RequestDescriptor()\n>   * to the framework using the designated callbacks.\n>   */\n>\n> -CameraDevice::CameraDevice(unsigned int id, std::shared_ptr<Camera> &camera)\n> +CameraDevice::CameraDevice(unsigned int id, const std::shared_ptr<Camera> &camera)\n>  \t: running_(false), camera_(camera), staticMetadata_(nullptr),\n>  \t  requestTemplate_(nullptr)\n>  {\n> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> index 4d834ceb08a5..7897ba9dc5c7 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -31,7 +31,7 @@ class ThreadRpc;\n>  class CameraDevice : public libcamera::Object\n>  {\n>  public:\n> -\tCameraDevice(unsigned int id, std::shared_ptr<libcamera::Camera> &camera);\n> +\tCameraDevice(unsigned int id, const std::shared_ptr<libcamera::Camera> &camera);\n>  \t~CameraDevice();\n>\n>  \tvoid call(ThreadRpc *rpc);\n> diff --git a/src/android/camera_proxy.cpp b/src/android/camera_proxy.cpp\n> index 3eb2f9fbcffb..4f5c0a024903 100644\n> --- a/src/android/camera_proxy.cpp\n> +++ b/src/android/camera_proxy.cpp\n> @@ -113,7 +113,7 @@ static camera3_device_ops hal_dev_ops = {\n>  \t.reserved = { nullptr },\n>  };\n>\n> -CameraProxy::CameraProxy(unsigned int id, std::shared_ptr<Camera> camera)\n> +CameraProxy::CameraProxy(unsigned int id, const std::shared_ptr<Camera> &camera)\n>  \t: id_(id)\n>  {\n>  \tcameraDevice_ = new CameraDevice(id, camera);\n> diff --git a/src/android/camera_proxy.h b/src/android/camera_proxy.h\n> index da63bfa79fc9..7940eac4e376 100644\n> --- a/src/android/camera_proxy.h\n> +++ b/src/android/camera_proxy.h\n> @@ -19,7 +19,7 @@ class ThreadRpc;\n>  class CameraProxy\n>  {\n>  public:\n> -\tCameraProxy(unsigned int id, std::shared_ptr<libcamera::Camera> camera);\n> +\tCameraProxy(unsigned int id, const std::shared_ptr<libcamera::Camera> &camera);\n>  \t~CameraProxy();\n>\n>  \tint open(const hw_module_t *hardwareModule);\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AD01160E38\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Aug 2019 11:04:47 +0200 (CEST)","from uno.localdomain (unknown [87.18.63.98])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id CFA34FF80D;\n\tMon, 19 Aug 2019 09:04:46 +0000 (UTC)"],"X-Originating-IP":"87.18.63.98","Date":"Mon, 19 Aug 2019 11:06:15 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190819090615.ifz2m4ghjrxmzxsp@uno.localdomain>","References":"<20190818011329.14499-1-laurent.pinchart@ideasonboard.com>\n\t<20190818011329.14499-10-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"46zh4t4aw6wlcpzj\"","Content-Disposition":"inline","In-Reply-To":"<20190818011329.14499-10-laurent.pinchart@ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 09/14] android: Pass Camera shared\n\tpointer to CameraDevice by const reference","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, 19 Aug 2019 09:04:47 -0000"}}]