diff --git a/ReactCommon/fabric/core/primitives/Sealable.cpp b/ReactCommon/fabric/core/primitives/Sealable.cpp index a44181ee1..ffb1332d3 100644 --- a/ReactCommon/fabric/core/primitives/Sealable.cpp +++ b/ReactCommon/fabric/core/primitives/Sealable.cpp @@ -24,6 +24,8 @@ namespace react { * http://en.cppreference.com/w/cpp/language/rule_of_three */ +#ifndef NDEBUG + Sealable::Sealable(): sealed_(false) {} Sealable::Sealable(const Sealable &other): sealed_(false) {}; @@ -40,7 +42,7 @@ Sealable &Sealable::operator=(const Sealable &other) { Sealable &Sealable::operator=(Sealable &&other) noexcept { ensureUnsealed(); return *this; -}; +} void Sealable::seal() const { sealed_ = true; @@ -56,5 +58,7 @@ void Sealable::ensureUnsealed() const { } } +#endif + } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/core/primitives/Sealable.h b/ReactCommon/fabric/core/primitives/Sealable.h index 8cc3c6ed9..7454c373b 100644 --- a/ReactCommon/fabric/core/primitives/Sealable.h +++ b/ReactCommon/fabric/core/primitives/Sealable.h @@ -40,6 +40,18 @@ namespace react { * 3. Call `seal()` at some point from which any modifications * must be prevented. */ + +#ifdef NDEBUG + +class Sealable { +public: + inline void seal() const {} + inline bool getSealed() const { return true; } + inline void ensureUnsealed() const {} +}; + +#else + class Sealable { public: Sealable(); @@ -70,5 +82,7 @@ private: mutable std::atomic sealed_ {false}; }; +#endif + } // namespace react } // namespace facebook