From patchwork Thu Jan 17 23:59:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 266 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 618D460B2D for ; Fri, 18 Jan 2019 00:59:20 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CFF4C558 for ; Fri, 18 Jan 2019 00:59:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1547769559; bh=3F+yxPhRFEnUxxPOAdzV76uhR4wu/X4ukrFpvKem8Gw=; h=From:To:Subject:Date:From; b=CVwIKaepPNlo1nHkhJJgKFmI1G54W2FKcuswJkzCtbwnIdTCEYrmtq7h+MkvETblC 3G+NU2mXaqiSEI3/PYzOyHWkjq2y77ilbfOb0YizzuMAu6VCgj/tqNmGQTEdAw27Lw DdrtaVeq4MoxSgCmxSJi3zdaktl5vDVcjSjeC5+4= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 18 Jan 2019 01:59:12 +0200 Message-Id: <20190117235916.1906-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/4] Object lifetime management X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2019 23:59:20 -0000 Hello, This patch series sets the foundations for object lifetime management in libcamera. This is a complex topic that I expect will involve over time, so this is in no way considered as complete and set-in-stone code. Patch 1/4 documents the object lifetime management concept and associated coding rules. Patches 2/4 then applies those rules to the event dispatcher registration in CameraManager through std::unique_ptr<>. The last two patches apply the lifetime management rules to the Camera objects, with patch 3/4 reworking how camera are registered to simplify the code, and patch 4/4 implementing lifetime management through std::shared_ptr<>. Laurent Pinchart (4): Documentation: coding_style: Add object ownership rules libcamera: camera_manager: Use std::unique_ptr to store event dispatcher libcamera: camera_manager: Register cameras with the camera manager libcamera: camera: Handle camera objects through shared pointers Documentation/coding-style.rst | 62 +++++++++++++++++++++ include/libcamera/camera.h | 13 +++-- include/libcamera/camera_manager.h | 11 ++-- src/libcamera/camera.cpp | 46 ++++++++------- src/libcamera/camera_manager.cpp | 71 ++++++++++++------------ src/libcamera/include/pipeline_handler.h | 6 +- src/libcamera/pipeline/vimc.cpp | 30 ++-------- src/libcamera/pipeline_handler.cpp | 21 ++----- test/list-cameras.cpp | 5 +- 9 files changed, 153 insertions(+), 112 deletions(-)