From 27c6d99600422ee96fcc29de26c2be84c6a9838d Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Fri, 18 Aug 2023 19:44:55 +0000 Subject: Use std::shared_ptr for SpriteController Remove RefBase from SpriteController, and use std::shared_ptr. We cannot migrate to std::unique_ptr because we have to post messages to the handler, which needs to have a weak reference to the object. Bug: 278783893 Test: presubmit Change-Id: I0ea4bb220e5b1866375ed39335f9035cd4bb766c --- libs/input/TouchSpotController.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libs/input/TouchSpotController.cpp') diff --git a/libs/input/TouchSpotController.cpp b/libs/input/TouchSpotController.cpp index c212608e4ea5..b8de919fbd8c 100644 --- a/libs/input/TouchSpotController.cpp +++ b/libs/input/TouchSpotController.cpp @@ -98,8 +98,8 @@ void TouchSpotController::setSpots(const PointerCoords* spotCoords, const uint32 #endif std::scoped_lock lock(mLock); - sp spriteController = mContext.getSpriteController(); - spriteController->openTransaction(); + auto& spriteController = mContext.getSpriteController(); + spriteController.openTransaction(); // Add or move spots for fingers that are down. for (BitSet32 idBits(spotIdBits); !idBits.isEmpty();) { @@ -125,7 +125,7 @@ void TouchSpotController::setSpots(const PointerCoords* spotCoords, const uint32 } } - spriteController->closeTransaction(); + spriteController.closeTransaction(); } void TouchSpotController::clearSpots() { @@ -167,7 +167,7 @@ TouchSpotController::Spot* TouchSpotController::createAndAddSpotLocked(uint32_t sprite = mLocked.recycledSprites.back(); mLocked.recycledSprites.pop_back(); } else { - sprite = mContext.getSpriteController()->createSprite(); + sprite = mContext.getSpriteController().createSprite(); } // Return the new spot. -- cgit v1.2.3-59-g8ed1b