From patchwork Fri Jan 18 23:26:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 274 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B27460C78 for ; Sat, 19 Jan 2019 00:26:21 +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 B710E53E for ; Sat, 19 Jan 2019 00:26:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1547853980; bh=CHcPGmVIaagYQVX3UHq3KLb8N8jDd80Z7UupMzMphNg=; h=From:To:Subject:Date:From; b=CXLVuNthaWU69CtIW6x0jo+hPyvaeAle/k+KvUgRUTmXIvpM5u5YbuYFnmFZN0gm1 C20pcfwEyHroT2l8qbgO2cx2xH90CxnQei5WnSJUABK9/Q9reKTilalNr87E2q/6n/ upln/yplk/7hqJ9o7OqmKhiue/JNvsl/kUzubq/8= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 19 Jan 2019 01:26:13 +0200 Message-Id: <20190118232617.14631-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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: Fri, 18 Jan 2019 23:26:21 -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<>. Compared to v1 I've incorporated review feedback, resulting in a nearly complete rewrite of the documentation. Please see individual patches for details. 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 | 84 ++++++++++++++++++++++++ include/libcamera/camera.h | 15 +++-- include/libcamera/camera_manager.h | 11 ++-- src/libcamera/camera.cpp | 46 +++++++------ src/libcamera/camera_manager.cpp | 80 +++++++++++----------- 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, 185 insertions(+), 113 deletions(-)