diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h index 94191bfea35..a79e30e2f86 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h @@ -8,7 +8,7 @@ #import #import -#import +#import #import NS_ASSUME_NONNULL_BEGIN @@ -17,7 +17,7 @@ void RCTCopyBackedTextInput( UIView *fromTextInput, UIView *toTextInput); -UITextAutocorrectionType RCTUITextAutocorrectionTypeFromOptionalBool(facebook::better::optional autoCorrect); +UITextAutocorrectionType RCTUITextAutocorrectionTypeFromOptionalBool(facebook::butter::optional autoCorrect); UITextAutocapitalizationType RCTUITextAutocapitalizationTypeFromAutocapitalizationType( facebook::react::AutocapitalizationType autocapitalizationType); @@ -25,7 +25,7 @@ UITextAutocapitalizationType RCTUITextAutocapitalizationTypeFromAutocapitalizati UIKeyboardAppearance RCTUIKeyboardAppearanceFromKeyboardAppearance( facebook::react::KeyboardAppearance keyboardAppearance); -UITextSpellCheckingType RCTUITextSpellCheckingTypeFromOptionalBool(facebook::better::optional spellCheck); +UITextSpellCheckingType RCTUITextSpellCheckingTypeFromOptionalBool(facebook::butter::optional spellCheck); UITextFieldViewMode RCTUITextFieldViewModeFromTextInputAccessoryVisibilityMode( facebook::react::TextInputAccessoryVisibilityMode mode); diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm index 5212f8b5857..f389865f655 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm @@ -51,7 +51,7 @@ void RCTCopyBackedTextInput( [toTextInput setSelectedTextRange:fromTextInput.selectedTextRange notifyDelegate:NO]; } -UITextAutocorrectionType RCTUITextAutocorrectionTypeFromOptionalBool(facebook::better::optional autoCorrect) +UITextAutocorrectionType RCTUITextAutocorrectionTypeFromOptionalBool(facebook::butter::optional autoCorrect) { return autoCorrect.has_value() ? (*autoCorrect ? UITextAutocorrectionTypeYes : UITextAutocorrectionTypeNo) : UITextAutocorrectionTypeDefault; @@ -84,7 +84,7 @@ UIKeyboardAppearance RCTUIKeyboardAppearanceFromKeyboardAppearance(KeyboardAppea } } -UITextSpellCheckingType RCTUITextSpellCheckingTypeFromOptionalBool(facebook::better::optional spellCheck) +UITextSpellCheckingType RCTUITextSpellCheckingTypeFromOptionalBool(facebook::butter::optional spellCheck) { return spellCheck.has_value() ? (*spellCheck ? UITextSpellCheckingTypeYes : UITextSpellCheckingTypeNo) : UITextSpellCheckingTypeDefault; diff --git a/React/Fabric/Mounting/RCTComponentViewFactory.mm b/React/Fabric/Mounting/RCTComponentViewFactory.mm index e559426a9aa..ebc6cedea4e 100644 --- a/React/Fabric/Mounting/RCTComponentViewFactory.mm +++ b/React/Fabric/Mounting/RCTComponentViewFactory.mm @@ -10,9 +10,9 @@ #import #import -#import -#import -#import +#import +#import +#import #import #import @@ -56,10 +56,10 @@ static Class RCTComponentViewClassWithName(const char } @implementation RCTComponentViewFactory { - better::map _componentViewClasses; - better::set _registeredComponentsNames; + butter::map _componentViewClasses; + butter::set _registeredComponentsNames; ComponentDescriptorProviderRegistry _providerRegistry; - better::shared_mutex _mutex; + butter::shared_mutex _mutex; } + (RCTComponentViewFactory *)currentComponentViewFactory @@ -149,7 +149,7 @@ static Class RCTComponentViewClassWithName(const char - (void)registerComponentViewClass:(Class)componentViewClass { RCTAssert(componentViewClass, @"RCTComponentViewFactory: Provided `componentViewClass` is `nil`."); - std::unique_lock lock(_mutex); + std::unique_lock lock(_mutex); auto componentDescriptorProvider = [componentViewClass componentDescriptorProvider]; _componentViewClasses[componentDescriptorProvider.handle] = @@ -171,7 +171,7 @@ static Class RCTComponentViewClassWithName(const char - (RCTComponentViewDescriptor)createComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle { RCTAssertMainQueue(); - std::shared_lock lock(_mutex); + std::shared_lock lock(_mutex); auto iterator = _componentViewClasses.find(componentHandle); RCTAssert( @@ -192,7 +192,7 @@ static Class RCTComponentViewClassWithName(const char - (facebook::react::ComponentDescriptorRegistry::Shared)createComponentDescriptorRegistryWithParameters: (facebook::react::ComponentDescriptorParameters)parameters { - std::shared_lock lock(_mutex); + std::shared_lock lock(_mutex); return _providerRegistry.createComponentDescriptorRegistry(parameters); } diff --git a/React/Fabric/Mounting/RCTComponentViewRegistry.mm b/React/Fabric/Mounting/RCTComponentViewRegistry.mm index 1217cf71bf8..06498f7f185 100644 --- a/React/Fabric/Mounting/RCTComponentViewRegistry.mm +++ b/React/Fabric/Mounting/RCTComponentViewRegistry.mm @@ -15,15 +15,15 @@ #import "RCTParagraphComponentView.h" #import "RCTViewComponentView.h" -#import +#import using namespace facebook::react; const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024; @implementation RCTComponentViewRegistry { - better::map _registry; - better::map> _recyclePool; + butter::map _registry; + butter::map> _recyclePool; } - (instancetype)init diff --git a/React/Fabric/Mounting/RCTMountingManager.mm b/React/Fabric/Mounting/RCTMountingManager.mm index 3d1b81a3ff3..9dab056a14d 100644 --- a/React/Fabric/Mounting/RCTMountingManager.mm +++ b/React/Fabric/Mounting/RCTMountingManager.mm @@ -7,7 +7,7 @@ #import "RCTMountingManager.h" -#import +#import #import #import diff --git a/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h b/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h index 31da581bfdf..03225edd17a 100644 --- a/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h +++ b/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h @@ -8,8 +8,8 @@ #import #import "RCTMountingTransactionObserverCoordinator.h" -#import -#import +#import +#import #import @@ -36,8 +36,8 @@ class RCTMountingTransactionObserverCoordinator final { facebook::react::MountingTransactionMetadata const &metadata) const; private: - facebook::better::map< + facebook::butter::map< facebook::react::SurfaceId, - facebook::better::set> + facebook::butter::set> registry_; }; diff --git a/React/Fabric/RCTSurfacePresenter.mm b/React/Fabric/RCTSurfacePresenter.mm index 839270fabcc..e7e548dd9d5 100644 --- a/React/Fabric/RCTSurfacePresenter.mm +++ b/React/Fabric/RCTSurfacePresenter.mm @@ -79,7 +79,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor() ContextContainer::Shared _contextContainer; // Protected by `_schedulerLifeCycleMutex`. RuntimeExecutor _runtimeExecutor; // Protected by `_schedulerLifeCycleMutex`. - better::shared_mutex _observerListMutex; + butter::shared_mutex _observerListMutex; NSMutableArray> *_observers; } @@ -365,13 +365,13 @@ static BackgroundExecutor RCTGetBackgroundExecutor() - (void)addObserver:(id)observer { - std::unique_lock lock(_observerListMutex); + std::unique_lock lock(_observerListMutex); [self->_observers addObject:observer]; } - (void)removeObserver:(id)observer { - std::unique_lock lock(_observerListMutex); + std::unique_lock lock(_observerListMutex); [self->_observers removeObject:observer]; } @@ -381,7 +381,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor() { RCTAssertMainQueue(); - std::shared_lock lock(_observerListMutex); + std::shared_lock lock(_observerListMutex); for (id observer in _observers) { if ([observer respondsToSelector:@selector(willMountComponentsWithRootTag:)]) { [observer willMountComponentsWithRootTag:rootTag]; @@ -393,7 +393,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor() { RCTAssertMainQueue(); - std::shared_lock lock(_observerListMutex); + std::shared_lock lock(_observerListMutex); for (id observer in _observers) { if ([observer respondsToSelector:@selector(didMountComponentsWithRootTag:)]) { [observer didMountComponentsWithRootTag:rootTag]; diff --git a/React/Fabric/RCTSurfaceRegistry.mm b/React/Fabric/RCTSurfaceRegistry.mm index 25487f3d74b..3ea9c8678c4 100644 --- a/React/Fabric/RCTSurfaceRegistry.mm +++ b/React/Fabric/RCTSurfaceRegistry.mm @@ -7,7 +7,7 @@ #import "RCTSurfaceRegistry.h" -#import +#import #import #import @@ -16,7 +16,7 @@ using namespace facebook; @implementation RCTSurfaceRegistry { - better::shared_mutex _mutex; + butter::shared_mutex _mutex; NSMapTable *_registry; } @@ -32,13 +32,13 @@ using namespace facebook; - (void)enumerateWithBlock:(RCTSurfaceEnumeratorBlock)block { - std::shared_lock lock(_mutex); + std::shared_lock lock(_mutex); block([_registry objectEnumerator]); } - (void)registerSurface:(RCTFabricSurface *)surface { - std::unique_lock lock(_mutex); + std::unique_lock lock(_mutex); ReactTag rootTag = surface.rootViewTag.integerValue; [_registry setObject:surface forKey:(__bridge id)(void *)rootTag]; @@ -46,7 +46,7 @@ using namespace facebook; - (void)unregisterSurface:(RCTFabricSurface *)surface { - std::unique_lock lock(_mutex); + std::unique_lock lock(_mutex); ReactTag rootTag = surface.rootViewTag.integerValue; [_registry removeObjectForKey:(__bridge id)(void *)rootTag]; @@ -54,7 +54,7 @@ using namespace facebook; - (RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag { - std::shared_lock lock(_mutex); + std::shared_lock lock(_mutex); return [_registry objectForKey:(__bridge id)(void *)rootTag]; } diff --git a/React/Fabric/Surface/RCTFabricSurface.mm b/React/Fabric/Surface/RCTFabricSurface.mm index f3b44534707..8b17c893793 100644 --- a/React/Fabric/Surface/RCTFabricSurface.mm +++ b/React/Fabric/Surface/RCTFabricSurface.mm @@ -34,7 +34,7 @@ using namespace facebook::react; // `SurfaceHandler` is a thread-safe object, so we don't need additional synchronization. // Objective-C++ classes cannot have instance variables without default constructors, // hence we wrap a value into `optional` to workaround it. - better::optional _surfaceHandler; + butter::optional _surfaceHandler; // Protects Surface's start and stop processes. // Even though SurfaceHandler is tread-safe, it will crash if we try to stop a surface that is not running. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk index 80a60e3982d..ad989e03049 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk @@ -12,7 +12,7 @@ LOCAL_MODULE := fabricjni LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) LOCAL_SHARED_LIBRARIES := \ - libbetter \ + libbutter \ libfb \ libfbjni \ libfolly_futures \ diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp index b599ca02091..042279a0cdd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp @@ -46,7 +46,7 @@ jni::local_ref Binding::initHybrid( // Thread-safe getter std::shared_ptr Binding::getScheduler() { - std::shared_lock lock(installMutex_); + std::shared_lock lock(installMutex_); return scheduler_; } @@ -128,7 +128,7 @@ void Binding::startSurface( { SystraceSection s2("FabricUIManagerBinding::startSurface::surfaceId::lock"); - std::unique_lock lock(surfaceHandlerRegistryMutex_); + std::unique_lock lock(surfaceHandlerRegistryMutex_); SystraceSection s3("FabricUIManagerBinding::startSurface::surfaceId"); surfaceHandlerRegistry_.emplace(surfaceId, std::move(surfaceHandler)); } @@ -191,7 +191,7 @@ void Binding::startSurfaceWithConstraints( { SystraceSection s2( "FabricUIManagerBinding::startSurfaceWithConstraints::surfaceId::lock"); - std::unique_lock lock(surfaceHandlerRegistryMutex_); + std::unique_lock lock(surfaceHandlerRegistryMutex_); SystraceSection s3( "FabricUIManagerBinding::startSurfaceWithConstraints::surfaceId"); surfaceHandlerRegistry_.emplace(surfaceId, std::move(surfaceHandler)); @@ -228,7 +228,7 @@ void Binding::stopSurface(jint surfaceId) { } { - std::unique_lock lock(surfaceHandlerRegistryMutex_); + std::unique_lock lock(surfaceHandlerRegistryMutex_); auto iterator = surfaceHandlerRegistry_.find(surfaceId); @@ -289,7 +289,7 @@ void Binding::setConstraints( isRTL ? LayoutDirection::RightToLeft : LayoutDirection::LeftToRight; { - std::shared_lock lock(surfaceHandlerRegistryMutex_); + std::shared_lock lock(surfaceHandlerRegistryMutex_); auto iterator = surfaceHandlerRegistry_.find(surfaceId); @@ -334,7 +334,7 @@ void Binding::installFabricUIManager( // Use std::lock and std::adopt_lock to prevent deadlocks by locking mutexes // at the same time - std::unique_lock lock(installMutex_); + std::unique_lock lock(installMutex_); auto globalJavaUiManager = make_global(javaUIManager); mountingManager_ = @@ -434,7 +434,7 @@ void Binding::uninstallFabricUIManager() { << this << ")."; } - std::unique_lock lock(installMutex_); + std::unique_lock lock(installMutex_); animationDriver_ = nullptr; scheduler_ = nullptr; mountingManager_ = nullptr; @@ -443,7 +443,7 @@ void Binding::uninstallFabricUIManager() { std::shared_ptr Binding::verifyMountingManager( std::string const &hint) { - std::shared_lock lock(installMutex_); + std::shared_lock lock(installMutex_); if (!mountingManager_) { LOG(ERROR) << hint << " mounting manager disappeared."; } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h index 5c47720f727..4eea7c4ea36 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h @@ -129,7 +129,7 @@ class Binding : public jni::HybridClass, void uninstallFabricUIManager(); // Private member variables - better::shared_mutex installMutex_; + butter::shared_mutex installMutex_; std::shared_ptr mountingManager_; std::shared_ptr scheduler_; @@ -145,8 +145,8 @@ class Binding : public jni::HybridClass, std::unique_ptr backgroundExecutor_; - better::map surfaceHandlerRegistry_{}; - better::shared_mutex + butter::map surfaceHandlerRegistry_{}; + butter::shared_mutex surfaceHandlerRegistryMutex_; // Protects `surfaceHandlerRegistry_`. float pointScaleFactor_ = 1; diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.cpp index 9e9287638de..01d3310c0b5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.cpp @@ -21,7 +21,7 @@ void SurfaceHandlerBinding::setDisplayMode(jint mode) { } void SurfaceHandlerBinding::start() { - std::unique_lock lock(lifecycleMutex_); + std::unique_lock lock(lifecycleMutex_); if (surfaceHandler_.getStatus() != SurfaceHandler::Status::Running) { surfaceHandler_.start(); @@ -29,7 +29,7 @@ void SurfaceHandlerBinding::start() { } void SurfaceHandlerBinding::stop() { - std::unique_lock lock(lifecycleMutex_); + std::unique_lock lock(lifecycleMutex_); if (surfaceHandler_.getStatus() == SurfaceHandler::Status::Running) { surfaceHandler_.stop(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.h index 506fe088811..f4cb534e866 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.h @@ -50,7 +50,7 @@ class SurfaceHandlerBinding : public jni::HybridClass { SurfaceHandler const &getSurfaceHandler(); private: - mutable better::shared_mutex lifecycleMutex_; + mutable butter::shared_mutex lifecycleMutex_; const SurfaceHandler surfaceHandler_; jni::alias_ref jhybridobject_; diff --git a/ReactAndroid/src/main/jni/react/jni/Android.mk b/ReactAndroid/src/main/jni/react/jni/Android.mk index 604a5313378..9f6de4dc0b8 100644 --- a/ReactAndroid/src/main/jni/react/jni/Android.mk +++ b/ReactAndroid/src/main/jni/react/jni/Android.mk @@ -130,7 +130,7 @@ include $(BUILD_SHARED_LIBRARY) # Whenever you encounter an include //Android.mk, you # tell andorid-ndk to compile the module in / according # to the specification inside //Android.mk. -$(call import-module,better) +$(call import-module,butter) $(call import-module,folly) $(call import-module,fb) $(call import-module,fbjni) diff --git a/ReactCommon/React-Fabric.podspec b/ReactCommon/React-Fabric.podspec index 5502200b35f..9f65e6694ad 100644 --- a/ReactCommon/React-Fabric.podspec +++ b/ReactCommon/React-Fabric.podspec @@ -61,12 +61,12 @@ Pod::Spec.new do |s| ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" } end - s.subspec "better" do |ss| + s.subspec "butter" do |ss| ss.dependency folly_dep_name, folly_version ss.compiler_flags = folly_compiler_flags - ss.source_files = "better/**/*.{m,mm,cpp,h}" - ss.exclude_files = "better/tests" - ss.header_dir = "better" + ss.source_files = "butter/**/*.{m,mm,cpp,h}" + ss.exclude_files = "butter/tests" + ss.header_dir = "butter" ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" } end diff --git a/ReactCommon/better/.clang-tidy b/ReactCommon/butter/.clang-tidy similarity index 100% rename from ReactCommon/better/.clang-tidy rename to ReactCommon/butter/.clang-tidy diff --git a/ReactCommon/better/Android.mk b/ReactCommon/butter/Android.mk similarity index 92% rename from ReactCommon/better/Android.mk rename to ReactCommon/butter/Android.mk index fed79b0fbbc..990f73e8eed 100644 --- a/ReactCommon/better/Android.mk +++ b/ReactCommon/butter/Android.mk @@ -7,7 +7,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := better +LOCAL_MODULE := butter LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) @@ -15,7 +15,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_CFLAGS := \ - -DLOG_TAG=\"Better\" + -DLOG_TAG=\"Butter\" LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall diff --git a/ReactCommon/better/BUCK b/ReactCommon/butter/BUCK similarity index 96% rename from ReactCommon/better/BUCK rename to ReactCommon/butter/BUCK index c287ec79652..fa584cee8eb 100644 --- a/ReactCommon/better/BUCK +++ b/ReactCommon/butter/BUCK @@ -13,7 +13,7 @@ load( APPLE_COMPILER_FLAGS = get_apple_compiler_flags() rn_xplat_cxx_library( - name = "better", + name = "butter", srcs = glob( ["**/*.cpp"], exclude = glob(["tests/**/*.cpp"]), @@ -27,7 +27,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "better", + prefix = "butter", ), fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), diff --git a/ReactCommon/better/better.h b/ReactCommon/butter/butter.h similarity index 88% rename from ReactCommon/better/better.h rename to ReactCommon/butter/butter.h index 0d300bd1ec1..5f3d71454a3 100644 --- a/ReactCommon/better/better.h +++ b/ReactCommon/butter/butter.h @@ -8,20 +8,20 @@ #pragma once namespace facebook { -namespace better { +namespace butter { /* - * `Better` is a trivial collection of basic tools borrowed from other low-level + * `Butter` is a trivial collection of basic tools borrowed from other low-level * general purpose libraries (like Folly, Abseil or Boost). The main goals of - * Better: + * Butter: * - Make the codebase more portable; * - Make the dependency list explicit (by decoupling it as a dependency list of - * Better); + * Butter); * - Make relying on modern C++ patterns and tools in code simple and easy. * - Make executing experiments with different dependencies easier. * - * What should be part of Better and what should not? Should I add some piece of - * functionality in the Better? Here is a quick checklist. + * What should be part of Butter and what should not? Should I add some piece of + * functionality in the Butter? Here is a quick checklist. * * If one of the following is true, yes, go for it: * - If some feature is already in some future C++ standard (possibly in draft @@ -55,8 +55,8 @@ namespace better { * introspections mechanisms. */ #ifndef DEBUG -#define BETTER_USE_FOLLY_CONTAINERS +#define BUTTER_USE_FOLLY_CONTAINERS #endif -} // namespace better +} // namespace butter } // namespace facebook diff --git a/ReactCommon/better/map.h b/ReactCommon/butter/map.h similarity index 73% rename from ReactCommon/better/map.h rename to ReactCommon/butter/map.h index 9fe72bd5e89..665528865d1 100644 --- a/ReactCommon/better/map.h +++ b/ReactCommon/butter/map.h @@ -7,9 +7,9 @@ #pragma once -#include +#include -#ifdef BETTER_USE_FOLLY_CONTAINERS +#ifdef BUTTER_USE_FOLLY_CONTAINERS #include @@ -20,16 +20,16 @@ #endif namespace facebook { -namespace better { +namespace butter { /* - * Note: In Better, `map` aliases to `unorderd_map` because everyone agrees that + * Note: In Butter, `map` aliases to `unorderd_map` because everyone agrees that * an *ordered* map is nonsense and was a huge mistake for standardization. If * you need an *ordered* map, feel free to introduce that as - * `better::ordered_map`. + * `butter::ordered_map`. */ -#ifdef BETTER_USE_FOLLY_CONTAINERS +#ifdef BUTTER_USE_FOLLY_CONTAINERS template using map = folly::F14FastMap; @@ -41,5 +41,5 @@ using map = std::unordered_map; #endif -} // namespace better +} // namespace butter } // namespace facebook diff --git a/ReactCommon/better/mutex.h b/ReactCommon/butter/mutex.h similarity index 89% rename from ReactCommon/better/mutex.h rename to ReactCommon/butter/mutex.h index e8451f818b7..d6f3976ddb6 100644 --- a/ReactCommon/better/mutex.h +++ b/ReactCommon/butter/mutex.h @@ -12,9 +12,9 @@ #include namespace facebook { -namespace better { +namespace butter { using shared_mutex = folly::SharedMutex; -} // namespace better +} // namespace butter } // namespace facebook diff --git a/ReactCommon/better/optional.h b/ReactCommon/butter/optional.h similarity index 70% rename from ReactCommon/better/optional.h rename to ReactCommon/butter/optional.h index f788d487822..1f6ab90ffe7 100644 --- a/ReactCommon/better/optional.h +++ b/ReactCommon/butter/optional.h @@ -7,9 +7,9 @@ #pragma once -#include +#include -#if defined(BETTER_USE_FOLLY_CONTAINERS) || __cplusplus < 202000L +#if defined(BUTTER_USE_FOLLY_CONTAINERS) || __cplusplus < 202000L #include @@ -20,9 +20,9 @@ #endif namespace facebook { -namespace better { +namespace butter { -#if defined(BETTER_USE_FOLLY_CONTAINERS) || __cplusplus < 202000L +#if defined(BUTTER_USE_FOLLY_CONTAINERS) || __cplusplus < 202000L template using optional = folly::Optional; @@ -34,5 +34,5 @@ using optional = std::optional; #endif -} // namespace better +} // namespace butter } // namespace facebook diff --git a/ReactCommon/better/set.h b/ReactCommon/butter/set.h similarity index 77% rename from ReactCommon/better/set.h rename to ReactCommon/butter/set.h index 2e41ce91eb0..85b04090b81 100644 --- a/ReactCommon/better/set.h +++ b/ReactCommon/butter/set.h @@ -7,9 +7,9 @@ #pragma once -#include +#include -#ifdef BETTER_USE_FOLLY_CONTAINERS +#ifdef BUTTER_USE_FOLLY_CONTAINERS #include @@ -20,9 +20,9 @@ #endif namespace facebook { -namespace better { +namespace butter { -#ifdef BETTER_USE_FOLLY_CONTAINERS +#ifdef BUTTER_USE_FOLLY_CONTAINERS template using set = folly::F14FastSet; @@ -34,5 +34,5 @@ using set = std::unordered_set; #endif -} // namespace better +} // namespace butter } // namespace facebook diff --git a/ReactCommon/better/small_vector.h b/ReactCommon/butter/small_vector.h similarity index 76% rename from ReactCommon/better/small_vector.h rename to ReactCommon/butter/small_vector.h index 54af50472b1..333dcf073aa 100644 --- a/ReactCommon/better/small_vector.h +++ b/ReactCommon/butter/small_vector.h @@ -7,10 +7,10 @@ #pragma once -#include +#include // `folly::small_vector` is broken on some versions of Android. -#if defined(BETTER_USE_FOLLY_CONTAINERS) && !defined(ANDROID) +#if defined(BUTTER_USE_FOLLY_CONTAINERS) && !defined(ANDROID) #include @@ -21,9 +21,9 @@ #endif namespace facebook { -namespace better { +namespace butter { -#if defined(BETTER_USE_FOLLY_CONTAINERS) && !defined(ANDROID) +#if defined(BUTTER_USE_FOLLY_CONTAINERS) && !defined(ANDROID) template using small_vector = folly::small_vector; @@ -35,5 +35,5 @@ using small_vector = std::vector; #endif -} // namespace better +} // namespace butter } // namespace facebook diff --git a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp index 86689c96ee8..cba4b798dbf 100644 --- a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp +++ b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp @@ -172,7 +172,7 @@ bool LayoutAnimationKeyFrameManager::shouldOverridePullTransaction() const { return shouldAnimateFrame(); } -better::optional +butter::optional LayoutAnimationKeyFrameManager::pullTransaction( SurfaceId surfaceId, MountingTransaction::Number transactionNumber, @@ -250,7 +250,7 @@ LayoutAnimationKeyFrameManager::pullTransaction( surfaceId, mutations, conflictingAnimations); // Are we animating this list of mutations? - better::optional currentAnimation{}; + butter::optional currentAnimation{}; { std::lock_guard lock(currentAnimationMutex_); if (currentAnimation_) { @@ -271,9 +271,9 @@ LayoutAnimationKeyFrameManager::pullTransaction( // TODO: to prevent this step we could tag Remove/Insert mutations as // being moves on the Differ level, since we know that there? We could use // TinyMap here, but it's not exposed by Differentiator (yet). - better::set insertedTags; - better::set deletedTags; - better::set reparentedTags; // tags that are deleted and recreated + butter::set insertedTags; + butter::set deletedTags; + butter::set reparentedTags; // tags that are deleted and recreated std::unordered_map movedTags; for (const auto &mutation : mutations) { if (mutation.type == ShadowViewMutation::Type::Insert) { @@ -320,7 +320,7 @@ LayoutAnimationKeyFrameManager::pullTransaction( continue; } - better::optional executeMutationImmediately{}; + butter::optional executeMutationImmediately{}; bool isRemoveReinserted = mutation.type == ShadowViewMutation::Type::Remove && @@ -1063,7 +1063,7 @@ LayoutAnimationKeyFrameManager::pullTransaction( void LayoutAnimationKeyFrameManager::uiManagerDidConfigureNextLayoutAnimation( LayoutAnimation layoutAnimation) const { - currentAnimation_ = better::optional{layoutAnimation}; + currentAnimation_ = butter::optional{layoutAnimation}; } void LayoutAnimationKeyFrameManager::setLayoutAnimationStatusDelegate( @@ -1616,7 +1616,7 @@ void LayoutAnimationKeyFrameManager::deleteAnimationsForStoppedSurfaces() // Execute stopSurface on any ongoing animations if (inflightAnimationsExistInitially) { - better::set surfaceIdsToStop{}; + butter::set surfaceIdsToStop{}; { std::lock_guard lock(surfaceIdsToStopMutex_); surfaceIdsToStop = surfaceIdsToStop_; diff --git a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h index 970b1e31077..02355726755 100644 --- a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h +++ b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h @@ -8,8 +8,8 @@ #pragma once #include -#include -#include +#include +#include #include #include #include @@ -67,7 +67,7 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate, // This is used to "hijack" the diffing process to figure out which mutations // should be animated. The mutations returned by this function will be // executed immediately. - better::optional pullTransaction( + butter::optional pullTransaction( SurfaceId surfaceId, MountingTransaction::Number number, TransactionTelemetry const &telemetry, @@ -95,7 +95,7 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate, protected: SharedComponentDescriptorRegistry componentDescriptorRegistry_; - mutable better::optional currentAnimation_{}; + mutable butter::optional currentAnimation_{}; mutable std::mutex currentAnimationMutex_; /** @@ -148,7 +148,7 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate, mutable std::mutex layoutAnimationStatusDelegateMutex_; mutable LayoutAnimationStatusDelegate *layoutAnimationStatusDelegate_{}; mutable std::mutex surfaceIdsToStopMutex_; - mutable better::set surfaceIdsToStop_{}; + mutable butter::set surfaceIdsToStop_{}; bool skipInvalidatedKeyFrames_{false}; /* diff --git a/ReactCommon/react/renderer/animations/conversions.h b/ReactCommon/react/renderer/animations/conversions.h index 1dc6acf6ae4..91c9293acf9 100644 --- a/ReactCommon/react/renderer/animations/conversions.h +++ b/ReactCommon/react/renderer/animations/conversions.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#include +#include #include #include @@ -13,7 +13,7 @@ namespace facebook { namespace react { -static inline better::optional parseAnimationType( +static inline butter::optional parseAnimationType( std::string param) { if (param == "spring") { return AnimationType::Spring; @@ -38,7 +38,7 @@ static inline better::optional parseAnimationType( return {}; } -static inline better::optional parseAnimationProperty( +static inline butter::optional parseAnimationProperty( std::string param) { if (param == "opacity") { return AnimationProperty::Opacity; @@ -57,7 +57,7 @@ static inline better::optional parseAnimationProperty( return {}; } -static inline better::optional parseAnimationConfig( +static inline butter::optional parseAnimationConfig( folly::dynamic const &config, double defaultDuration, bool parsePropertyType) { @@ -163,7 +163,7 @@ static inline better::optional parseAnimationConfig( } } - return better::optional(AnimationConfig{ + return butter::optional(AnimationConfig{ *animationType, animationProperty, duration, @@ -173,7 +173,7 @@ static inline better::optional parseAnimationConfig( } // Parse animation config from JS -static inline better::optional +static inline butter::optional parseLayoutAnimationConfig(folly::dynamic const &config) { if (config.empty() || !config.isObject()) { return {}; @@ -187,17 +187,17 @@ parseLayoutAnimationConfig(folly::dynamic const &config) { const auto createConfigIt = config.find("create"); const auto createConfig = createConfigIt == config.items().end() - ? better::optional(AnimationConfig{}) + ? butter::optional(AnimationConfig{}) : parseAnimationConfig(createConfigIt->second, duration, true); const auto updateConfigIt = config.find("update"); const auto updateConfig = updateConfigIt == config.items().end() - ? better::optional(AnimationConfig{}) + ? butter::optional(AnimationConfig{}) : parseAnimationConfig(updateConfigIt->second, duration, false); const auto deleteConfigIt = config.find("delete"); const auto deleteConfig = deleteConfigIt == config.items().end() - ? better::optional(AnimationConfig{}) + ? butter::optional(AnimationConfig{}) : parseAnimationConfig(deleteConfigIt->second, duration, true); if (!createConfig || !updateConfig || !deleteConfig) { diff --git a/ReactCommon/react/renderer/attributedstring/Android.mk b/ReactCommon/react/renderer/attributedstring/Android.mk index a3aad33a020..f38c0437ed3 100644 --- a/ReactCommon/react/renderer/attributedstring/Android.mk +++ b/ReactCommon/react/renderer/attributedstring/Android.mk @@ -23,7 +23,7 @@ LOCAL_STATIC_LIBRARIES := LOCAL_SHARED_LIBRARIES := \ glog \ - libbetter \ + libbutter \ libfolly_futures \ libfolly_json \ libglog_init \ @@ -38,7 +38,7 @@ LOCAL_SHARED_LIBRARIES := \ include $(BUILD_SHARED_LIBRARY) -$(call import-module,better) +$(call import-module,butter) $(call import-module,glog) $(call import-module,folly) $(call import-module,fbgloginit) diff --git a/ReactCommon/react/renderer/attributedstring/AttributedString.h b/ReactCommon/react/renderer/attributedstring/AttributedString.h index a1058c510bb..4f758f43018 100644 --- a/ReactCommon/react/renderer/attributedstring/AttributedString.h +++ b/ReactCommon/react/renderer/attributedstring/AttributedString.h @@ -56,7 +56,7 @@ class AttributedString : public Sealable, public DebugStringConvertible { int length{0}; }; - using Fragments = better::small_vector; + using Fragments = butter::small_vector; /* * Appends and prepends a `fragment` to the string. diff --git a/ReactCommon/react/renderer/attributedstring/TextAttributes.h b/ReactCommon/react/renderer/attributedstring/TextAttributes.h index 56c30652179..67b0d2de2ba 100644 --- a/ReactCommon/react/renderer/attributedstring/TextAttributes.h +++ b/ReactCommon/react/renderer/attributedstring/TextAttributes.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -46,38 +46,38 @@ class TextAttributes : public DebugStringConvertible { std::string fontFamily{""}; Float fontSize{std::numeric_limits::quiet_NaN()}; Float fontSizeMultiplier{std::numeric_limits::quiet_NaN()}; - better::optional fontWeight{}; - better::optional fontStyle{}; - better::optional fontVariant{}; - better::optional allowFontScaling{}; + butter::optional fontWeight{}; + butter::optional fontStyle{}; + butter::optional fontVariant{}; + butter::optional allowFontScaling{}; Float letterSpacing{std::numeric_limits::quiet_NaN()}; - better::optional textTransform{}; + butter::optional textTransform{}; // Paragraph Styles Float lineHeight{std::numeric_limits::quiet_NaN()}; - better::optional alignment{}; - better::optional baseWritingDirection{}; + butter::optional alignment{}; + butter::optional baseWritingDirection{}; // Decoration SharedColor textDecorationColor{}; - better::optional textDecorationLineType{}; - better::optional textDecorationStyle{}; + butter::optional textDecorationLineType{}; + butter::optional textDecorationStyle{}; // Shadow // TODO: Use `Point` type instead of `Size` for `textShadowOffset` attribute. - better::optional textShadowOffset{}; + butter::optional textShadowOffset{}; Float textShadowRadius{std::numeric_limits::quiet_NaN()}; SharedColor textShadowColor{}; // Special - better::optional isHighlighted{}; + butter::optional isHighlighted{}; // TODO T59221129: document where this value comes from and how it is set. // It's not clear if this is being used properly, or if it's being set at all. // Currently, it is intentionally *not* being set as part of BaseTextProps // construction. - better::optional layoutDirection{}; - better::optional accessibilityRole{}; + butter::optional layoutDirection{}; + butter::optional accessibilityRole{}; #pragma mark - Operations diff --git a/ReactCommon/react/renderer/attributedstring/conversions.h b/ReactCommon/react/renderer/attributedstring/conversions.h index 576b8f008bb..dddbc868bfa 100644 --- a/ReactCommon/react/renderer/attributedstring/conversions.h +++ b/ReactCommon/react/renderer/attributedstring/conversions.h @@ -768,7 +768,7 @@ inline void fromRawValue( const PropsParserContext &context, RawValue const &value, AttributedString::Range &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto start = map.find("start"); if (start != map.end()) { diff --git a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.cpp b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.cpp index 609316369d3..b0affd5118f 100644 --- a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.cpp +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.cpp @@ -12,7 +12,7 @@ namespace react { void ComponentDescriptorProviderRegistry::add( ComponentDescriptorProvider provider) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); /* // TODO: T57583139 @@ -45,7 +45,7 @@ void ComponentDescriptorProviderRegistry::add( void ComponentDescriptorProviderRegistry::setComponentDescriptorProviderRequest( ComponentDescriptorProviderRequest componentDescriptorProviderRequest) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); componentDescriptorProviderRequest_ = componentDescriptorProviderRequest; } @@ -54,7 +54,7 @@ void ComponentDescriptorProviderRegistry::request( ComponentDescriptorProviderRequest componentDescriptorProviderRequest; { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); componentDescriptorProviderRequest = componentDescriptorProviderRequest_; } @@ -66,7 +66,7 @@ void ComponentDescriptorProviderRegistry::request( ComponentDescriptorRegistry::Shared ComponentDescriptorProviderRegistry::createComponentDescriptorRegistry( ComponentDescriptorParameters const ¶meters) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); auto registry = std::make_shared( parameters, *this, parameters.contextContainer); diff --git a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h index c4d1982b0b0..245511ccb44 100644 --- a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -59,10 +59,10 @@ class ComponentDescriptorProviderRegistry final { void request(ComponentName componentName) const; - mutable better::shared_mutex mutex_; + mutable butter::shared_mutex mutex_; mutable std::vector> componentDescriptorRegistries_; - mutable better::map + mutable butter::map componentDescriptorProviders_; mutable ComponentDescriptorProviderRequest componentDescriptorProviderRequest_; diff --git a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp index 137fb20cbbf..35cd6b328c8 100644 --- a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp @@ -27,7 +27,7 @@ ComponentDescriptorRegistry::ComponentDescriptorRegistry( void ComponentDescriptorRegistry::add( ComponentDescriptorProvider componentDescriptorProvider) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); auto componentDescriptor = componentDescriptorProvider.constructor( {parameters_.eventDispatcher, @@ -58,7 +58,7 @@ void ComponentDescriptorRegistry::registerComponentDescriptor( ComponentDescriptor const &ComponentDescriptorRegistry::at( std::string const &componentName) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); auto unifiedComponentName = componentNameByReactViewName(componentName); @@ -95,7 +95,7 @@ ComponentDescriptor const &ComponentDescriptorRegistry::at( ComponentDescriptor const *ComponentDescriptorRegistry:: findComponentDescriptorByHandle_DO_NOT_USE_THIS_IS_BROKEN( ComponentHandle componentHandle) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); auto iterator = _registryByHandle.find(componentHandle); if (iterator == _registryByHandle.end()) { @@ -107,14 +107,14 @@ ComponentDescriptor const *ComponentDescriptorRegistry:: ComponentDescriptor const &ComponentDescriptorRegistry::at( ComponentHandle componentHandle) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); return *_registryByHandle.at(componentHandle); } bool ComponentDescriptorRegistry::hasComponentDescriptorAt( ComponentHandle componentHandle) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); auto iterator = _registryByHandle.find(componentHandle); if (iterator == _registryByHandle.end()) { diff --git a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h index e23d41c1461..c35f3528e76 100644 --- a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h @@ -9,8 +9,8 @@ #include -#include -#include +#include +#include #include #include @@ -80,10 +80,10 @@ class ComponentDescriptorRegistry { */ void add(ComponentDescriptorProvider componentDescriptorProvider) const; - mutable better::shared_mutex mutex_; - mutable better::map + mutable butter::shared_mutex mutex_; + mutable butter::map _registryByHandle; - mutable better::map _registryByName; + mutable butter::map _registryByName; ComponentDescriptor::Shared _fallbackComponentDescriptor; ComponentDescriptorParameters parameters_{}; ComponentDescriptorProviderRegistry const &providerRegistry_; diff --git a/ReactCommon/react/renderer/components/image/conversions.h b/ReactCommon/react/renderer/components/image/conversions.h index 9449dfe773b..fd73d729297 100644 --- a/ReactCommon/react/renderer/components/image/conversions.h +++ b/ReactCommon/react/renderer/components/image/conversions.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -30,8 +30,8 @@ inline void fromRawValue( return; } - if (value.hasType>()) { - auto items = (better::map)value; + if (value.hasType>()) { + auto items = (butter::map)value; result = {}; result.type = ImageSource::Type::Remote; diff --git a/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h b/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h index 5bd8c1b1085..f79d2788027 100644 --- a/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h +++ b/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h @@ -101,7 +101,7 @@ class ParagraphShadowNode final : public ConcreteViewShadowNode< /* * Cached content of the subtree started from the node. */ - mutable better::optional content_{}; + mutable butter::optional content_{}; }; } // namespace react diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputComponentDescriptor.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputComponentDescriptor.h index 1728de336a8..2959cef5096 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputComponentDescriptor.h @@ -180,7 +180,7 @@ class AndroidTextInputComponentDescriptor final "com/facebook/react/fabric/FabricUIManager"; SharedTextLayoutManager textLayoutManager_; - mutable better::map surfaceIdToThemePaddingMap_; + mutable butter::map surfaceIdToThemePaddingMap_; }; } // namespace react diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.h index 34048ddf910..e905328dec9 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.h @@ -37,7 +37,7 @@ static inline void fromRawValue( const PropsParserContext &context, const RawValue &value, AndroidTextInputSelectionStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto start = map.find("start"); if (start != map.end()) { @@ -63,7 +63,7 @@ static inline void fromRawValue( const PropsParserContext &context, const RawValue &value, AndroidTextInputTextShadowOffsetStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto width = map.find("width"); if (width != map.end()) { diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h index 2642030d947..82102da116b 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h @@ -81,7 +81,7 @@ class AndroidTextInputShadowNode final : public ConcreteViewShadowNode< * Cached attributed string that represents the content of the subtree started * from the node. */ - mutable better::optional cachedAttributedString_{}; + mutable butter::optional cachedAttributedString_{}; }; } // namespace react diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp index c51fde989ae..879278e7033 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp @@ -87,7 +87,7 @@ TextInputProps::TextInputProps( rawProps, "selection", sourceProps.selection, - better::optional())), + butter::optional())), inputAccessoryViewID(convertRawProp( context, rawProps, diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h index c78f8b55c02..59355f01c11 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h @@ -58,7 +58,7 @@ class TextInputProps final : public ViewProps, public BaseTextProps { int const mostRecentEventCount{0}; bool autoFocus{false}; - better::optional selection{}; + butter::optional selection{}; std::string const inputAccessoryViewID{}; diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/primitives.h b/ReactCommon/react/renderer/components/textinput/iostextinput/primitives.h index f3b0fc2dfc5..328fb869d57 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/primitives.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/primitives.h @@ -9,7 +9,7 @@ #include -#include +#include namespace facebook { namespace react { @@ -106,7 +106,7 @@ class TextInputTraits final { * iOS & Android * Default value: `empty` (`null`). */ - better::optional autoCorrect{}; + butter::optional autoCorrect{}; /* * iOS & Android @@ -141,7 +141,7 @@ class TextInputTraits final { * Can be empty (`null` in JavaScript) which means `default`. * Default value: `empty` (`null`). */ - better::optional spellCheck{}; + butter::optional spellCheck{}; /* * iOS & Android diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/propsConversions.h b/ReactCommon/react/renderer/components/textinput/iostextinput/propsConversions.h index 162e9891124..002257b0341 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/propsConversions.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/propsConversions.h @@ -149,8 +149,8 @@ inline void fromRawValue( const PropsParserContext &context, const RawValue &value, Selection &result) { - if (value.hasType>()) { - auto map = (better::map)value; + if (value.hasType>()) { + auto map = (butter::map)value; for (const auto &pair : map) { if (pair.first == "start") { result.start = pair.second; diff --git a/ReactCommon/react/renderer/components/view/AccessibilityPrimitives.h b/ReactCommon/react/renderer/components/view/AccessibilityPrimitives.h index 23999ae4d28..39be929b864 100644 --- a/ReactCommon/react/renderer/components/view/AccessibilityPrimitives.h +++ b/ReactCommon/react/renderer/components/view/AccessibilityPrimitives.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -50,7 +50,7 @@ constexpr enum AccessibilityTraits operator&( struct AccessibilityAction { std::string name{""}; - better::optional label{}; + butter::optional label{}; }; struct AccessibilityState { @@ -76,10 +76,10 @@ constexpr bool operator!=( } struct AccessibilityValue { - better::optional min; - better::optional max; - better::optional now; - better::optional text{}; + butter::optional min; + butter::optional max; + butter::optional now; + butter::optional text{}; }; constexpr bool operator==( diff --git a/ReactCommon/react/renderer/components/view/ViewProps.h b/ReactCommon/react/renderer/components/view/ViewProps.h index 558105face7..58140d80e16 100644 --- a/ReactCommon/react/renderer/components/view/ViewProps.h +++ b/ReactCommon/react/renderer/components/view/ViewProps.h @@ -54,7 +54,7 @@ class ViewProps : public YogaStylableProps, public AccessibilityProps { Transform transform{}; BackfaceVisibility backfaceVisibility{}; bool shouldRasterize{}; - better::optional zIndex{}; + butter::optional zIndex{}; // Events PointerEventsMode pointerEvents{}; diff --git a/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h b/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h index 77ba8131145..314b509ba88 100644 --- a/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h +++ b/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h @@ -25,7 +25,7 @@ namespace react { class YogaLayoutableShadowNode : public LayoutableShadowNode { public: - using UnsharedList = better::small_vector< + using UnsharedList = butter::small_vector< YogaLayoutableShadowNode *, kShadowNodeChildrenSmallVectorSize>; diff --git a/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h b/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h index 92c52527cd5..3971305c1fd 100644 --- a/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h +++ b/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h @@ -133,7 +133,7 @@ inline void fromRawValue( const PropsParserContext &context, const RawValue &value, AccessibilityState &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto selected = map.find("selected"); if (selected != map.end()) { fromRawValue(context, selected->second, result.selected); @@ -212,7 +212,7 @@ inline void fromRawValue( const PropsParserContext &context, const RawValue &value, AccessibilityAction &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto name = map.find("name"); react_native_assert(name != map.end() && name->second.hasType()); @@ -232,7 +232,7 @@ inline void fromRawValue( const PropsParserContext &, const RawValue &value, AccessibilityValue &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto min = map.find("min"); if (min != map.end()) { diff --git a/ReactCommon/react/renderer/components/view/conversions.h b/ReactCommon/react/renderer/components/view/conversions.h index 36fc9d507f1..2c0ce9193b9 100644 --- a/ReactCommon/react/renderer/components/view/conversions.h +++ b/ReactCommon/react/renderer/components/view/conversions.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include #include #include @@ -98,9 +98,9 @@ inline YGValue yogaStyleValueFromFloat( return {(float)value, unit}; } -inline better::optional optionalFloatFromYogaValue( +inline butter::optional optionalFloatFromYogaValue( const YGValue value, - better::optional base = {}) { + butter::optional base = {}) { switch (value.unit) { case YGUnitUndefined: return {}; @@ -108,9 +108,9 @@ inline better::optional optionalFloatFromYogaValue( return floatFromYogaFloat(value.value); case YGUnitPercent: return base.has_value() - ? better::optional( + ? butter::optional( base.value() * floatFromYogaFloat(value.value)) - : better::optional(); + : butter::optional(); case YGUnitAuto: return {}; } @@ -444,14 +444,14 @@ inline void fromRawValue( auto configurations = static_cast>(value); for (const auto &configuration : configurations) { - if (!configuration.hasType>()) { + if (!configuration.hasType>()) { // TODO: The following checks have to be removed after codegen is shipped. // See T45151459. continue; } auto configurationPair = - static_cast>(configuration); + static_cast>(configuration); auto pair = configurationPair.begin(); auto operation = pair->first; auto ¶meters = pair->second; diff --git a/ReactCommon/react/renderer/components/view/primitives.h b/ReactCommon/react/renderer/components/view/primitives.h index 52e5f3f08c2..2d89582635d 100644 --- a/ReactCommon/react/renderer/components/view/primitives.h +++ b/ReactCommon/react/renderer/components/view/primitives.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -25,7 +25,7 @@ enum class BorderStyle { Solid, Dotted, Dashed }; template struct CascadedRectangleEdges { using Counterpart = RectangleEdges; - using OptionalT = better::optional; + using OptionalT = butter::optional; OptionalT left{}; OptionalT top{}; @@ -86,7 +86,7 @@ struct CascadedRectangleEdges { template struct CascadedRectangleCorners { using Counterpart = RectangleCorners; - using OptionalT = better::optional; + using OptionalT = butter::optional; OptionalT topLeft{}; OptionalT topRight{}; diff --git a/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp b/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp index 3e8a531306a..3c8f295eaaf 100644 --- a/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp +++ b/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp @@ -56,7 +56,7 @@ LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics( // Step 1. // Creating a list of nodes that form a chain from the descender node to // ancestor node inclusively. - auto shadowNodeList = better::small_vector{}; + auto shadowNodeList = butter::small_vector{}; // Finding the measured node. // The last element in the `AncestorList` is a pair of a parent of the node diff --git a/ReactCommon/react/renderer/core/LayoutableShadowNode.h b/ReactCommon/react/renderer/core/LayoutableShadowNode.h index a2653102cbf..9344de8b8c2 100644 --- a/ReactCommon/react/renderer/core/LayoutableShadowNode.h +++ b/ReactCommon/react/renderer/core/LayoutableShadowNode.h @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include #include @@ -49,7 +49,7 @@ class LayoutableShadowNode : public ShadowNode { bool includeViewportOffset{false}; }; - using UnsharedList = better:: + using UnsharedList = butter:: small_vector; /* diff --git a/ReactCommon/react/renderer/core/RawProps.h b/ReactCommon/react/renderer/core/RawProps.h index 93d0b6ec3b3..b34c3d2eaba 100644 --- a/ReactCommon/react/renderer/core/RawProps.h +++ b/ReactCommon/react/renderer/core/RawProps.h @@ -9,9 +9,9 @@ #include -#include -#include -#include +#include +#include +#include #include #include @@ -125,10 +125,10 @@ class RawProps final { * Parsed artefacts: * To be used by `RawPropParser`. */ - mutable better:: + mutable butter:: small_vector keyIndexToValueIndex_; - mutable better:: + mutable butter:: small_vector values_; }; diff --git a/ReactCommon/react/renderer/core/RawPropsKeyMap.h b/ReactCommon/react/renderer/core/RawPropsKeyMap.h index 3c300a31409..2fe0694cbf5 100644 --- a/ReactCommon/react/renderer/core/RawPropsKeyMap.h +++ b/ReactCommon/react/renderer/core/RawPropsKeyMap.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -55,8 +55,8 @@ class RawPropsKeyMap final { Item const &rhs) noexcept; static bool hasSameName(Item const &lhs, Item const &rhs) noexcept; - better::small_vector items_{}; - better::small_vector + butter::small_vector items_{}; + butter::small_vector buckets_{}; }; diff --git a/ReactCommon/react/renderer/core/RawPropsParser.h b/ReactCommon/react/renderer/core/RawPropsParser.h index 5d37cefd8c3..597f0623920 100644 --- a/ReactCommon/react/renderer/core/RawPropsParser.h +++ b/ReactCommon/react/renderer/core/RawPropsParser.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include #include #include @@ -76,7 +76,7 @@ class RawPropsParser final { RawValue const *at(RawProps const &rawProps, RawPropsKey const &key) const noexcept; - mutable better::small_vector + mutable butter::small_vector keys_{}; mutable RawPropsKeyMap nameToIndex_{}; mutable int size_{0}; diff --git a/ReactCommon/react/renderer/core/RawValue.h b/ReactCommon/react/renderer/core/RawValue.h index 16cab0bd7b9..37f9a2a6ead 100644 --- a/ReactCommon/react/renderer/core/RawValue.h +++ b/ReactCommon/react/renderer/core/RawValue.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -78,7 +78,7 @@ class RawValue { /* * Copy constructor and copy assignment operator would be private and only for * internal use, but it's needed for user-code that does `auto val = - * (better::map)rawVal;` + * (butter::map)rawVal;` */ RawValue(RawValue const &other) noexcept : dynamic_(other.dynamic_) {} @@ -185,7 +185,7 @@ class RawValue { template static bool checkValueType( const folly::dynamic &dynamic, - better::map *type) noexcept { + butter::map *type) noexcept { if (!dynamic.isObject()) { return false; } @@ -267,11 +267,11 @@ class RawValue { } template - static better::map castValue( + static butter::map castValue( const folly::dynamic &dynamic, - better::map *type) noexcept { + butter::map *type) noexcept { react_native_assert(dynamic.isObject()); - auto result = better::map{}; + auto result = butter::map{}; for (const auto &item : dynamic.items()) { react_native_assert(item.first.isString()); result[item.first.getString()] = castValue(item.second, (T *)nullptr); diff --git a/ReactCommon/react/renderer/core/ShadowNode.cpp b/ReactCommon/react/renderer/core/ShadowNode.cpp index 4c7258c4cbb..f7e119d7665 100644 --- a/ReactCommon/react/renderer/core/ShadowNode.cpp +++ b/ReactCommon/react/renderer/core/ShadowNode.cpp @@ -9,7 +9,7 @@ #include "DynamicPropsUtilities.h" #include "ShadowNodeFragment.h" -#include +#include #include #include diff --git a/ReactCommon/react/renderer/core/ShadowNode.h b/ReactCommon/react/renderer/core/ShadowNode.h index 1ef71355f06..71356dc1303 100644 --- a/ReactCommon/react/renderer/core/ShadowNode.h +++ b/ReactCommon/react/renderer/core/ShadowNode.h @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -34,7 +34,7 @@ class ShadowNode; using SharedShadowNode = std::shared_ptr; using WeakShadowNode = std::weak_ptr; using SharedShadowNodeList = - better::small_vector; + butter::small_vector; using SharedShadowNodeSharedList = std::shared_ptr; using SharedShadowNodeUnsharedList = std::shared_ptr; @@ -44,14 +44,14 @@ class ShadowNode : public Sealable, public DebugStringConvertible { using Weak = std::weak_ptr; using Unshared = std::shared_ptr; using ListOfShared = - better::small_vector; + butter::small_vector; using ListOfWeak = - better::small_vector; + butter::small_vector; using SharedListOfShared = std::shared_ptr; using UnsharedListOfShared = std::shared_ptr; using UnsharedListOfWeak = std::shared_ptr; - using AncestorList = better::small_vector< + using AncestorList = butter::small_vector< std::pair< std::reference_wrapper /* parentNode */, int /* childIndex */>, diff --git a/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp b/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp index f4c06442556..4927c322b88 100644 --- a/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp +++ b/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp @@ -57,7 +57,7 @@ const ComponentDescriptor &ShadowNodeFamily::getComponentDescriptor() const { AncestorList ShadowNodeFamily::getAncestors( ShadowNode const &ancestorShadowNode) const { - auto families = better::small_vector{}; + auto families = butter::small_vector{}; auto ancestorFamily = ancestorShadowNode.family_.get(); auto family = this; @@ -96,12 +96,12 @@ AncestorList ShadowNodeFamily::getAncestors( } State::Shared ShadowNodeFamily::getMostRecentState() const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); return mostRecentState_; } void ShadowNodeFamily::setMostRecentState(State::Shared const &state) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); /* * Checking and setting `isObsolete_` prevents old states to be recommitted @@ -122,7 +122,7 @@ void ShadowNodeFamily::setMostRecentState(State::Shared const &state) const { std::shared_ptr ShadowNodeFamily::getMostRecentStateIfObsolete( State const &state) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); if (!state.isObsolete_) { return {}; } diff --git a/ReactCommon/react/renderer/core/ShadowNodeFamily.h b/ReactCommon/react/renderer/core/ShadowNodeFamily.h index 07746e35501..3c6100a65b7 100644 --- a/ReactCommon/react/renderer/core/ShadowNodeFamily.h +++ b/ReactCommon/react/renderer/core/ShadowNodeFamily.h @@ -9,8 +9,8 @@ #include -#include -#include +#include +#include #include #include @@ -32,7 +32,7 @@ class ShadowNodeFamily final { using Shared = std::shared_ptr; using Weak = std::weak_ptr; - using AncestorList = better::small_vector< + using AncestorList = butter::small_vector< std::pair< std::reference_wrapper /* parentNode */, int /* childIndex */>, @@ -101,7 +101,7 @@ class ShadowNodeFamily final { EventDispatcher::Weak eventDispatcher_; mutable std::shared_ptr mostRecentState_; - mutable better::shared_mutex mutex_; + mutable butter::shared_mutex mutex_; /* * Deprecated. diff --git a/ReactCommon/react/renderer/core/propsConversions.h b/ReactCommon/react/renderer/core/propsConversions.h index 55e78f24303..9e24f917f75 100644 --- a/ReactCommon/react/renderer/core/propsConversions.h +++ b/ReactCommon/react/renderer/core/propsConversions.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -106,12 +106,12 @@ T convertRawProp( } template -static better::optional convertRawProp( +static butter::optional convertRawProp( const PropsParserContext &context, RawProps const &rawProps, char const *name, - better::optional const &sourceValue, - better::optional const &defaultValue, + butter::optional const &sourceValue, + butter::optional const &defaultValue, char const *namePrefix = nullptr, char const *nameSuffix = nullptr) { const auto *rawValue = rawProps.at(name, namePrefix, nameSuffix); @@ -128,7 +128,7 @@ static better::optional convertRawProp( T result; fromRawValue(context, *rawValue, result); - return better::optional{result}; + return butter::optional{result}; } } // namespace react diff --git a/ReactCommon/react/renderer/debug/BUCK b/ReactCommon/react/renderer/debug/BUCK index 73bed3edf81..1fb3ddbd8e8 100644 --- a/ReactCommon/react/renderer/debug/BUCK +++ b/ReactCommon/react/renderer/debug/BUCK @@ -50,7 +50,7 @@ rn_xplat_cxx_library( "//xplat/folly:headers_only", "//xplat/folly:memory", "//xplat/folly:molly", - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), react_native_xplat_target("react/debug:debug"), ], ) diff --git a/ReactCommon/react/renderer/debug/debugStringConvertibleUtils.h b/ReactCommon/react/renderer/debug/debugStringConvertibleUtils.h index a41054e2207..61153e203b3 100644 --- a/ReactCommon/react/renderer/debug/debugStringConvertibleUtils.h +++ b/ReactCommon/react/renderer/debug/debugStringConvertibleUtils.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -34,7 +34,7 @@ debugStringConvertibleItem(std::string name, T value, T defaultValue = {}) { template inline SharedDebugStringConvertible debugStringConvertibleItem( std::string name, - better::optional value, + butter::optional value, T defaultValue = {}) { if (!value.hasValue()) { return nullptr; diff --git a/ReactCommon/react/renderer/graphics/BUCK b/ReactCommon/react/renderer/graphics/BUCK index 34748db2427..c8016ee5d93 100644 --- a/ReactCommon/react/renderer/graphics/BUCK +++ b/ReactCommon/react/renderer/graphics/BUCK @@ -102,7 +102,7 @@ rn_xplat_cxx_library( visibility = ["PUBLIC"], deps = [ react_native_xplat_target("react/debug:debug"), - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), "//third-party/glog:glog", "//xplat/fbsystrace:fbsystrace", "//xplat/folly:headers_only", diff --git a/ReactCommon/react/renderer/graphics/conversions.h b/ReactCommon/react/renderer/graphics/conversions.h index 54842aed296..3f260671084 100644 --- a/ReactCommon/react/renderer/graphics/conversions.h +++ b/ReactCommon/react/renderer/graphics/conversions.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -88,8 +88,8 @@ inline void fromRawValue( const PropsParserContext &context, const RawValue &value, Point &result) { - if (value.hasType>()) { - auto map = (better::map)value; + if (value.hasType>()) { + auto map = (butter::map)value; for (const auto &pair : map) { if (pair.first == "x") { result.x = pair.second; @@ -119,8 +119,8 @@ inline void fromRawValue( const PropsParserContext &context, const RawValue &value, Size &result) { - if (value.hasType>()) { - auto map = (better::map)value; + if (value.hasType>()) { + auto map = (butter::map)value; for (const auto &pair : map) { if (pair.first == "width") { result.width = pair.second; @@ -159,8 +159,8 @@ inline void fromRawValue( return; } - if (value.hasType>()) { - auto map = (better::map)value; + if (value.hasType>()) { + auto map = (butter::map)value; for (const auto &pair : map) { if (pair.first == "top") { result.top = pair.second; @@ -203,8 +203,8 @@ inline void fromRawValue( return; } - if (value.hasType>()) { - auto map = (better::map)value; + if (value.hasType>()) { + auto map = (butter::map)value; for (const auto &pair : map) { if (pair.first == "topLeft") { result.topLeft = pair.second; diff --git a/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h b/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h index 950dd1ad842..b743168fb53 100644 --- a/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h +++ b/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h @@ -21,8 +21,8 @@ inline ColorComponents parsePlatformColor( const RawValue &value) { ColorComponents colorComponents = {0, 0, 0, 0}; - if (value.hasType>>()) { - auto map = (better::map>)value; + if (value.hasType>>()) { + auto map = (butter::map>)value; auto resourcePaths = map["resource_paths"]; auto dynamicResourcePaths = folly::dynamic::array(); for (const auto &resourcePath : resourcePaths) { diff --git a/ReactCommon/react/renderer/graphics/platform/ios/Color.h b/ReactCommon/react/renderer/graphics/platform/ios/Color.h index 5078b43f1e4..f9a8c5382eb 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/Color.h +++ b/ReactCommon/react/renderer/graphics/platform/ios/Color.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include diff --git a/ReactCommon/react/renderer/graphics/platform/ios/PlatformColorParser.h b/ReactCommon/react/renderer/graphics/platform/ios/PlatformColorParser.h index 3437b280760..7425ebb7bb7 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/PlatformColorParser.h +++ b/ReactCommon/react/renderer/graphics/platform/ios/PlatformColorParser.h @@ -18,8 +18,8 @@ namespace react { inline ColorComponents parsePlatformColor( const PropsParserContext &context, const RawValue &value) { - if (value.hasType>()) { - auto items = (better::map)value; + if (value.hasType>()) { + auto items = (butter::map)value; if (items.find("semantic") != items.end() && items.at("semantic").hasType>()) { auto semanticItems = (std::vector)items.at("semantic"); diff --git a/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.h b/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.h index 6b1f8301588..3d01a3742e5 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.h +++ b/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include @@ -59,7 +59,7 @@ class ImageResponseObserverCoordinator { * List of observers. * Mutable: protected by mutex_. */ - mutable better::small_vector observers_; + mutable butter::small_vector observers_; /* * Current status of image loading. diff --git a/ReactCommon/react/renderer/mounting/Android.mk b/ReactCommon/react/renderer/mounting/Android.mk index 1de6b4347a1..e79e80bad10 100644 --- a/ReactCommon/react/renderer/mounting/Android.mk +++ b/ReactCommon/react/renderer/mounting/Android.mk @@ -23,7 +23,7 @@ LOCAL_STATIC_LIBRARIES := LOCAL_SHARED_LIBRARIES := \ glog \ - libbetter \ + libbutter \ libfolly_futures \ libfolly_json \ libglog_init \ @@ -40,7 +40,7 @@ LOCAL_SHARED_LIBRARIES := \ include $(BUILD_SHARED_LIBRARY) -$(call import-module,better) +$(call import-module,butter) $(call import-module,glog) $(call import-module,folly) $(call import-module,fbgloginit) diff --git a/ReactCommon/react/renderer/mounting/BUCK b/ReactCommon/react/renderer/mounting/BUCK index 20a434f8687..365ad353ce4 100644 --- a/ReactCommon/react/renderer/mounting/BUCK +++ b/ReactCommon/react/renderer/mounting/BUCK @@ -50,7 +50,7 @@ rn_xplat_cxx_library( "//xplat/folly:headers_only", "//xplat/folly:memory", "//xplat/folly:molly", - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), react_native_xplat_target("react/debug:debug"), react_native_xplat_target("react/renderer/components/root:root"), react_native_xplat_target("react/renderer/components/view:view"), diff --git a/ReactCommon/react/renderer/mounting/Differentiator.cpp b/ReactCommon/react/renderer/mounting/Differentiator.cpp index a37e90758fc..df09a41b1c1 100644 --- a/ReactCommon/react/renderer/mounting/Differentiator.cpp +++ b/ReactCommon/react/renderer/mounting/Differentiator.cpp @@ -7,8 +7,8 @@ #include "Differentiator.h" -#include -#include +#include +#include #include #include #include @@ -168,7 +168,7 @@ class TinyMap final { erasedAtFront_ = 0; } - better::small_vector vector_; + butter::small_vector vector_; size_t numErased_{0}; size_t erasedAtFront_{0}; }; diff --git a/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp b/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp index 98001cfa1c1..762df7bc333 100644 --- a/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp +++ b/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp @@ -75,11 +75,11 @@ void MountingCoordinator::resetLatestRevision() const { lastRevision_.reset(); } -better::optional MountingCoordinator::pullTransaction() +butter::optional MountingCoordinator::pullTransaction() const { std::lock_guard lock(mutex_); - auto transaction = better::optional{}; + auto transaction = butter::optional{}; // Base case if (lastRevision_.has_value()) { diff --git a/ReactCommon/react/renderer/mounting/MountingCoordinator.h b/ReactCommon/react/renderer/mounting/MountingCoordinator.h index 00c12ba0685..dd9ad34e87e 100644 --- a/ReactCommon/react/renderer/mounting/MountingCoordinator.h +++ b/ReactCommon/react/renderer/mounting/MountingCoordinator.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -56,7 +56,7 @@ class MountingCoordinator final { * However, a consumer should always call it on the same thread (e.g. on the * main thread) or ensure sequentiality of mount transactions separately. */ - better::optional pullTransaction() const; + butter::optional pullTransaction() const; /* * Blocks the current thread until a new mounting transaction is available or @@ -104,7 +104,7 @@ class MountingCoordinator final { mutable std::mutex mutex_; mutable ShadowTreeRevision baseRevision_; - mutable better::optional lastRevision_{}; + mutable butter::optional lastRevision_{}; mutable MountingTransaction::Number number_{0}; mutable std::condition_variable signal_; mutable std::weak_ptr diff --git a/ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h b/ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h index 5aa95d4d80f..2412abe0516 100644 --- a/ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h +++ b/ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h @@ -36,7 +36,7 @@ class MountingOverrideDelegate { * @param mountingCoordinator * @return */ - virtual better::optional pullTransaction( + virtual butter::optional pullTransaction( SurfaceId surfaceId, MountingTransaction::Number number, TransactionTelemetry const &telemetry, diff --git a/ReactCommon/react/renderer/mounting/ShadowTree.cpp b/ReactCommon/react/renderer/mounting/ShadowTree.cpp index 1d3c6fe8dce..61e4deb6984 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTree.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowTree.cpp @@ -270,7 +270,7 @@ void ShadowTree::setCommitMode(CommitMode commitMode) const { auto revision = ShadowTreeRevision{}; { - std::unique_lock lock(commitMutex_); + std::unique_lock lock(commitMutex_); if (commitMode_ == commitMode) { return; } @@ -287,7 +287,7 @@ void ShadowTree::setCommitMode(CommitMode commitMode) const { } CommitMode ShadowTree::getCommitMode() const { - std::shared_lock lock(commitMutex_); + std::shared_lock lock(commitMutex_); return commitMode_; } @@ -330,7 +330,7 @@ CommitStatus ShadowTree::tryCommit( { // Reading `currentRevision_` in shared manner. - std::shared_lock lock(commitMutex_); + std::shared_lock lock(commitMutex_); commitMode = commitMode_; oldRevision = currentRevision_; } @@ -367,7 +367,7 @@ CommitStatus ShadowTree::tryCommit( { // Updating `currentRevision_` in unique manner if it hasn't changed. - std::unique_lock lock(commitMutex_); + std::unique_lock lock(commitMutex_); if (currentRevision_.number != oldRevision.number) { return CommitStatus::Failed; @@ -410,7 +410,7 @@ CommitStatus ShadowTree::tryCommit( } ShadowTreeRevision ShadowTree::getCurrentRevision() const { - std::shared_lock lock(commitMutex_); + std::shared_lock lock(commitMutex_); return currentRevision_; } diff --git a/ReactCommon/react/renderer/mounting/ShadowTree.h b/ReactCommon/react/renderer/mounting/ShadowTree.h index 2553fdc3d31..bf8c1a2ffeb 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTree.h +++ b/ReactCommon/react/renderer/mounting/ShadowTree.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -135,7 +135,7 @@ class ShadowTree final { SurfaceId const surfaceId_; ShadowTreeDelegate const &delegate_; - mutable better::shared_mutex commitMutex_; + mutable butter::shared_mutex commitMutex_; mutable CommitMode commitMode_{ CommitMode::Normal}; // Protected by `commitMutex_`. mutable ShadowTreeRevision currentRevision_; // Protected by `commitMutex_`. diff --git a/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp index d2f65fb115c..b5bbbdf4fe1 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp @@ -18,14 +18,14 @@ ShadowTreeRegistry::~ShadowTreeRegistry() { } void ShadowTreeRegistry::add(std::unique_ptr &&shadowTree) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); registry_.emplace(shadowTree->getSurfaceId(), std::move(shadowTree)); } std::unique_ptr ShadowTreeRegistry::remove( SurfaceId surfaceId) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); auto iterator = registry_.find(surfaceId); if (iterator == registry_.end()) { @@ -40,7 +40,7 @@ std::unique_ptr ShadowTreeRegistry::remove( bool ShadowTreeRegistry::visit( SurfaceId surfaceId, std::function callback) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); auto iterator = registry_.find(surfaceId); @@ -54,7 +54,7 @@ bool ShadowTreeRegistry::visit( void ShadowTreeRegistry::enumerate( std::function callback) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); for (auto const &pair : registry_) { callback(*pair.second); } diff --git a/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h index 9958611203b..23fda940f63 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h +++ b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include #include @@ -60,8 +60,8 @@ class ShadowTreeRegistry final { std::function callback) const; private: - mutable better::shared_mutex mutex_; - mutable better::map> + mutable butter::shared_mutex mutex_; + mutable butter::map> registry_; // Protected by `mutex_`. }; diff --git a/ReactCommon/react/renderer/mounting/ShadowTreeRevision.h b/ReactCommon/react/renderer/mounting/ShadowTreeRevision.h index 50e05ad7741..839da03ecf3 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTreeRevision.h +++ b/ReactCommon/react/renderer/mounting/ShadowTreeRevision.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include diff --git a/ReactCommon/react/renderer/mounting/ShadowView.h b/ReactCommon/react/renderer/mounting/ShadowView.h index 614399b2fb0..f49deaf9487 100644 --- a/ReactCommon/react/renderer/mounting/ShadowView.h +++ b/ReactCommon/react/renderer/mounting/ShadowView.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -65,9 +65,9 @@ std::vector getDebugProps( * */ struct ShadowViewNodePair final { - using NonOwningList = better:: + using NonOwningList = butter:: small_vector; - using OwningList = better:: + using OwningList = butter:: small_vector; ShadowView shadowView; @@ -103,7 +103,7 @@ struct ShadowViewNodePair final { * */ struct ShadowViewNodePairLegacy final { - using OwningList = better::small_vector< + using OwningList = butter::small_vector< ShadowViewNodePairLegacy, kShadowNodeChildrenSmallVectorSize>; diff --git a/ReactCommon/react/renderer/runtimescheduler/BUCK b/ReactCommon/react/renderer/runtimescheduler/BUCK index 81f2b99954f..061fa3197f3 100644 --- a/ReactCommon/react/renderer/runtimescheduler/BUCK +++ b/ReactCommon/react/renderer/runtimescheduler/BUCK @@ -46,7 +46,7 @@ rn_xplat_cxx_library( deps = [ react_native_xplat_target("runtimeexecutor:runtimeexecutor"), react_native_xplat_target("react/renderer/debug:debug"), - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), react_native_xplat_target("callinvoker:callinvoker"), ], ) diff --git a/ReactCommon/react/renderer/runtimescheduler/Task.h b/ReactCommon/react/renderer/runtimescheduler/Task.h index 87676d5db73..dc10ca43bb2 100644 --- a/ReactCommon/react/renderer/runtimescheduler/Task.h +++ b/ReactCommon/react/renderer/runtimescheduler/Task.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -29,7 +29,7 @@ struct Task final { friend TaskPriorityComparer; SchedulerPriority priority; - better::optional callback; + butter::optional callback; RuntimeSchedulerClock::time_point expirationTime; jsi::Value execute(jsi::Runtime &runtime); diff --git a/ReactCommon/react/renderer/scheduler/Scheduler.cpp b/ReactCommon/react/renderer/scheduler/Scheduler.cpp index 17e512a4f49..0401dda14a1 100644 --- a/ReactCommon/react/renderer/scheduler/Scheduler.cpp +++ b/ReactCommon/react/renderer/scheduler/Scheduler.cpp @@ -43,7 +43,7 @@ Scheduler::Scheduler( // Creating a container for future `EventDispatcher` instance. eventDispatcher_ = - std::make_shared>(); + std::make_shared>(); auto uiManager = std::make_shared( runtimeExecutor_, schedulerToolbox.backgroundExecutor, contextContainer_); diff --git a/ReactCommon/react/renderer/scheduler/Scheduler.h b/ReactCommon/react/renderer/scheduler/Scheduler.h index 10da71f1252..58449d7e8e4 100644 --- a/ReactCommon/react/renderer/scheduler/Scheduler.h +++ b/ReactCommon/react/renderer/scheduler/Scheduler.h @@ -125,7 +125,7 @@ class Scheduler final : public UIManagerDelegate { * parts that need to have ownership (and only ownership) of that, and then * fill the optional. */ - std::shared_ptr> eventDispatcher_; + std::shared_ptr> eventDispatcher_; /** * Hold onto ContextContainer. See SchedulerToolbox. diff --git a/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp b/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp index 46e74cdc55c..7b3f3ecf7dc 100644 --- a/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp +++ b/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp @@ -29,12 +29,12 @@ SurfaceHandler::SurfaceHandler(SurfaceHandler &&other) noexcept { } SurfaceHandler &SurfaceHandler::operator=(SurfaceHandler &&other) noexcept { - std::unique_lock lock1(linkMutex_, std::defer_lock); - std::unique_lock lock2( + std::unique_lock lock1(linkMutex_, std::defer_lock); + std::unique_lock lock2( parametersMutex_, std::defer_lock); - std::unique_lock lock3( + std::unique_lock lock3( other.linkMutex_, std::defer_lock); - std::unique_lock lock4( + std::unique_lock lock4( other.parametersMutex_, std::defer_lock); std::lock(lock1, lock2, lock3, lock4); @@ -55,13 +55,13 @@ void SurfaceHandler::setContextContainer( } Status SurfaceHandler::getStatus() const noexcept { - std::shared_lock lock(linkMutex_); + std::shared_lock lock(linkMutex_); return link_.status; } void SurfaceHandler::start() const noexcept { SystraceSection s("SurfaceHandler::start"); - std::unique_lock lock(linkMutex_); + std::unique_lock lock(linkMutex_); react_native_assert( link_.status == Status::Registered && "Surface must be registered."); react_native_assert( @@ -73,7 +73,7 @@ void SurfaceHandler::start() const noexcept { auto parameters = Parameters{}; { SystraceSection s2("SurfaceHandler::start::paramsLock"); - std::shared_lock parametersLock(parametersMutex_); + std::shared_lock parametersLock(parametersMutex_); parameters = parameters_; } @@ -100,7 +100,7 @@ void SurfaceHandler::start() const noexcept { void SurfaceHandler::stop() const noexcept { auto shadowTree = ShadowTree::Unique{}; { - std::unique_lock lock(linkMutex_); + std::unique_lock lock(linkMutex_); react_native_assert( link_.status == Status::Running && "Surface must be running."); @@ -118,7 +118,7 @@ void SurfaceHandler::stop() const noexcept { void SurfaceHandler::setDisplayMode(DisplayMode displayMode) const noexcept { { - std::unique_lock lock(parametersMutex_); + std::unique_lock lock(parametersMutex_); if (parameters_.displayMode == displayMode) { return; } @@ -127,7 +127,7 @@ void SurfaceHandler::setDisplayMode(DisplayMode displayMode) const noexcept { } { - std::shared_lock lock(linkMutex_); + std::shared_lock lock(linkMutex_); if (link_.status != Status::Running) { return; @@ -144,41 +144,41 @@ void SurfaceHandler::setDisplayMode(DisplayMode displayMode) const noexcept { } DisplayMode SurfaceHandler::getDisplayMode() const noexcept { - std::shared_lock lock(parametersMutex_); + std::shared_lock lock(parametersMutex_); return parameters_.displayMode; } #pragma mark - Accessors SurfaceId SurfaceHandler::getSurfaceId() const noexcept { - std::shared_lock lock(parametersMutex_); + std::shared_lock lock(parametersMutex_); return parameters_.surfaceId; } void SurfaceHandler::setSurfaceId(SurfaceId surfaceId) const noexcept { - std::unique_lock lock(parametersMutex_); + std::unique_lock lock(parametersMutex_); parameters_.surfaceId = surfaceId; } std::string SurfaceHandler::getModuleName() const noexcept { - std::shared_lock lock(parametersMutex_); + std::shared_lock lock(parametersMutex_); return parameters_.moduleName; } void SurfaceHandler::setProps(folly::dynamic const &props) const noexcept { SystraceSection s("SurfaceHandler::setProps"); - std::unique_lock lock(parametersMutex_); + std::unique_lock lock(parametersMutex_); parameters_.props = props; } folly::dynamic SurfaceHandler::getProps() const noexcept { - std::shared_lock lock(parametersMutex_); + std::shared_lock lock(parametersMutex_); return parameters_.props; } std::shared_ptr SurfaceHandler::getMountingCoordinator() const noexcept { - std::shared_lock lock(linkMutex_); + std::shared_lock lock(linkMutex_); react_native_assert( link_.status != Status::Unregistered && "Surface must be registered."); react_native_assert( @@ -191,7 +191,7 @@ SurfaceHandler::getMountingCoordinator() const noexcept { Size SurfaceHandler::measure( LayoutConstraints const &layoutConstraints, LayoutContext const &layoutContext) const noexcept { - std::shared_lock lock(linkMutex_); + std::shared_lock lock(linkMutex_); if (link_.status != Status::Running) { return layoutConstraints.clamp({0, 0}); @@ -217,7 +217,7 @@ void SurfaceHandler::constraintLayout( LayoutContext const &layoutContext) const noexcept { SystraceSection s("SurfaceHandler::constraintLayout"); { - std::unique_lock lock(parametersMutex_); + std::unique_lock lock(parametersMutex_); if (parameters_.layoutConstraints == layoutConstraints && parameters_.layoutContext == layoutContext) { @@ -229,7 +229,7 @@ void SurfaceHandler::constraintLayout( } { - std::shared_lock lock(linkMutex_); + std::shared_lock lock(linkMutex_); if (link_.status != Status::Running) { return; @@ -248,12 +248,12 @@ void SurfaceHandler::constraintLayout( } LayoutConstraints SurfaceHandler::getLayoutConstraints() const noexcept { - std::shared_lock lock(parametersMutex_); + std::shared_lock lock(parametersMutex_); return parameters_.layoutConstraints; } LayoutContext SurfaceHandler::getLayoutContext() const noexcept { - std::shared_lock lock(parametersMutex_); + std::shared_lock lock(parametersMutex_); return parameters_.layoutContext; } @@ -292,7 +292,7 @@ void SurfaceHandler::applyDisplayMode(DisplayMode displayMode) const noexcept { } void SurfaceHandler::setUIManager(UIManager const *uiManager) const noexcept { - std::unique_lock lock(linkMutex_); + std::unique_lock lock(linkMutex_); react_native_assert( link_.status != Status::Running && "Surface must not be running."); diff --git a/ReactCommon/react/renderer/scheduler/SurfaceHandler.h b/ReactCommon/react/renderer/scheduler/SurfaceHandler.h index c0ae0e60bdc..b002a91b427 100644 --- a/ReactCommon/react/renderer/scheduler/SurfaceHandler.h +++ b/ReactCommon/react/renderer/scheduler/SurfaceHandler.h @@ -195,13 +195,13 @@ class SurfaceHandler { /* * `link_` and `linkMutex_` pair. */ - mutable better::shared_mutex linkMutex_; + mutable butter::shared_mutex linkMutex_; mutable Link link_; /* * `parameters_` and `parametersMutex_` pair. */ - mutable better::shared_mutex parametersMutex_; + mutable butter::shared_mutex parametersMutex_; mutable Parameters parameters_; }; diff --git a/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp b/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp index ca07963576a..1cd65c37699 100644 --- a/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp +++ b/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp @@ -22,7 +22,7 @@ void SurfaceManager::startSurface( LayoutConstraints const &layoutConstraints, LayoutContext const &layoutContext) const noexcept { { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); auto surfaceHandler = SurfaceHandler{moduleName, surfaceId}; surfaceHandler.setContextContainer(scheduler_.getContextContainer()); registry_.emplace(surfaceId, std::move(surfaceHandler)); @@ -45,7 +45,7 @@ void SurfaceManager::stopSurface(SurfaceId surfaceId) const noexcept { }); { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); auto iterator = registry_.find(surfaceId); registry_.erase(iterator); @@ -89,7 +89,7 @@ void SurfaceManager::visit( SurfaceId surfaceId, std::function const &callback) const noexcept { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); auto iterator = registry_.find(surfaceId); diff --git a/ReactCommon/react/renderer/scheduler/SurfaceManager.h b/ReactCommon/react/renderer/scheduler/SurfaceManager.h index 8aeb6799ef6..e3b4fca8a0d 100644 --- a/ReactCommon/react/renderer/scheduler/SurfaceManager.h +++ b/ReactCommon/react/renderer/scheduler/SurfaceManager.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -59,8 +59,8 @@ class SurfaceManager final { const noexcept; Scheduler const &scheduler_; - mutable better::shared_mutex mutex_; // Protects `registry_`. - mutable better::map registry_{}; + mutable butter::shared_mutex mutex_; // Protects `registry_`. + mutable butter::map registry_{}; }; } // namespace react diff --git a/ReactCommon/react/renderer/telemetry/Android.mk b/ReactCommon/react/renderer/telemetry/Android.mk index 1fc54803d70..dea2a9db333 100644 --- a/ReactCommon/react/renderer/telemetry/Android.mk +++ b/ReactCommon/react/renderer/telemetry/Android.mk @@ -23,7 +23,7 @@ LOCAL_STATIC_LIBRARIES := LOCAL_SHARED_LIBRARIES := \ glog \ - libbetter \ + libbutter \ libfolly_futures \ libfolly_json \ libglog_init \ @@ -37,7 +37,7 @@ LOCAL_SHARED_LIBRARIES := \ include $(BUILD_SHARED_LIBRARY) -$(call import-module,better) +$(call import-module,butter) $(call import-module,glog) $(call import-module,folly) $(call import-module,react/utils) diff --git a/ReactCommon/react/renderer/telemetry/BUCK b/ReactCommon/react/renderer/telemetry/BUCK index d6b46e35dec..efcd05cadd9 100644 --- a/ReactCommon/react/renderer/telemetry/BUCK +++ b/ReactCommon/react/renderer/telemetry/BUCK @@ -50,7 +50,7 @@ rn_xplat_cxx_library( "//xplat/folly:headers_only", "//xplat/folly:memory", "//xplat/folly:molly", - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), react_native_xplat_target("react/debug:debug"), react_native_xplat_target("react/utils:utils"), ], diff --git a/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.h b/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.h index 6a726361200..ed026697120 100644 --- a/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.h +++ b/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -60,7 +60,7 @@ class SurfaceTelemetry final { int numberOfTextMeasurements_{}; int lastRevisionNumber_{}; - better:: + butter:: small_vector recentTransactionTelemetries_{}; }; diff --git a/ReactCommon/react/renderer/timeline/Timeline.h b/ReactCommon/react/renderer/timeline/Timeline.h index 8eaaf226776..49a7b14057f 100644 --- a/ReactCommon/react/renderer/timeline/Timeline.h +++ b/ReactCommon/react/renderer/timeline/Timeline.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/ReactCommon/react/renderer/timeline/TimelineController.cpp b/ReactCommon/react/renderer/timeline/TimelineController.cpp index 153650ae092..e58a2d45cd1 100644 --- a/ReactCommon/react/renderer/timeline/TimelineController.cpp +++ b/ReactCommon/react/renderer/timeline/TimelineController.cpp @@ -25,7 +25,7 @@ TimelineHandler TimelineController::enable(SurfaceId surfaceId) const { assert(shadowTreePtr); { - std::unique_lock lock(timelinesMutex_); + std::unique_lock lock(timelinesMutex_); auto timeline = std::make_unique(*shadowTreePtr); auto handler = TimelineHandler{*timeline}; @@ -35,7 +35,7 @@ TimelineHandler TimelineController::enable(SurfaceId surfaceId) const { } void TimelineController::disable(TimelineHandler &&handler) const { - std::unique_lock lock(timelinesMutex_); + std::unique_lock lock(timelinesMutex_); auto iterator = timelines_.find(handler.getSurfaceId()); assert(iterator != timelines_.end()); @@ -57,7 +57,7 @@ RootShadowNode::Unshared TimelineController::shadowTreeWillCommit( ShadowTree const &shadowTree, RootShadowNode::Shared const &oldRootShadowNode, RootShadowNode::Unshared const &newRootShadowNode) const noexcept { - std::shared_lock lock(timelinesMutex_); + std::shared_lock lock(timelinesMutex_); assert(uiManager_ && "`uiManager_` must not be `nullptr`."); diff --git a/ReactCommon/react/renderer/timeline/TimelineController.h b/ReactCommon/react/renderer/timeline/TimelineController.h index 0cfed408e7c..ea2d65f3ac7 100644 --- a/ReactCommon/react/renderer/timeline/TimelineController.h +++ b/ReactCommon/react/renderer/timeline/TimelineController.h @@ -9,7 +9,7 @@ #include -#include +#include #include #include @@ -65,12 +65,12 @@ class TimelineController final : public UIManagerCommitHook { /* * Protects all the data members. */ - mutable better::shared_mutex timelinesMutex_; + mutable butter::shared_mutex timelinesMutex_; /* * Owning collection of all running `Timeline` instances. */ - mutable better::map> timelines_; + mutable butter::map> timelines_; mutable UIManager const *uiManager_; mutable SurfaceId lastUpdatedSurface_; diff --git a/ReactCommon/react/renderer/uimanager/UIManager.cpp b/ReactCommon/react/renderer/uimanager/UIManager.cpp index 4a279b05936..0628cd376a3 100644 --- a/ReactCommon/react/renderer/uimanager/UIManager.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManager.cpp @@ -376,7 +376,7 @@ ShadowTreeRegistry const &UIManager::getShadowTreeRegistry() const { void UIManager::registerCommitHook( UIManagerCommitHook const &commitHook) const { - std::unique_lock lock(commitHookMutex_); + std::unique_lock lock(commitHookMutex_); react_native_assert( std::find(commitHooks_.begin(), commitHooks_.end(), &commitHook) == commitHooks_.end()); @@ -386,7 +386,7 @@ void UIManager::registerCommitHook( void UIManager::unregisterCommitHook( UIManagerCommitHook const &commitHook) const { - std::unique_lock lock(commitHookMutex_); + std::unique_lock lock(commitHookMutex_); auto iterator = std::find(commitHooks_.begin(), commitHooks_.end(), &commitHook); react_native_assert(iterator != commitHooks_.end()); @@ -400,7 +400,7 @@ RootShadowNode::Unshared UIManager::shadowTreeWillCommit( ShadowTree const &shadowTree, RootShadowNode::Shared const &oldRootShadowNode, RootShadowNode::Unshared const &newRootShadowNode) const { - std::shared_lock lock(commitHookMutex_); + std::shared_lock lock(commitHookMutex_); auto resultRootShadowNode = newRootShadowNode; for (auto const *commitHook : commitHooks_) { diff --git a/ReactCommon/react/renderer/uimanager/UIManager.h b/ReactCommon/react/renderer/uimanager/UIManager.h index 8787d44896f..a83aa516a3c 100644 --- a/ReactCommon/react/renderer/uimanager/UIManager.h +++ b/ReactCommon/react/renderer/uimanager/UIManager.h @@ -194,7 +194,7 @@ class UIManager final : public ShadowTreeDelegate { BackgroundExecutor const backgroundExecutor_{}; ContextContainer::Shared contextContainer_; - mutable better::shared_mutex commitHookMutex_; + mutable butter::shared_mutex commitHookMutex_; mutable std::vector commitHooks_; std::unique_ptr leakChecker_; diff --git a/ReactCommon/react/test_utils/BUCK b/ReactCommon/react/test_utils/BUCK index 55a8cac9d0f..1b467742a75 100644 --- a/ReactCommon/react/test_utils/BUCK +++ b/ReactCommon/react/test_utils/BUCK @@ -42,7 +42,7 @@ rn_xplat_cxx_library( visibility = ["PUBLIC"], deps = [ "//xplat/jsi:jsi", - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), react_native_xplat_target("react/debug:debug"), ], exported_deps = [ diff --git a/ReactCommon/react/utils/BUCK b/ReactCommon/react/utils/BUCK index 6525d5b9b5d..99a0f1eff0b 100644 --- a/ReactCommon/react/utils/BUCK +++ b/ReactCommon/react/utils/BUCK @@ -58,7 +58,7 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", "//xplat/jsi:jsi", - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), react_native_xplat_target("react/debug:debug"), ], ) diff --git a/ReactCommon/react/utils/ContextContainer.h b/ReactCommon/react/utils/ContextContainer.h index 1431fe1af83..85809ed3e41 100644 --- a/ReactCommon/react/utils/ContextContainer.h +++ b/ReactCommon/react/utils/ContextContainer.h @@ -11,9 +11,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -42,7 +42,7 @@ class ContextContainer final { */ template void insert(std::string const &key, T const &instance) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); instances_.insert({key, std::make_shared(instance)}); } @@ -52,7 +52,7 @@ class ContextContainer final { * Does nothing if the instance was not found. */ void erase(std::string const &key) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); instances_.erase(key); } @@ -63,7 +63,7 @@ class ContextContainer final { * values from the given container. */ void update(ContextContainer const &contextContainer) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); for (auto const &pair : contextContainer.instances_) { instances_.erase(pair.first); @@ -78,7 +78,7 @@ class ContextContainer final { */ template T at(std::string const &key) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); react_native_assert( instances_.find(key) != instances_.end() && @@ -92,8 +92,8 @@ class ContextContainer final { * Returns an empty optional if the instance could not be found. */ template - better::optional find(std::string const &key) const { - std::shared_lock lock(mutex_); + butter::optional find(std::string const &key) const { + std::shared_lock lock(mutex_); auto iterator = instances_.find(key); if (iterator == instances_.end()) { @@ -104,9 +104,9 @@ class ContextContainer final { } private: - mutable better::shared_mutex mutex_; + mutable butter::shared_mutex mutex_; // Protected by mutex_`. - mutable better::map> instances_; + mutable butter::map> instances_; }; } // namespace react diff --git a/ReactCommon/react/utils/SharedFunction.h b/ReactCommon/react/utils/SharedFunction.h index 180f284d94a..c79e0892ef8 100644 --- a/ReactCommon/react/utils/SharedFunction.h +++ b/ReactCommon/react/utils/SharedFunction.h @@ -9,7 +9,7 @@ #include #include -#include +#include namespace facebook { namespace react { @@ -31,7 +31,7 @@ class SharedFunction { struct Pair { Pair(std::function &&function) : function(std::move(function)) {} std::function function; - better::shared_mutex mutex{}; + butter::shared_mutex mutex{}; }; public: @@ -45,12 +45,12 @@ class SharedFunction { SharedFunction &operator=(SharedFunction &&other) noexcept = default; void assign(std::function function) const { - std::unique_lock lock(pair_->mutex); + std::unique_lock lock(pair_->mutex); pair_->function = function; } ReturnT operator()(ArgumentT... args) const { - std::shared_lock lock(pair_->mutex); + std::shared_lock lock(pair_->mutex); return pair_->function(args...); } diff --git a/ReactCommon/react/utils/SimpleThreadSafeCache.h b/ReactCommon/react/utils/SimpleThreadSafeCache.h index 56b038931d1..94b6c842535 100644 --- a/ReactCommon/react/utils/SimpleThreadSafeCache.h +++ b/ReactCommon/react/utils/SimpleThreadSafeCache.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include namespace facebook { @@ -48,7 +48,7 @@ class SimpleThreadSafeCache { * If the value wasn't found in the cache, returns empty optional. * Can be called from any thread. */ - better::optional get(const KeyT &key) const { + butter::optional get(const KeyT &key) const { std::lock_guard lock(mutex_); auto iterator = map_.find(key); if (iterator == map_.end()) { diff --git a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsH-test.js.snap b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsH-test.js.snap index bdc5a1aba8a..5503e890f35 100644 --- a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsH-test.js.snap +++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsH-test.js.snap @@ -84,7 +84,7 @@ struct ArrayPropsNativeComponentViewObjectStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentViewObjectStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_prop = map.find(\\"prop\\"); if (tmp_prop != map.end()) { @@ -687,7 +687,7 @@ struct ObjectPropsNativeComponentObjectPropStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectPropStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_stringProp = map.find(\\"stringProp\\"); if (tmp_stringProp != map.end()) { @@ -724,7 +724,7 @@ struct ObjectPropsNativeComponentObjectArrayPropStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectArrayPropStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_array = map.find(\\"array\\"); if (tmp_array != map.end()) { @@ -743,7 +743,7 @@ struct ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_image = map.find(\\"image\\"); if (tmp_image != map.end()) { diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js index 6fd7cd35bf2..e6a282b5df5 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js @@ -157,7 +157,7 @@ const StructTemplate = ({ }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ${structName} &result) { - auto map = (better::map)value; + auto map = (butter::map)value; ${fromCases} } diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap index 426c0169690..172ee6b12c7 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap @@ -84,7 +84,7 @@ struct ArrayPropsNativeComponentObjectStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentObjectStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_stringProp = map.find(\\"stringProp\\"); if (tmp_stringProp != map.end()) { @@ -111,7 +111,7 @@ struct ArrayPropsNativeComponentArrayObjectStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentArrayObjectStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_stringProp = map.find(\\"stringProp\\"); if (tmp_stringProp != map.end()) { @@ -138,7 +138,7 @@ struct ArrayPropsNativeComponentArrayStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentArrayStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_object = map.find(\\"object\\"); if (tmp_object != map.end()) { @@ -165,7 +165,7 @@ struct ArrayPropsNativeComponentArrayOfArrayOfObjectStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentArrayOfArrayOfObjectStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_stringProp = map.find(\\"stringProp\\"); if (tmp_stringProp != map.end()) { @@ -247,7 +247,7 @@ struct ArrayPropsNativeComponentNativePrimitivesStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentNativePrimitivesStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_colors = map.find(\\"colors\\"); if (tmp_colors != map.end()) { @@ -1022,7 +1022,7 @@ struct ObjectPropsObjectPropObjectArrayPropStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropObjectArrayPropStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_array = map.find(\\"array\\"); if (tmp_array != map.end()) { @@ -1041,7 +1041,7 @@ struct ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_image = map.find(\\"image\\"); if (tmp_image != map.end()) { @@ -1066,7 +1066,7 @@ struct ObjectPropsObjectPropNestedPropANestedPropBStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedPropANestedPropBStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_nestedPropC = map.find(\\"nestedPropC\\"); if (tmp_nestedPropC != map.end()) { @@ -1083,7 +1083,7 @@ struct ObjectPropsObjectPropNestedPropAStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedPropAStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_nestedPropB = map.find(\\"nestedPropB\\"); if (tmp_nestedPropB != map.end()) { @@ -1100,7 +1100,7 @@ struct ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_stringProp = map.find(\\"stringProp\\"); if (tmp_stringProp != map.end()) { @@ -1127,7 +1127,7 @@ struct ObjectPropsObjectPropNestedArrayAsPropertyStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedArrayAsPropertyStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_arrayProp = map.find(\\"arrayProp\\"); if (tmp_arrayProp != map.end()) { @@ -1153,7 +1153,7 @@ struct ObjectPropsObjectPropStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto tmp_stringProp = map.find(\\"stringProp\\"); if (tmp_stringProp != map.end()) { diff --git a/packages/rn-tester/Podfile.lock b/packages/rn-tester/Podfile.lock index 48e63ed7700..153cdcbcdf5 100644 --- a/packages/rn-tester/Podfile.lock +++ b/packages/rn-tester/Podfile.lock @@ -282,7 +282,7 @@ PODS: - RCTTypeSafety (= 1000.0.0) - React-Fabric/animations (= 1000.0.0) - React-Fabric/attributedstring (= 1000.0.0) - - React-Fabric/better (= 1000.0.0) + - React-Fabric/butter (= 1000.0.0) - React-Fabric/componentregistry (= 1000.0.0) - React-Fabric/componentregistrynative (= 1000.0.0) - React-Fabric/components (= 1000.0.0) @@ -320,7 +320,7 @@ PODS: - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - ReactCommon/turbomodule/core (= 1000.0.0) - - React-Fabric/better (1000.0.0): + - React-Fabric/butter (1000.0.0): - RCT-Folly/Fabric (= 2021.06.28.00-v2) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) @@ -881,7 +881,7 @@ SPEC CHECKSUMS: CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 FBLazyVector: b81a2b70c72d8b0aefb652cea22c11e9ffd02949 - FBReactNativeSpec: a9c75a44813c347e748342bc4ce0789e162d22e6 + FBReactNativeSpec: 3f88f49873cc4123da7877f1b183e7776bbc4fa9 Flipper: 30e8eeeed6abdc98edaf32af0cda2f198be4b733 Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c Flipper-DoubleConversion: 57ffbe81ef95306cc9e69c4aa3aeeeeb58a6a28c @@ -901,10 +901,10 @@ SPEC CHECKSUMS: React: f64c9f6db5428717922a3292ba6a448615a2e143 React-callinvoker: c5d61e29df57793f0dc10ec2bc01c846f863e51f React-Codegen: 2256e335ccce7326eeca6d7a668e05c4de259289 - React-Core: 2753750098f0ad7e351a61c2e63d44ae0e95c3fe + React-Core: 30784d0eacbd709a3a6a5ae7c02c928634a6247e React-CoreModules: a8e2bdc1ebbf8d440478456197abd58d1691f61a React-cxxreact: cfc1663dae1ea52b465bbf021ef7b1527c5dc80c - React-Fabric: 002345cff43721617e0a3c0866f6f76bae8c50ff + React-Fabric: 30b8fa96a0c56d1c11348f77607464eb87bb3f9f React-graphics: 9a84942b49ea1375ce83844041fa2ba766cfe0b9 React-jsi: c1c0108d86e1378aabf7c9146ed7d12d87c7df85 React-jsiexecutor: d08ec14edc8f2e19af51550cd1505332eae35c7b @@ -923,10 +923,10 @@ SPEC CHECKSUMS: React-RCTTest: 12bbd7fc2e72bd9920dc7286c5b8ef96639582b6 React-RCTText: e9146b2c0550a83d1335bfe2553760070a2d75c7 React-RCTVibration: 50be9c390f2da76045ef0dfdefa18b9cf9f35cfa - React-rncore: 419b6945917d7eb76b304b76acbb49f79fb7e7e0 + React-rncore: c76a90ccef0be9fc0f6dab7c16d9194ec6b54e13 React-runtimeexecutor: 4b0c6eb341c7d3ceb5e2385cb0fdb9bf701024f3 ReactCommon: 7a2714d1128f965392b6f99a8b390e3aa38c9569 - ScreenshotManager: 025a85e18687aff80bca262c3a7065ff54e636ae + ScreenshotManager: bae0da23de347c4527710cca486f6b156902512b Yoga: c0d06f5380d34e939f55420669a60fe08b79bd75 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a