remove superclass enable_shared_from_this from AnimationDriver (#51611)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51611

changelog: [internal]

AnimationDriver does not use enable_shared_from_this, let's remove it. Also mark a few methods as noexcept and const.

This helps with C++ binary size.

Reviewed By: rshest

Differential Revision: D75172851

fbshipit-source-id: d6552cd577371a51c3fa3b394b451d7ed2b61e44
This commit is contained in:
Samuel Susla
2025-05-26 15:03:56 -07:00
committed by Facebook GitHub Bot
parent 5bbf7e60a9
commit 6c053006b8
3 changed files with 5 additions and 6 deletions
@@ -22,8 +22,7 @@ enum class AnimationDriverType {
Decay,
};
class ValueAnimatedNode;
class AnimationDriver : public std::enable_shared_from_this<AnimationDriver> {
class AnimationDriver {
public:
AnimationDriver(
int id,
@@ -47,11 +46,11 @@ class AnimationDriver : public std::enable_shared_from_this<AnimationDriver> {
return endCallback_;
}
virtual double toValue() {
virtual double toValue() const noexcept {
return 0;
}
bool isComplete() {
bool isComplete() const noexcept {
return isComplete_;
}
@@ -35,7 +35,7 @@ FrameAnimationDriver::FrameAnimationDriver(
onConfigChanged();
}
double FrameAnimationDriver::toValue() {
double FrameAnimationDriver::toValue() const noexcept {
return toValue_;
}
@@ -24,7 +24,7 @@ class FrameAnimationDriver : public AnimationDriver {
const folly::dynamic& config,
NativeAnimatedNodesManager* manager);
double toValue() override;
double toValue() const noexcept override;
protected:
bool update(double timeDeltaMs, bool restarting) override;