From 3bf3f63a4ded25dd865fa8b29565f2165fa77850 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Tue, 9 Jun 2020 02:12:14 -0700 Subject: [PATCH] Make scheduler into unique_ptr instead of shared_ptr Summary: Changelog: [Internal] RCTScheduler was storing Scheduler as `shared_ptr`, but `RCTScheduler` is sole owner of it. `unique_ptr` better expresses this ownership. Reviewed By: JoshuaGross Differential Revision: D21923573 fbshipit-source-id: e382f2d6e0a4875e1441b6063c1ad7056b338e29 --- React/Fabric/RCTScheduler.mm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/React/Fabric/RCTScheduler.mm b/React/Fabric/RCTScheduler.mm index 67afffa3b0f..da0a3a5ca5f 100644 --- a/React/Fabric/RCTScheduler.mm +++ b/React/Fabric/RCTScheduler.mm @@ -95,7 +95,7 @@ class LayoutAnimationDelegateProxy : public LayoutAnimationStatusDelegate, publi }; @implementation RCTScheduler { - std::shared_ptr _scheduler; + std::unique_ptr _scheduler; std::shared_ptr _animationDriver; std::shared_ptr _delegateProxy; std::shared_ptr _layoutAnimationDelegateProxy; @@ -120,7 +120,7 @@ class LayoutAnimationDelegateProxy : public LayoutAnimationStatusDelegate, publi _uiRunLoopObserver->setDelegate(_layoutAnimationDelegateProxy.get()); } - _scheduler = std::make_shared( + _scheduler = std::make_unique( toolbox, (_animationDriver ? _animationDriver.get() : nullptr), _delegateProxy.get()); } @@ -138,8 +138,6 @@ class LayoutAnimationDelegateProxy : public LayoutAnimationStatusDelegate, publi _animationDriver->setLayoutAnimationStatusDelegate(nullptr); } _animationDriver = nullptr; - - _scheduler->setDelegate(nullptr); } - (void)startSurfaceWithSurfaceId:(SurfaceId)surfaceId