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
This commit is contained in:
Samuel Susla
2020-06-09 02:15:02 -07:00
committed by Facebook GitHub Bot
parent 9c32140068
commit 3bf3f63a4d
+2 -4
View File
@@ -95,7 +95,7 @@ class LayoutAnimationDelegateProxy : public LayoutAnimationStatusDelegate, publi
};
@implementation RCTScheduler {
std::shared_ptr<Scheduler> _scheduler;
std::unique_ptr<Scheduler> _scheduler;
std::shared_ptr<LayoutAnimationDriver> _animationDriver;
std::shared_ptr<SchedulerDelegateProxy> _delegateProxy;
std::shared_ptr<LayoutAnimationDelegateProxy> _layoutAnimationDelegateProxy;
@@ -120,7 +120,7 @@ class LayoutAnimationDelegateProxy : public LayoutAnimationStatusDelegate, publi
_uiRunLoopObserver->setDelegate(_layoutAnimationDelegateProxy.get());
}
_scheduler = std::make_shared<Scheduler>(
_scheduler = std::make_unique<Scheduler>(
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