Summary:
Changelog: [internal]

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

I was looking at Folly containers and found we were using folly::function. According to the compiler, we don't need it. It should fail during build time if its properties were needed.
Documentation for folly function: https://github.com/facebook/folly/blob/main/folly/docs/Function.md

Reviewed By: christophpurrer

Differential Revision: D48519164

fbshipit-source-id: 88002ca3a1302db2a397fc7f5e3cae354669a9ff
This commit is contained in:
Samuel Susla 2023-08-22 06:35:14 -07:00 коммит произвёл Facebook GitHub Bot
Родитель ccaae31a13
Коммит 4d85e112a3
4 изменённых файлов: 9 добавлений и 65 удалений

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

@ -1,51 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <butter/butter.h>
#if ( \
defined(BUTTER_FUNCTION_OVERRIDE_INCLUDE) && \
defined(BUTTER_FUNCTION_OVERRIDE))
#include BUTTER_FUNCTION_OVERRIDE_INCLUDE
#elif defined(BUTTER_USE_FOLLY_CONTAINERS)
#include <folly/Function.h>
#else
#include <functional>
#endif
namespace facebook {
namespace butter {
#if ( \
defined(BUTTER_FUNCTION_OVERRIDE_INCLUDE) && \
defined(BUTTER_FUNCTION_OVERRIDE))
template <typename... Ts>
using function = BUTTER_FUNCTION_OVERRIDE<Ts...>;
#elif defined(BUTTER_USE_FOLLY_CONTAINERS)
template <typename... Ts>
using function = folly::Function<Ts...>;
#else
template <typename... Ts>
using function = std::function<Ts...>;
#endif
} // namespace butter
} // namespace facebook

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

@ -10,7 +10,6 @@
#include <react/bridging/Convert.h>
#include <ReactCommon/CallInvoker.h>
#include <butter/function.h>
#include <jsi/jsi.h>
#include <cstdint>
@ -36,12 +35,12 @@ struct function_wrapper;
template <typename C, typename R, typename... Args>
struct function_wrapper<R (C::*)(Args...)> {
using type = butter::function<R(Args...)>;
using type = std::function<R(Args...)>;
};
template <typename C, typename R, typename... Args>
struct function_wrapper<R (C::*)(Args...) const> {
using type = butter::function<R(Args...)>;
using type = std::function<R(Args...)>;
};
template <typename T, typename = void>

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

@ -12,8 +12,6 @@
#include <ReactCommon/SchedulerPriority.h>
#include <butter/function.h>
namespace facebook::react {
template <typename F>
@ -169,8 +167,8 @@ struct Bridging<SyncCallback<R(Args...)>> {
};
template <typename R, typename... Args>
struct Bridging<butter::function<R(Args...)>> {
using Func = butter::function<R(Args...)>;
struct Bridging<std::function<R(Args...)>> {
using Func = std::function<R(Args...)>;
using IndexSequence = std::index_sequence_for<Args...>;
static constexpr size_t kArgumentCount = sizeof...(Args);
@ -219,15 +217,14 @@ struct Bridging<butter::function<R(Args...)>> {
template <typename R, typename... Args>
struct Bridging<
std::function<R(Args...)>,
std::enable_if_t<!std::is_same_v<
std::function<R(Args...)>,
butter::function<R(Args...)>>>>
: Bridging<butter::function<R(Args...)>> {};
std::enable_if_t<
!std::is_same_v<std::function<R(Args...)>, std::function<R(Args...)>>>>
: Bridging<std::function<R(Args...)>> {};
template <typename R, typename... Args>
struct Bridging<R(Args...)> : Bridging<butter::function<R(Args...)>> {};
struct Bridging<R(Args...)> : Bridging<std::function<R(Args...)>> {};
template <typename R, typename... Args>
struct Bridging<R (*)(Args...)> : Bridging<butter::function<R(Args...)>> {};
struct Bridging<R (*)(Args...)> : Bridging<std::function<R(Args...)>> {};
} // namespace facebook::react

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

@ -16,7 +16,6 @@
#include <ReactCommon/TurboModule.h>
#include <ReactCommon/TurboModulePerfLogger.h>
#include <ReactCommon/TurboModuleUtils.h>
#include <butter/function.h>
#include <jsi/JSIDynamic.h>
#include <react/debug/react_native_assert.h>
#include <react/jni/NativeMap.h>