mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
C++ - better => butter
Summary: Renaming the `better` utilities to `butter`: - to prevent claims that this library is superior to others - it really depends on use cases - to indicate ease of use throughout the codebase, easily spread like butter Changelog: [C++][Changed] Renaming C++ better util to butter, used by Fabric internals Reviewed By: JoshuaGross Differential Revision: D33242764 fbshipit-source-id: 26dc95d9597c61ce8e66708e44ed545e0fc5cff5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b4dab1a537
commit
fb39d45ed5
@@ -12,7 +12,7 @@ LOCAL_MODULE := fabricjni
|
||||
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libbetter \
|
||||
libbutter \
|
||||
libfb \
|
||||
libfbjni \
|
||||
libfolly_futures \
|
||||
|
||||
@@ -46,7 +46,7 @@ jni::local_ref<Binding::jhybriddata> Binding::initHybrid(
|
||||
|
||||
// Thread-safe getter
|
||||
std::shared_ptr<Scheduler> Binding::getScheduler() {
|
||||
std::shared_lock<better::shared_mutex> lock(installMutex_);
|
||||
std::shared_lock<butter::shared_mutex> lock(installMutex_);
|
||||
return scheduler_;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ void Binding::startSurface(
|
||||
|
||||
{
|
||||
SystraceSection s2("FabricUIManagerBinding::startSurface::surfaceId::lock");
|
||||
std::unique_lock<better::shared_mutex> lock(surfaceHandlerRegistryMutex_);
|
||||
std::unique_lock<butter::shared_mutex> 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<better::shared_mutex> lock(surfaceHandlerRegistryMutex_);
|
||||
std::unique_lock<butter::shared_mutex> 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<better::shared_mutex> lock(surfaceHandlerRegistryMutex_);
|
||||
std::unique_lock<butter::shared_mutex> lock(surfaceHandlerRegistryMutex_);
|
||||
|
||||
auto iterator = surfaceHandlerRegistry_.find(surfaceId);
|
||||
|
||||
@@ -289,7 +289,7 @@ void Binding::setConstraints(
|
||||
isRTL ? LayoutDirection::RightToLeft : LayoutDirection::LeftToRight;
|
||||
|
||||
{
|
||||
std::shared_lock<better::shared_mutex> lock(surfaceHandlerRegistryMutex_);
|
||||
std::shared_lock<butter::shared_mutex> 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<better::shared_mutex> lock(installMutex_);
|
||||
std::unique_lock<butter::shared_mutex> lock(installMutex_);
|
||||
|
||||
auto globalJavaUiManager = make_global(javaUIManager);
|
||||
mountingManager_ =
|
||||
@@ -434,7 +434,7 @@ void Binding::uninstallFabricUIManager() {
|
||||
<< this << ").";
|
||||
}
|
||||
|
||||
std::unique_lock<better::shared_mutex> lock(installMutex_);
|
||||
std::unique_lock<butter::shared_mutex> lock(installMutex_);
|
||||
animationDriver_ = nullptr;
|
||||
scheduler_ = nullptr;
|
||||
mountingManager_ = nullptr;
|
||||
@@ -443,7 +443,7 @@ void Binding::uninstallFabricUIManager() {
|
||||
|
||||
std::shared_ptr<FabricMountingManager> Binding::verifyMountingManager(
|
||||
std::string const &hint) {
|
||||
std::shared_lock<better::shared_mutex> lock(installMutex_);
|
||||
std::shared_lock<butter::shared_mutex> lock(installMutex_);
|
||||
if (!mountingManager_) {
|
||||
LOG(ERROR) << hint << " mounting manager disappeared.";
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class Binding : public jni::HybridClass<Binding>,
|
||||
void uninstallFabricUIManager();
|
||||
|
||||
// Private member variables
|
||||
better::shared_mutex installMutex_;
|
||||
butter::shared_mutex installMutex_;
|
||||
std::shared_ptr<FabricMountingManager> mountingManager_;
|
||||
std::shared_ptr<Scheduler> scheduler_;
|
||||
|
||||
@@ -145,8 +145,8 @@ class Binding : public jni::HybridClass<Binding>,
|
||||
|
||||
std::unique_ptr<JBackgroundExecutor> backgroundExecutor_;
|
||||
|
||||
better::map<SurfaceId, SurfaceHandler> surfaceHandlerRegistry_{};
|
||||
better::shared_mutex
|
||||
butter::map<SurfaceId, SurfaceHandler> surfaceHandlerRegistry_{};
|
||||
butter::shared_mutex
|
||||
surfaceHandlerRegistryMutex_; // Protects `surfaceHandlerRegistry_`.
|
||||
|
||||
float pointScaleFactor_ = 1;
|
||||
|
||||
@@ -21,7 +21,7 @@ void SurfaceHandlerBinding::setDisplayMode(jint mode) {
|
||||
}
|
||||
|
||||
void SurfaceHandlerBinding::start() {
|
||||
std::unique_lock<better::shared_mutex> lock(lifecycleMutex_);
|
||||
std::unique_lock<butter::shared_mutex> lock(lifecycleMutex_);
|
||||
|
||||
if (surfaceHandler_.getStatus() != SurfaceHandler::Status::Running) {
|
||||
surfaceHandler_.start();
|
||||
@@ -29,7 +29,7 @@ void SurfaceHandlerBinding::start() {
|
||||
}
|
||||
|
||||
void SurfaceHandlerBinding::stop() {
|
||||
std::unique_lock<better::shared_mutex> lock(lifecycleMutex_);
|
||||
std::unique_lock<butter::shared_mutex> lock(lifecycleMutex_);
|
||||
|
||||
if (surfaceHandler_.getStatus() == SurfaceHandler::Status::Running) {
|
||||
surfaceHandler_.stop();
|
||||
|
||||
@@ -50,7 +50,7 @@ class SurfaceHandlerBinding : public jni::HybridClass<SurfaceHandlerBinding> {
|
||||
SurfaceHandler const &getSurfaceHandler();
|
||||
|
||||
private:
|
||||
mutable better::shared_mutex lifecycleMutex_;
|
||||
mutable butter::shared_mutex lifecycleMutex_;
|
||||
const SurfaceHandler surfaceHandler_;
|
||||
|
||||
jni::alias_ref<SurfaceHandlerBinding::jhybriddata> jhybridobject_;
|
||||
|
||||
Reference in New Issue
Block a user