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:12:14 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 9c32140068
Коммит 3bf3f63a4d
1 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -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