docstring_tokens
stringlengths 18
16.9k
| code_tokens
stringlengths 75
1.81M
| html_url
stringlengths 74
116
| file_name
stringlengths 3
311
|
---|---|---|---|
keep keep add keep keep keep keep keep keep
|
<mask> #pragma once
<mask>
<mask> #include <stdexcept>
<mask> #include <folly/Conv.h>
<mask> #include <folly/Likely.h>
<mask> #include <folly/Portability.h>
<mask> #include <folly/Range.h>
<mask> #include <folly/lang/Exception.h>
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> add #include <folly/lang/Exception.h> </s> remove #include <boost/iterator/iterator_facade.hpp>
</s> add #include <iterator>
#include <type_traits>
#include <utility>
</s> add #include <cassert> </s> remove #include <stdexcept>
#include <cstdlib>
#include <type_traits>
</s> add </s> remove #include <memory>
</s> add #include <functional> </s> remove #include <folly/SmallLocks.h>
#include <folly/portability/BitsFunctexcept.h>
#include <folly/portability/Constexpr.h>
</s> add #include <folly/Traits.h>
#include <folly/lang/Assume.h>
#include <folly/lang/Exception.h>
#include <folly/memory/Malloc.h>
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep add keep keep keep keep keep keep
|
<mask> #include <folly/Conv.h>
<mask> #include <folly/Likely.h>
<mask> #include <folly/Portability.h>
<mask> #include <folly/Range.h>
<mask>
<mask> namespace folly {
<mask>
<mask> class FOLLY_EXPORT BadFormatArg : public std::invalid_argument {
<mask> using invalid_argument::invalid_argument;
<mask> };
</s> [sdk33] Update iOS with RN 0.59 </s> remove class BadFormatArg : public std::invalid_argument {
public:
explicit BadFormatArg(const std::string& msg)
: std::invalid_argument(msg) {}
</s> add class FOLLY_EXPORT BadFormatArg : public std::invalid_argument {
using invalid_argument::invalid_argument; </s> add #include <folly/CPortability.h> </s> remove #include <type_traits>
#include <utility>
namespace folly {
enum class TLPDestructionMode {
THIS_THREAD,
ALL_THREADS
};
struct AccessModeStrict {};
} // namespace
</s> add </s> remove #include <folly/gen/String.h>
#include <folly/io/IOBufQueue.h>
</s> add </s> add #include <folly/gen/String.h>
#include <folly/io/IOBufQueue.h>
#include <folly/portability/SysResource.h> </s> remove #include <folly/detail/CacheLocality.h>
</s> add #include <folly/concurrency/CacheLocality.h>
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep keep replace replace replace replace keep keep keep keep keep
|
<mask> #include <folly/Range.h>
<mask>
<mask> namespace folly {
<mask>
<mask> class BadFormatArg : public std::invalid_argument {
<mask> public:
<mask> explicit BadFormatArg(const std::string& msg)
<mask> : std::invalid_argument(msg) {}
<mask> };
<mask>
<mask> /**
<mask> * Parsed format argument.
<mask> */
</s> [sdk33] Update iOS with RN 0.59 </s> add #include <folly/lang/Exception.h> </s> remove template <class Iterator = const char*,
class Base = folly::Range<boost::u8_to_u32_iterator<Iterator>>>
class UTF8Range : public Base {
public:
/* implicit */ UTF8Range(const folly::Range<Iterator> baseRange)
: Base(boost::u8_to_u32_iterator<Iterator>(
baseRange.begin(), baseRange.begin(), baseRange.end()),
boost::u8_to_u32_iterator<Iterator>(
baseRange.end(), baseRange.begin(), baseRange.end())) {}
/* implicit */ UTF8Range(const std::string& baseString)
: Base(folly::Range<Iterator>(baseString)) {}
};
using UTF8StringPiece = UTF8Range<const char*>;
</s> add inline void toLowerAscii(std::string& str) {
// str[0] is legal also if the string is empty.
toLowerAscii(&str[0], str.size());
} </s> remove class SubprocessError : public std::exception {};
</s> add class FOLLY_EXPORT SubprocessError : public std::runtime_error {
public:
using std::runtime_error::runtime_error;
}; </s> remove class CalledProcessError : public SubprocessError {
</s> add class FOLLY_EXPORT CalledProcessError : public SubprocessError { </s> remove explicit SharedProxy(Function<ReturnType(Args...)>&& func)
: sp_(std::make_shared<Function<ReturnType(Args...)>>(
std::move(func))) {}
</s> add explicit SharedProxy(Function<NonConstSignature>&& func)
: sp_(std::make_shared<Function<NonConstSignature>>(std::move(func))) {} </s> remove explicit SharedProxy(Function<ReturnType(Args...) const>&& func)
: sp_(std::make_shared<Function<ReturnType(Args...) const>>(
std::move(func))) {}
</s> add explicit SharedProxy(Function<NonConstSignature>&& func)
: sp_(std::make_shared<Function<NonConstSignature>>(std::move(func))) {}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask> * Parse a format argument from a string. Keeps a reference to the
<mask> * passed-in string -- does not copy the given characters.
<mask> */
<mask> explicit FormatArg(StringPiece sp)
<mask> : fullArgString(sp),
<mask> fill(kDefaultFill),
<mask> align(Align::DEFAULT),
<mask> sign(Sign::DEFAULT),
<mask> basePrefix(false),
<mask> thousandsSeparator(false),
<mask> trailingDot(false),
<mask> width(kDefaultWidth),
<mask> widthIndex(kNoIndex),
<mask> precision(kDefaultPrecision),
<mask> presentation(kDefaultPresentation),
<mask> nextKeyMode_(NextKeyMode::NONE) {
<mask> if (!sp.empty()) {
<mask> initSlow();
<mask> }
<mask> }
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> remove /*
* g++ doesn't allow you to bind a non-const reference to a member
* of a packed structure, presumably because it would make it too
* easy to accidentally make an unaligned memory access?
*/
template<class T> static T& unpackHack(T* p) {
return *p;
}
</s> add </s> remove inline
std::string&& toStdString(std::string&& s) {
</s> add inline std::string&& toStdString(std::string&& s) { </s> remove IsSomeString<OutputType>::value,
"split<false>() requires that the last argument be a string type");
</s> add IsSomeString<OutputType>::value ||
std::is_same<OutputType, decltype(std::ignore)>::value,
"split<false>() requires that the last argument be a string type "
"or std::ignore"); </s> remove // If the exception_wrapper does not contain an exception, std::terminate()
// is invoked to assure the [[noreturn]] behaviour.
[[noreturn]] void throwException() const {
if (throwfn_) {
throwfn_(item_.get());
} else if (eptr_) {
std::rethrow_exception(eptr_);
}
std::cerr
<< "Cannot use `throwException` with an empty folly::exception_wrapper"
<< std::endl;
std::terminate();
}
explicit operator bool() const {
return item_ || eptr_;
}
</s> add template <bool If, class T>
using AddConstIf = _t<std::conditional<If, const T, T>>; </s> remove * Returns a subpiece with all whitespace removed from the back and front of @sp.
* Whitespace means any of [' ', '\n', '\r', '\t'].
</s> add * Returns a subpiece with all whitespace removed from the back and front of
* @sp. Whitespace means any of [' ', '\n', '\r', '\t']. </s> remove lock_ = std::move(rhs.lock_);
parent_ = rhs.parent_;
rhs.parent_ = nullptr;
</s> add assignImpl(*this, rhs);
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask>
<mask> enum class Type {
<mask> INTEGER,
<mask> FLOAT,
<mask> OTHER
<mask> };
<mask> /**
<mask> * Validate the argument for the given type; throws on error.
<mask> */
<mask> void validate(Type type) const;
</s> [sdk33] Update iOS with RN 0.59 </s> remove throwSystemErrorExplicit(-ret, std::forward<Args>(args)...);
</s> add throwSystemErrorExplicit(int(-ret), std::forward<Args>(args)...); </s> remove }
</s> add } // namespace detail </s> remove /*
* Now inherit from them all. This is done in such a convoluted
* way to make sure we get the empty base optimizaton on all these
* types to keep sizeof(small_vector<>) minimal.
*/
typedef boost::totally_ordered1<
small_vector<Value,RequestedMaxInline,InPolicyA,InPolicyB,InPolicyC>,
ActualSizePolicy
> type;
};
</s> add /*
* Now inherit from them all. This is done in such a convoluted
* way to make sure we get the empty base optimizaton on all these
* types to keep sizeof(small_vector<>) minimal.
*/
typedef boost::totally_ordered1<
small_vector<Value, RequestedMaxInline, InPolicyA, InPolicyB, InPolicyC>,
ActualSizePolicy>
type;
}; </s> remove template <class T, class Enable = void>
struct IsSomeVector {
enum { value = false };
};
template <class T>
struct IsSomeVector<std::vector<T>, void> {
enum { value = true };
};
template <class T>
struct IsSomeVector<fbvector<T>, void> {
enum { value = true };
};
template <class T, class Enable = void>
struct IsConvertible {
enum { value = false };
};
template <class T>
struct IsConvertible<
T,
decltype(static_cast<void>(
parseTo(std::declval<folly::StringPiece>(), std::declval<T&>())))> {
enum { value = true };
};
template <class... Types>
struct AllConvertible;
template <class Head, class... Tail>
struct AllConvertible<Head, Tail...> {
enum { value = IsConvertible<Head>::value && AllConvertible<Tail...>::value };
};
</s> add namespace detail {
template <typename Void, typename OutputType>
struct IsConvertible : std::false_type {}; </s> remove enum class Op { MOVE, NUKE, FULL, HEAP };
</s> add enum class Op { MOVE, NUKE, HEAP }; </s> add /**
* Assign another datum and return the original value. Recommended
* because it keeps the mutex held only briefly.
*/
T exchange(T&& rhs) {
swap(rhs);
return std::move(rhs);
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> LEFT,
<mask> RIGHT,
<mask> PAD_AFTER_SIGN,
<mask> CENTER,
<mask> INVALID
<mask> };
<mask> Align align;
<mask>
<mask> /**
<mask> * Sign
</s> [sdk33] Update iOS with RN 0.59 </s> remove INVALID
</s> add INVALID, </s> remove std::string what_;
</s> add </s> remove class SubprocessError : public std::exception {};
</s> add class FOLLY_EXPORT SubprocessError : public std::runtime_error {
public:
using std::runtime_error::runtime_error;
}; </s> remove FOLLY_ALIGN_TO_AVOID_FALSE_SHARING std::atomic<double> zeroTime_;
</s> add alignas(hardware_destructive_interference_size) std::atomic<double> zeroTime_; </s> remove T * ptr, TLPDestructionMode) {
delegate(ptr);
};
</s> add T* ptr, TLPDestructionMode) { delegate(ptr); }; </s> remove parent_to_pass_on);
</s> add exchange(this->parent_, nullptr));
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> DEFAULT,
<mask> PLUS_OR_MINUS,
<mask> MINUS,
<mask> SPACE_OR_MINUS,
<mask> INVALID
<mask> };
<mask> Sign sign;
<mask>
<mask> /**
<mask> * Output base prefix (0 for octal, 0x for hex)
</s> [sdk33] Update iOS with RN 0.59 </s> remove INVALID
</s> add INVALID, </s> remove OTHER
</s> add OTHER, </s> remove /**
* Access the locked data.
*/
CDataType& operator*() const {
return parent_->datum_;
}
</s> add /**
* Acquire locks for multiple Synchronized<> objects, in a deadlock-safe
* manner.
*
* Wrap the synchronized instances with the appropriate locking strategy by
* using one of the four strategies - folly::lock (exclusive acquire for
* exclusive only mutexes), folly::rlock (shared acquire for shareable
* mutexes), folly::wlock (exclusive acquire for shareable mutexes) or
* folly::ulock (upgrade acquire for upgrade mutexes) (see above)
*
* The locks will be acquired and the passed callable will be invoked with the
* LockedPtr instances in the order that they were passed to the function
*/
template <typename Func, typename... SynchronizedLockers>
decltype(auto) synchronized(Func&& func, SynchronizedLockers&&... lockers) {
return apply(
std::forward<Func>(func),
lock(std::forward<SynchronizedLockers>(lockers)...));
} </s> remove private:
// This is the entire state of LockedGuardPtr.
SynchronizedType* const parent_{nullptr};
};
</s> add /**
* Acquire locks on many lockables or synchronized instances in such a way
* that the sequence of calls within the function does not cause deadlocks.
*
* This can often result in a performance boost as compared to simply
* acquiring your locks in an ordered manner. Even for very simple cases.
* The algorithm tried to adjust to contention by blocking on the mutex it
* thinks is the best fit, leaving all other mutexes open to be locked by
* other threads. See the benchmarks in folly/test/SynchronizedBenchmark.cpp
* for more
*
* This works differently as compared to the locking algorithm in libstdc++
* and is the recommended way to acquire mutexes in a generic order safe
* manner. Performance benchmarks show that this does better than the one in
* libstdc++ even for the simple cases
*
* Usage is the same as std::lock() for arbitrary lockables
*
* folly::lock(one, two, three);
*
* To make it work with folly::Synchronized you have to specify how you want
* the locks to be acquired, use the folly::wlock(), folly::rlock(),
* folly::ulock() and folly::lock() helpers defined below
*
* auto [one, two] = lock(folly::wlock(a), folly::rlock(b));
*
* Note that you can/must avoid the folly:: namespace prefix on the lock()
* function if you use the helpers, ADL lookup is done to find the lock function
*
* This will execute the deadlock avoidance algorithm and acquire a write lock
* for a and a read lock for b
*/
template <typename LockableOne, typename LockableTwo, typename... Lockables>
void lock(LockableOne& one, LockableTwo& two, Lockables&... lockables) {
auto locker = [](auto& lockable) {
using Lockable = std::remove_reference_t<decltype(lockable)>;
return detail::makeSynchronizedLocker(
lockable,
[](auto& l) { return std::unique_lock<Lockable>{l}; },
[](auto& l) {
auto lock = std::unique_lock<Lockable>{l, std::defer_lock};
lock.try_lock();
return lock;
});
};
auto locks = lock(locker(one), locker(two), locker(lockables)...);
// release ownership of the locks from the RAII lock wrapper returned by the
// function above
for_each(locks, [&](auto& lock) { lock.release(); });
} </s> remove /*
* Now inherit from them all. This is done in such a convoluted
* way to make sure we get the empty base optimizaton on all these
* types to keep sizeof(small_vector<>) minimal.
*/
typedef boost::totally_ordered1<
small_vector<Value,RequestedMaxInline,InPolicyA,InPolicyB,InPolicyC>,
ActualSizePolicy
> type;
};
</s> add /*
* Now inherit from them all. This is done in such a convoluted
* way to make sure we get the empty base optimizaton on all these
* types to keep sizeof(small_vector<>) minimal.
*/
typedef boost::totally_ordered1<
small_vector<Value, RequestedMaxInline, InPolicyA, InPolicyB, InPolicyC>,
ActualSizePolicy>
type;
}; </s> remove /*
* Make the real policy base classes.
*/
typedef IntegralSizePolicy<SizeType,!HasNoHeap::value>
ActualSizePolicy;
</s> add /*
* Make the real policy base classes.
*/
typedef IntegralSizePolicy<SizeType, !HasNoHeap::value> ActualSizePolicy;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> /**
<mask> * Split a key component from "key", which must be non-empty (an exception
<mask> * is thrown otherwise).
<mask> */
<mask> template <bool emptyOk=false>
<mask> StringPiece splitKey();
<mask>
<mask> /**
<mask> * Is the entire key empty?
<mask> */
</s> [sdk33] Update iOS with RN 0.59 </s> remove class SubprocessError : public std::exception {};
</s> add class FOLLY_EXPORT SubprocessError : public std::runtime_error {
public:
using std::runtime_error::runtime_error;
}; </s> remove * For moving a `Function<X(Ys..) const>` into a `Function<X(Ys...)>`.
</s> add * For move-constructing from a `folly::Function<X(Ys...) [const?]>`.
* For a `Function` with a `const` function type, the object must be
* callable from a `const`-reference, i.e. implement `operator() const`.
* For a `Function` with a non-`const` function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise. </s> remove template <typename ClockT = DefaultTokenBucketClock>
class ParameterizedDynamicTokenBucket {
</s> add template <typename Clock = std::chrono::steady_clock>
class BasicDynamicTokenBucket {
static_assert(Clock::is_steady, "clock must be steady");
</s> remove throw BadFormatArg(errorStr(std::forward<Args>(args)...));
</s> add throw_exception<BadFormatArg>(errorStr(std::forward<Args>(args)...)); </s> remove if (!emptyOk) { // static
</s> add if (!emptyOk) { // static </s> remove * Constructs a new `Function` from any callable object. This
* handles function pointers, pointers to static member functions,
* `std::reference_wrapper` objects, `std::function` objects, and arbitrary
* objects that implement `operator()` if the parameter signature
* matches (i.e. it returns R when called with Args...).
* For a `Function` with a const function type, the object must be
* callable from a const-reference, i.e. implement `operator() const`.
* For a `Function` with a non-const function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise.
</s> add * Constructs a new `Function` from any callable object that is _not_ a
* `folly::Function`. This handles function pointers, pointers to static
* member functions, `std::reference_wrapper` objects, `std::function`
* objects, and arbitrary objects that implement `operator()` if the parameter
* signature matches (i.e. it returns an object convertible to `R` when called
* with `Args...`).
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep keep replace replace keep keep keep keep replace keep keep keep
|
<mask>
<mask> template <typename... Args>
<mask> inline std::string FormatArg::errorStr(Args&&... args) const {
<mask> return to<std::string>(
<mask> "invalid format argument {", fullArgString, "}: ",
<mask> std::forward<Args>(args)...);
<mask> }
<mask>
<mask> template <typename... Args>
<mask> [[noreturn]] inline void FormatArg::error(Args&&... args) const {
<mask> throw BadFormatArg(errorStr(std::forward<Args>(args)...));
<mask> }
<mask>
<mask> template <bool emptyOk>
</s> [sdk33] Update iOS with RN 0.59 </s> remove throwSystemErrorExplicit(
err, to<fbstring>(std::forward<Args>(args)...).c_str());
</s> add throw makeSystemErrorExplicit(err, std::forward<Args>(args)...); </s> remove throw std::system_error(err, std::system_category(), msg);
</s> add throw makeSystemErrorExplicit(err, msg); </s> remove : impl_(std::forward<Args>(args)...) {}
CachelinePadded() {}
</s> add : inner_(std::forward<Args>(args)...) {} </s> remove // Invoke helper
template <typename F, typename... Args>
inline auto invoke(F&& f, Args&&... args)
-> decltype(std::forward<F>(f)(std::forward<Args>(args)...)) {
return std::forward<F>(f)(std::forward<Args>(args)...);
}
template <typename M, typename C, typename... Args>
inline auto invoke(M(C::*d), Args&&... args)
-> decltype(std::mem_fn(d)(std::forward<Args>(args)...)) {
return std::mem_fn(d)(std::forward<Args>(args)...);
}
</s> add </s> remove throwSystemErrorExplicit(-ret, std::forward<Args>(args)...);
</s> add throwSystemErrorExplicit(int(-ret), std::forward<Args>(args)...);
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> template <bool emptyOk>
<mask> inline StringPiece FormatArg::doSplitKey() {
<mask> if (nextKeyMode_ == NextKeyMode::STRING) {
<mask> nextKeyMode_ = NextKeyMode::NONE;
<mask> if (!emptyOk) { // static
<mask> enforce(!nextKey_.empty(), "non-empty key required");
<mask> }
<mask> return nextKey_;
<mask> }
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> remove if (!emptyOk) { // static
</s> add if (!emptyOk) { // static </s> remove if (!emptyOk) { // static
</s> add if (!emptyOk) { // static </s> remove throw BadFormatArg(errorStr(std::forward<Args>(args)...));
</s> add throw_exception<BadFormatArg>(errorStr(std::forward<Args>(args)...)); </s> remove template<class String> StringPiece prepareDelim(const String& s) {
</s> add template <class String>
StringPiece prepareDelim(const String& s) { </s> remove inline char prepareDelim(char c) { return c; }
</s> add inline char prepareDelim(char c) {
return c;
}
template <class OutputType>
void toOrIgnore(StringPiece input, OutputType& output) {
output = folly::to<OutputType>(input);
}
inline void toOrIgnore(StringPiece, decltype(std::ignore)&) {} </s> remove } catch (const std::out_of_range& e) {
</s> add } catch (const std::out_of_range&) {
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> return nextKey_;
<mask> }
<mask>
<mask> if (key_.empty()) {
<mask> if (!emptyOk) { // static
<mask> error("non-empty key required");
<mask> }
<mask> return StringPiece();
<mask> }
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> remove if (!emptyOk) { // static
</s> add if (!emptyOk) { // static </s> remove if (!emptyOk) { // static
</s> add if (!emptyOk) { // static </s> remove } catch (const std::out_of_range& e) {
</s> add } catch (const std::out_of_range&) { </s> remove return 0; // unreached
</s> add return 0; // unreached </s> remove template <class Ex>
bool is_compatible_with() const {
if (item_) {
return dynamic_cast<const Ex*>(item_.get());
} else if (eptr_) {
try {
std::rethrow_exception(eptr_);
} catch (typename std::decay<Ex>::type&) {
return true;
} catch (...) {
// fall through
}
}
return false;
}
</s> add [[noreturn]] static void onNoExceptionError(char const* name); </s> remove bool contains(const key_type &data) const { return sl_->find(data); }
bool add(const key_type &data) { return sl_->addOrGetData(data).second; }
bool remove(const key_type &data) { return sl_->remove(data); }
</s> add bool contains(const key_type& data) const {
return sl_->find(data);
}
bool add(const key_type& data) {
return sl_->addOrGetData(data).second;
}
bool remove(const key_type& data) {
return sl_->remove(data);
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep replace replace keep replace keep keep keep
|
<mask> --e;
<mask> p = static_cast<const char*>(memchr(b, '[', e - b));
<mask> enforce(p, "unmatched ']'");
<mask> } else {
<mask> p = static_cast<const char*>(memchr(b, '.', e - b));
<mask> }
<mask> if (p) {
<mask> key_.assign(p + 1, e);
</s> [sdk33] Update iOS with RN 0.59 </s> remove makeSize(size() + 1, &t, offset);
</s> add makeSize(
size() + 1,
[&t](void* ptr) { new (ptr) value_type(std::move(t)); },
offset); </s> remove case '+':
if (mode == UriEscapeMode::QUERY) {
out.append(&*last, p - last);
out.push_back(' ');
</s> add case '+':
if (mode == UriEscapeMode::QUERY) {
out.append(&*last, size_t(p - last));
out.push_back(' ');
++p;
last = p;
break;
}
// else fallthrough
FOLLY_FALLTHROUGH;
default: </s> remove size_t len = e - b;
</s> add size_t len = size_t(e - b); </s> remove last = p;
</s> add </s> remove out.append(&*last, p - last);
</s> add out.append(&*last, size_t(p - last));
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> } else {
<mask> p = e;
<mask> key_.clear();
<mask> }
<mask> if (!emptyOk) { // static
<mask> enforce(b != p, "non-empty key required");
<mask> }
<mask> return StringPiece(b, p);
<mask> }
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> remove if (!emptyOk) { // static
</s> add if (!emptyOk) { // static </s> remove if (!emptyOk) { // static
</s> add if (!emptyOk) { // static </s> remove p = static_cast<const char*>(memchr(b, '.', e - b));
</s> add p = static_cast<const char*>(memchr(b, '.', size_t(e - b))); </s> remove } catch (const std::out_of_range& e) {
</s> add } catch (const std::out_of_range&) { </s> remove return 0; // unreached
</s> add return 0; // unreached </s> remove for (; b >= dest; --b) b->~T();
</s> add for (; b >= dest; --b) {
b->~T();
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep replace keep replace
|
<mask> }
<mask> try {
<mask> return to<int>(doSplitKey<true>());
<mask> } catch (const std::out_of_range& e) {
<mask> error("integer key required");
<mask> return 0; // unreached
</s> [sdk33] Update iOS with RN 0.59 </s> remove if (!emptyOk) { // static
</s> add if (!emptyOk) { // static </s> remove if (!emptyOk) { // static
</s> add if (!emptyOk) { // static </s> remove // move old elements to the left of the new one
try {
detail::moveToUninitialized(begin(), begin() + pos, newp);
} catch (...) {
newp[pos].~value_type();
free(newh);
throw;
}
// move old elements to the right of the new one
try {
if (pos < size-1) {
detail::moveToUninitialized(begin() + pos, end(), newp + pos + 1);
}
} catch (...) {
for (size_type i = 0; i <= pos; ++i) {
newp[i].~value_type();
}
free(newh);
throw;
}
} else {
// move without inserting new element
try {
detail::moveToUninitialized(begin(), end(), newp);
} catch (...) {
free(newh);
throw;
</s> add try {
if (insert) {
// move and insert the new element
this->moveToUninitializedEmplace(
begin(), end(), newp, pos, std::forward<EmplaceFunc>(emplaceFunc));
} else {
// move without inserting new element
this->moveToUninitialized(begin(), end(), newp); </s> remove if (!emptyOk) { // static
</s> add if (!emptyOk) { // static </s> remove template <class Ex>
bool is_compatible_with() const {
if (item_) {
return dynamic_cast<const Ex*>(item_.get());
} else if (eptr_) {
try {
std::rethrow_exception(eptr_);
} catch (typename std::decay<Ex>::type&) {
return true;
} catch (...) {
// fall through
}
}
return false;
}
</s> add [[noreturn]] static void onNoExceptionError(char const* name);
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep keep keep keep replace
|
<mask> return 0; // unreached
<mask> }
<mask> }
<mask>
<mask> } // namespace folly
</s> [sdk33] Update iOS with RN 0.59 </s> remove return 0; // unreached
</s> add return 0; // unreached </s> remove } catch (const std::out_of_range& e) {
</s> add } catch (const std::out_of_range&) { </s> remove
}} // folly::detail
</s> add } // namespace detail
} // namespace folly </s> remove } // namespace folly
</s> add } // namespace folly </s> remove }
</s> add } // namespace folly </s> remove }
}
</s> add } // namespace detail
} // namespace folly
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatArg.h
|
keep replace keep keep keep keep keep
|
<mask> /*
<mask> * Copyright 2016 Facebook, Inc.
<mask> *
<mask> * Licensed under the Apache License, Version 2.0 (the "License");
<mask> * you may not use this file except in compliance with the License.
<mask> * You may obtain a copy of the License at
<mask> *
</s> [sdk33] Update iOS with RN 0.59 </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2012-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2011-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2013-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2011-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2016-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2016-present Facebook, Inc.
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatTraits.h
|
keep keep keep add keep keep keep keep keep keep
|
<mask> */
<mask>
<mask> #pragma once
<mask>
<mask> #include <type_traits>
<mask>
<mask> namespace folly {
<mask> namespace detail {
<mask>
<mask> // Shortcut, so we don't have to use enable_if everywhere
</s> [sdk33] Update iOS with RN 0.59 </s> remove namespace folly { namespace detail {
</s> add namespace folly {
namespace detail { </s> remove #include <string>
</s> add </s> add #include <folly/CPortability.h>
</s> remove #include <stdlib.h>
</s> add #include <folly/Memory.h> // @shim </s> remove #include <boost/multi_index_container.hpp>
</s> add </s> remove #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
</s> add FOLLY_PUSH_WARNING
FOLLY_GNU_DISABLE_WARNING("-Wshadow")
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatTraits.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> #pragma once
<mask>
<mask> #include <type_traits>
<mask>
<mask> namespace folly { namespace detail {
<mask>
<mask> // Shortcut, so we don't have to use enable_if everywhere
<mask> struct FormatTraitsBase {
<mask> typedef void enabled;
<mask> };
</s> [sdk33] Update iOS with RN 0.59 </s> add #include <cstddef> </s> remove #include <string>
</s> add </s> remove #include <stdlib.h>
</s> add #include <folly/Memory.h> // @shim </s> add #include <folly/CPortability.h>
</s> remove #include <type_traits>
#include <utility>
namespace folly {
enum class TLPDestructionMode {
THIS_THREAD,
ALL_THREADS
};
struct AccessModeStrict {};
} // namespace
</s> add </s> remove namespace folly { namespace detail {
</s> add namespace folly {
namespace detail {
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatTraits.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask>
<mask> // Traits that define enabled, value_type, and at() for anything
<mask> // indexable with integral keys: pointers, arrays, vectors, and maps
<mask> // with integral keys
<mask> template <class T, class Enable = void> struct IndexableTraits;
<mask>
<mask> // Base class for sequences (vectors, deques)
<mask> template <class C>
<mask> struct IndexableTraitsSeq : public FormatTraitsBase {
<mask> typedef C container_type;
</s> [sdk33] Update iOS with RN 0.59 </s> remove template <class T, class Enable = void>
struct IsSomeVector {
enum { value = false };
};
template <class T>
struct IsSomeVector<std::vector<T>, void> {
enum { value = true };
};
template <class T>
struct IsSomeVector<fbvector<T>, void> {
enum { value = true };
};
template <class T, class Enable = void>
struct IsConvertible {
enum { value = false };
};
template <class T>
struct IsConvertible<
T,
decltype(static_cast<void>(
parseTo(std::declval<folly::StringPiece>(), std::declval<T&>())))> {
enum { value = true };
};
template <class... Types>
struct AllConvertible;
template <class Head, class... Tail>
struct AllConvertible<Head, Tail...> {
enum { value = IsConvertible<Head>::value && AllConvertible<Tail...>::value };
};
</s> add namespace detail {
template <typename Void, typename OutputType>
struct IsConvertible : std::false_type {}; </s> remove : public IndexableTraitsSeq<small_vector<T, M, A, B, C>> {
};
</s> add : public IndexableTraitsSeq<small_vector<T, M, A, B, C>> {};
} // namespace detail </s> remove template <typename T, typename Enable = void> struct DynamicConverter;
</s> add template <typename T, typename Enable = void>
struct DynamicConverter; </s> remove template<typename C>
struct DynamicConstructor<C,
</s> add template <typename C>
struct DynamicConstructor<
C, </s> remove template <class IntT, class Tag=IntT>
</s> add template <class IntT, class Tag = IntT> </s> remove template<class T, std::size_t M, class A, class B, class C>
</s> add template <class T, std::size_t M, class A, class B, class C>
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatTraits.h
|
keep keep keep keep replace
|
<mask> return pos != c.end() ? pos->second : dflt;
<mask> }
<mask> };
<mask>
<mask> }} // namespaces
</s> [sdk33] Update iOS with RN 0.59 </s> remove }} // namespaces
</s> add } // namespace detail
} // namespace folly </s> remove
}} // folly::detail
</s> add } // namespace detail
} // namespace folly </s> remove return pred == head_.load(std::memory_order_relaxed)
? nullptr : &pred->data();
</s> add return pred == head_.load(std::memory_order_relaxed) ? nullptr
: &pred->data(); </s> remove template <typename T>
constexpr auto constexpr_abs(T t)
-> decltype(detail::constexpr_abs_helper<T>::go(t)) {
return detail::constexpr_abs_helper<T>::go(t);
</s> add template <typename Char>
constexpr int constexpr_strcmp_internal(const Char* s1, const Char* s2) {
return (*s1 == '\0' || *s1 != *s2)
? (static_cast<int>(*s1 - *s2))
: constexpr_strcmp_internal(s1 + 1, s2 + 1); </s> remove return node_ == nullptr ? 0 :
node_->height() * sizeof(NodeT*) + sizeof(*this);
</s> add return node_ == nullptr ? 0
: node_->height() * sizeof(NodeT*) + sizeof(*this); </s> remove bool good() const { return node_ != nullptr; }
</s> add bool good() const {
return node_ != nullptr;
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/FormatTraits.h
|
keep replace replace replace keep keep keep keep keep
|
<mask> /*
<mask> * Copyright 2016 Facebook, Inc.
<mask> *
<mask> * @author Eric Niebler ([email protected]), Sven Over ([email protected])
<mask> *
<mask> * Licensed under the Apache License, Version 2.0 (the "License");
<mask> * you may not use this file except in compliance with the License.
<mask> * You may obtain a copy of the License at
<mask> *
</s> [sdk33] Update iOS with RN 0.59 </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2016-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2014-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2016-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2016-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2016-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2016-present Facebook, Inc.
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> * distributed under the License is distributed on an "AS IS" BASIS,
<mask> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<mask> * See the License for the specific language governing permissions and
<mask> * limitations under the License.
<mask> *
<mask> * Acknowledgements: Giuseppe Ottaviano ([email protected])
<mask> */
<mask>
<mask> /**
<mask> * @class Function
</s> [sdk33] Update iOS with RN 0.59 </s> add /*
* Author: Eric Niebler <[email protected]>
*/ </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2016-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2016-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2011-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2016-present Facebook, Inc. </s> remove * Copyright 2016 Facebook, Inc.
</s> add * Copyright 2011-present Facebook, Inc.
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep add keep keep keep keep keep keep
|
<mask> #include <utility>
<mask>
<mask> #include <folly/CppAttributes.h>
<mask> #include <folly/Portability.h>
<mask>
<mask> namespace folly {
<mask>
<mask> template <typename FunctionType>
<mask> class Function;
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> remove #include <type_traits>
#include <utility>
namespace folly {
enum class TLPDestructionMode {
THIS_THREAD,
ALL_THREADS
};
struct AccessModeStrict {};
} // namespace
</s> add </s> add #include <folly/lang/Exception.h> </s> remove #include <boost/operators.hpp>
#include <folly/portability/BitsFunctexcept.h>
</s> add #include <folly/Traits.h>
#include <folly/Utility.h>
#include <folly/lang/Exception.h> </s> remove #include <folly/gen/String.h>
#include <folly/io/IOBufQueue.h>
</s> add </s> add #include <folly/gen/String.h>
#include <folly/io/IOBufQueue.h>
#include <folly/portability/SysResource.h> </s> remove #include <boost/iterator/iterator_facade.hpp>
</s> add #include <iterator>
#include <type_traits>
#include <utility>
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep add keep keep keep keep keep keep
|
<mask> template <typename ReturnType, typename... Args>
<mask> Function<ReturnType(Args...) const> constCastFunction(
<mask> Function<ReturnType(Args...)>&&) noexcept;
<mask>
<mask> namespace detail {
<mask> namespace function {
<mask>
<mask> enum class Op { MOVE, NUKE, HEAP };
<mask>
<mask> union Data {
</s> [sdk33] Update iOS with RN 0.59 </s> remove enum class Op { MOVE, NUKE, FULL, HEAP };
</s> add enum class Op { MOVE, NUKE, HEAP }; </s> add Data() {} </s> add #if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
Function<ReturnType(Args...) const noexcept> constCastFunction(
Function<ReturnType(Args...) noexcept>&& that) noexcept {
return Function<ReturnType(Args...) const noexcept>{
std::move(that), detail::function::CoerceTag{}};
}
template <typename ReturnType, typename... Args>
Function<ReturnType(Args...) const noexcept> constCastFunction(
Function<ReturnType(Args...) const noexcept>&& that) noexcept {
return std::move(that);
}
#endif
</s> remove // Invoke helper
template <typename F, typename... Args>
inline auto invoke(F&& f, Args&&... args)
-> decltype(std::forward<F>(f)(std::forward<Args>(args)...)) {
return std::forward<F>(f)(std::forward<Args>(args)...);
}
template <typename M, typename C, typename... Args>
inline auto invoke(M(C::*d), Args&&... args)
-> decltype(std::mem_fn(d)(std::forward<Args>(args)...)) {
return std::mem_fn(d)(std::forward<Args>(args)...);
}
</s> add </s> remove auto& fn = *static_cast<const Function<ReturnType(Args...) const>*>(this);
</s> add auto& fn = *static_cast<const Function<ConstSignature>*>(this);
return fn.call_(fn.data_, static_cast<Args&&>(args)...);
}
class SharedProxy {
std::shared_ptr<Function<ConstSignature>> sp_;
public:
explicit SharedProxy(Function<ConstSignature>&& func)
: sp_(std::make_shared<Function<ConstSignature>>(std::move(func))) {}
ReturnType operator()(Args&&... args) const {
return (*sp_)(static_cast<Args&&>(args)...);
}
};
};
#if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
struct FunctionTraits<ReturnType(Args...) noexcept> {
using Call = ReturnType (*)(Data&, Args&&...) noexcept;
using IsConst = std::false_type;
using ConstSignature = ReturnType(Args...) const noexcept;
using NonConstSignature = ReturnType(Args...) noexcept;
using OtherSignature = ConstSignature;
template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>;
template <typename Fun>
static ReturnType callSmall(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>((*static_cast<Fun*>(
static_cast<void*>(&p.tiny)))(static_cast<Args&&>(args)...));
}
template <typename Fun>
static ReturnType callBig(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>(
(*static_cast<Fun*>(p.big))(static_cast<Args&&>(args)...));
}
static ReturnType uninitCall(Data&, Args&&...) noexcept {
terminate_with<std::bad_function_call>();
}
ReturnType operator()(Args... args) noexcept {
auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> remove void* object_{nullptr};
Call call_{&FunctionRef::uninitCall};
</s> add
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask>
<mask> namespace detail {
<mask> namespace function {
<mask>
<mask> enum class Op { MOVE, NUKE, FULL, HEAP };
<mask>
<mask> union Data {
<mask> void* big;
<mask> std::aligned_storage<6 * sizeof(void*)>::type tiny;
<mask> };
</s> [sdk33] Update iOS with RN 0.59 </s> add Data() {} </s> add #if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
Function<ReturnType(Args...) const noexcept> constCastFunction(
Function<ReturnType(Args...) noexcept>&&) noexcept;
#endif
</s> remove template <class T, class Enable = void>
struct IsSomeVector {
enum { value = false };
};
template <class T>
struct IsSomeVector<std::vector<T>, void> {
enum { value = true };
};
template <class T>
struct IsSomeVector<fbvector<T>, void> {
enum { value = true };
};
template <class T, class Enable = void>
struct IsConvertible {
enum { value = false };
};
template <class T>
struct IsConvertible<
T,
decltype(static_cast<void>(
parseTo(std::declval<folly::StringPiece>(), std::declval<T&>())))> {
enum { value = true };
};
template <class... Types>
struct AllConvertible;
template <class Head, class... Tail>
struct AllConvertible<Head, Tail...> {
enum { value = IsConvertible<Head>::value && AllConvertible<Tail...>::value };
};
</s> add namespace detail {
template <typename Void, typename OutputType>
struct IsConvertible : std::false_type {}; </s> remove }
</s> add } // namespace detail </s> remove template <typename Fun, typename FunT = typename std::decay<Fun>::type>
using IsSmall = std::integral_constant<
bool,
(sizeof(FunT) <= sizeof(Data::tiny) &&
// Same as is_nothrow_move_constructible, but w/ no template instantiation.
noexcept(FunT(std::declval<FunT&&>())))>;
</s> add template <typename Fun, typename = Fun*>
using IsSmall = Conjunction<
bool_constant<(sizeof(Fun) <= sizeof(Data::tiny))>,
std::is_nothrow_move_constructible<Fun>>; </s> remove template<typename ValT, typename NodeT> class csl_iterator;
</s> add template <typename ValT, typename NodeT>
class csl_iterator;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep add keep keep keep keep
|
<mask> enum class Op { MOVE, NUKE, HEAP };
<mask>
<mask> union Data {
<mask> void* big;
<mask> std::aligned_storage<6 * sizeof(void*)>::type tiny;
<mask> };
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> remove enum class Op { MOVE, NUKE, FULL, HEAP };
</s> add enum class Op { MOVE, NUKE, HEAP }; </s> add #if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
Function<ReturnType(Args...) const noexcept> constCastFunction(
Function<ReturnType(Args...) noexcept>&&) noexcept;
#endif
</s> remove template <typename Fun, typename FunT = typename std::decay<Fun>::type>
using IsSmall = std::integral_constant<
bool,
(sizeof(FunT) <= sizeof(Data::tiny) &&
// Same as is_nothrow_move_constructible, but w/ no template instantiation.
noexcept(FunT(std::declval<FunT&&>())))>;
</s> add template <typename Fun, typename = Fun*>
using IsSmall = Conjunction<
bool_constant<(sizeof(Fun) <= sizeof(Data::tiny))>,
std::is_nothrow_move_constructible<Fun>>; </s> remove template <class T, class Enable = void>
struct IsSomeVector {
enum { value = false };
};
template <class T>
struct IsSomeVector<std::vector<T>, void> {
enum { value = true };
};
template <class T>
struct IsSomeVector<fbvector<T>, void> {
enum { value = true };
};
template <class T, class Enable = void>
struct IsConvertible {
enum { value = false };
};
template <class T>
struct IsConvertible<
T,
decltype(static_cast<void>(
parseTo(std::declval<folly::StringPiece>(), std::declval<T&>())))> {
enum { value = true };
};
template <class... Types>
struct AllConvertible;
template <class Head, class... Tail>
struct AllConvertible<Head, Tail...> {
enum { value = IsConvertible<Head>::value && AllConvertible<Tail...>::value };
};
</s> add namespace detail {
template <typename Void, typename OutputType>
struct IsConvertible : std::false_type {}; </s> remove explicit Data() { pdata_.heap_ = 0; }
</s> add explicit Data() {
pdata_.heap_ = nullptr;
} </s> remove struct AllConvertible<> {
enum { value = true };
};
</s> add struct IsConvertible<void, decltype(std::ignore)> : std::true_type {};
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
|
<mask> void* big;
<mask> std::aligned_storage<6 * sizeof(void*)>::type tiny;
<mask> };
<mask>
<mask> template <typename Fun, typename FunT = typename std::decay<Fun>::type>
<mask> using IsSmall = std::integral_constant<
<mask> bool,
<mask> (sizeof(FunT) <= sizeof(Data::tiny) &&
<mask> // Same as is_nothrow_move_constructible, but w/ no template instantiation.
<mask> noexcept(FunT(std::declval<FunT&&>())))>;
<mask> using SmallTag = std::true_type;
<mask> using HeapTag = std::false_type;
<mask>
<mask> struct CoerceTag {};
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> add template <typename T>
struct NotFunction : std::true_type {};
template <typename T>
struct NotFunction<Function<T>> : std::false_type {};
template <typename T>
using EnableIfNotFunction =
typename std::enable_if<NotFunction<T>::value>::type;
</s> add Data() {} </s> remove enum class Op { MOVE, NUKE, FULL, HEAP };
</s> add enum class Op { MOVE, NUKE, HEAP }; </s> remove inline bool uninitNoop(Op, Data*, Data*) {
return false;
}
</s> add template <typename F, typename... Args>
using CallableResult = decltype(std::declval<F>()(std::declval<Args>()...));
template <
typename From,
typename To,
typename = typename std::enable_if<
!std::is_reference<To>::value || std::is_reference<From>::value>::type>
using SafeResultOf = decltype(static_cast<To>(std::declval<From>())); </s> remove } // namespace folly
</s> add namespace threadlocal_detail {
template <typename>
struct static_meta_of;
template <typename T, typename Tag, typename AccessMode>
struct static_meta_of<ThreadLocalPtr<T, Tag, AccessMode>> {
using type = StaticMeta<Tag, AccessMode>;
};
template <typename T, typename Tag, typename AccessMode>
struct static_meta_of<ThreadLocal<T, Tag, AccessMode>> {
using type = StaticMeta<Tag, AccessMode>;
};
} // namespace threadlocal_detail
} // namespace folly </s> add // Enable only if the unlock policy of the other LockPolicy is the same as
// ours
template <typename LockPolicyOther>
using EnableIfSameUnlockPolicy = std::enable_if_t<std::is_same<
typename LockPolicy::UnlockPolicy,
typename LockPolicyOther::UnlockPolicy>::value>;
// friend other LockedPtr types
template <typename SynchronizedTypeOther, typename LockPolicyOther>
friend class LockedPtr;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep add keep keep keep keep
|
<mask> std::is_nothrow_move_constructible<Fun>>;
<mask> using SmallTag = std::true_type;
<mask> using HeapTag = std::false_type;
<mask>
<mask> struct CoerceTag {};
<mask>
<mask> template <typename T>
<mask> bool isNullPtrFn(T* p) {
</s> [sdk33] Update iOS with RN 0.59 </s> remove template <typename Fun, typename FunT = typename std::decay<Fun>::type>
using IsSmall = std::integral_constant<
bool,
(sizeof(FunT) <= sizeof(Data::tiny) &&
// Same as is_nothrow_move_constructible, but w/ no template instantiation.
noexcept(FunT(std::declval<FunT&&>())))>;
</s> add template <typename Fun, typename = Fun*>
using IsSmall = Conjunction<
bool_constant<(sizeof(Fun) <= sizeof(Data::tiny))>,
std::is_nothrow_move_constructible<Fun>>; </s> remove bool
> {};
}
</s> add bool> {};
} // namespace traits_detail_IsEqualityComparable </s> remove bool
> {};
}
</s> add bool> {};
} // namespace traits_detail_IsLessThanComparable </s> remove inline bool uninitNoop(Op, Data*, Data*) {
return false;
}
</s> add template <typename F, typename... Args>
using CallableResult = decltype(std::declval<F>()(std::declval<Args>()...));
template <
typename From,
typename To,
typename = typename std::enable_if<
!std::is_reference<To>::value || std::is_reference<From>::value>::type>
using SafeResultOf = decltype(static_cast<To>(std::declval<From>())); </s> remove template <class T> struct IsTriviallyCopyable
: std::conditional<
traits_detail::has_IsTriviallyCopyable<T>::value,
traits_detail::has_true_IsTriviallyCopyable<T>,
traits_detail::is_trivially_copyable<T>
>::type {};
template <class T> struct IsRelocatable
: std::conditional<
traits_detail::has_IsRelocatable<T>::value,
traits_detail::has_true_IsRelocatable<T>,
// TODO add this line (and some tests for it) when we upgrade to gcc 4.7
//std::is_trivially_move_constructible<T>::value ||
IsTriviallyCopyable<T>
>::type {};
template <class T> struct IsZeroInitializable
: std::conditional<
traits_detail::has_IsZeroInitializable<T>::value,
traits_detail::has_true_IsZeroInitializable<T>,
std::integral_constant<bool, !std::is_class<T>::value>
>::type {};
</s> add template <class T>
struct IsRelocatable : std::conditional<
traits_detail::has_IsRelocatable<T>::value,
traits_detail::has_true_IsRelocatable<T>,
// TODO add this line (and some tests for it) when we
// upgrade to gcc 4.7
// std::is_trivially_move_constructible<T>::value ||
is_trivially_copyable<T>>::type {};
template <class T>
struct IsZeroInitializable
: std::conditional<
traits_detail::has_IsZeroInitializable<T>::value,
traits_detail::has_true_IsZeroInitializable<T>,
bool_constant<!std::is_class<T>::value>>::type {}; </s> remove : std::integral_constant<bool,
std::is_nothrow_move_constructible<T>::value &&
noexcept(swap(std::declval<T&>(), std::declval<T&>()))
> {};
</s> add : bool_constant<std::is_nothrow_move_constructible<T>::value&& noexcept(
swap(std::declval<T&>(), std::declval<T&>()))> {};
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace keep keep keep keep keep
|
<mask> std::false_type isNullPtrFn(T&&) {
<mask> return {};
<mask> }
<mask>
<mask> inline bool uninitNoop(Op, Data*, Data*) {
<mask> return false;
<mask> }
<mask>
<mask> template <typename FunctionType>
<mask> struct FunctionTraits;
<mask>
<mask> template <typename ReturnType, typename... Args>
</s> [sdk33] Update iOS with RN 0.59 </s> remove // Invoke helper
template <typename F, typename... Args>
inline auto invoke(F&& f, Args&&... args)
-> decltype(std::forward<F>(f)(std::forward<Args>(args)...)) {
return std::forward<F>(f)(std::forward<Args>(args)...);
}
template <typename M, typename C, typename... Args>
inline auto invoke(M(C::*d), Args&&... args)
-> decltype(std::mem_fn(d)(std::forward<Args>(args)...)) {
return std::mem_fn(d)(std::forward<Args>(args)...);
}
</s> add </s> add #if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
Function<ReturnType(Args...) const noexcept> constCastFunction(
Function<ReturnType(Args...) noexcept>&& that) noexcept {
return Function<ReturnType(Args...) const noexcept>{
std::move(that), detail::function::CoerceTag{}};
}
template <typename ReturnType, typename... Args>
Function<ReturnType(Args...) const noexcept> constCastFunction(
Function<ReturnType(Args...) const noexcept>&& that) noexcept {
return std::move(that);
}
#endif
</s> remove void* object_{nullptr};
Call call_{&FunctionRef::uninitCall};
</s> add </s> add #if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
Function<ReturnType(Args...) const noexcept> constCastFunction(
Function<ReturnType(Args...) noexcept>&&) noexcept;
#endif
</s> add template <typename T>
struct NotFunction : std::true_type {};
template <typename T>
struct NotFunction<Function<T>> : std::false_type {};
template <typename T>
using EnableIfNotFunction =
typename std::enable_if<NotFunction<T>::value>::type;
</s> remove template <class SynchronizedType, class LockPolicy>
class LockedGuardPtr {
private:
// CDataType is the DataType with the appropriate const-qualification
using CDataType = detail::SynchronizedDataType<SynchronizedType>;
public:
using DataType = typename SynchronizedType::DataType;
using MutexType = typename SynchronizedType::MutexType;
using Synchronized = typename std::remove_const<SynchronizedType>::type;
LockedGuardPtr() = delete;
/**
* Takes a Synchronized<T> and locks it.
*/
explicit LockedGuardPtr(SynchronizedType* parent) : parent_(parent) {
LockPolicy::lock(parent_->mutex_);
}
/**
* Destructor releases.
*/
~LockedGuardPtr() {
LockPolicy::unlock(parent_->mutex_);
}
/**
* Access the locked data.
*/
CDataType* operator->() const {
return &parent_->datum_;
}
</s> add template <typename D, typename M, typename... Args>
auto wlock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::wlock(synchronized, std::forward<Args>(args)...);
}
template <typename Data, typename Mutex, typename... Args>
auto rlock(const Synchronized<Data, Mutex>& synchronized, Args&&... args) {
return detail::rlock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto ulock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::ulock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto lock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::lock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto lock(const Synchronized<D, M>& synchronized, Args&&... args) {
return detail::lock(synchronized, std::forward<Args>(args)...);
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace keep keep keep keep keep
|
<mask> using ConstSignature = ReturnType(Args...) const;
<mask> using NonConstSignature = ReturnType(Args...);
<mask> using OtherSignature = ConstSignature;
<mask>
<mask> template <typename F, typename G = typename std::decay<F>::type>
<mask> using ResultOf = decltype(
<mask> static_cast<ReturnType>(std::declval<G&>()(std::declval<Args>()...)));
<mask>
<mask> template <typename Fun>
<mask> static ReturnType callSmall(Data& p, Args&&... args) {
<mask> return static_cast<ReturnType>((*static_cast<Fun*>(
<mask> static_cast<void*>(&p.tiny)))(static_cast<Args&&>(args)...));
</s> [sdk33] Update iOS with RN 0.59 </s> remove template <typename F, typename G = typename std::decay<F>::type>
using ResultOf = decltype(static_cast<ReturnType>(
std::declval<const G&>()(std::declval<Args>()...)));
</s> add template <typename F>
using ResultOf = SafeResultOf<
CallableResult<const _t<std::decay<F>>&, Args...>,
ReturnType>; </s> remove auto& fn = *static_cast<const Function<ReturnType(Args...) const>*>(this);
</s> add auto& fn = *static_cast<const Function<ConstSignature>*>(this);
return fn.call_(fn.data_, static_cast<Args&&>(args)...);
}
class SharedProxy {
std::shared_ptr<Function<ConstSignature>> sp_;
public:
explicit SharedProxy(Function<ConstSignature>&& func)
: sp_(std::make_shared<Function<ConstSignature>>(std::move(func))) {}
ReturnType operator()(Args&&... args) const {
return (*sp_)(static_cast<Args&&>(args)...);
}
};
};
#if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
struct FunctionTraits<ReturnType(Args...) noexcept> {
using Call = ReturnType (*)(Data&, Args&&...) noexcept;
using IsConst = std::false_type;
using ConstSignature = ReturnType(Args...) const noexcept;
using NonConstSignature = ReturnType(Args...) noexcept;
using OtherSignature = ConstSignature;
template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>;
template <typename Fun>
static ReturnType callSmall(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>((*static_cast<Fun*>(
static_cast<void*>(&p.tiny)))(static_cast<Args&&>(args)...));
}
template <typename Fun>
static ReturnType callBig(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>(
(*static_cast<Fun*>(p.big))(static_cast<Args&&>(args)...));
}
static ReturnType uninitCall(Data&, Args&&...) noexcept {
terminate_with<std::bad_function_call>();
}
ReturnType operator()(Args... args) noexcept {
auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> remove return static_cast<ReturnType>(detail::function::invoke(
*static_cast<Fun*>(object), static_cast<Args&&>(args)...));
</s> add using Pointer = _t<std::add_pointer<Fun>>;
return static_cast<ReturnType>(invoke(
static_cast<Fun&&>(*static_cast<Pointer>(object)),
static_cast<Args&&>(args)...)); </s> remove void* object_{nullptr};
Call call_{&FunctionRef::uninitCall};
</s> add </s> remove inline bool uninitNoop(Op, Data*, Data*) {
return false;
}
</s> add template <typename F, typename... Args>
using CallableResult = decltype(std::declval<F>()(std::declval<Args>()...));
template <
typename From,
typename To,
typename = typename std::enable_if<
!std::is_reference<To>::value || std::is_reference<From>::value>::type>
using SafeResultOf = decltype(static_cast<To>(std::declval<From>())); </s> remove template <class SynchronizedType, class LockPolicy>
class LockedGuardPtr {
private:
// CDataType is the DataType with the appropriate const-qualification
using CDataType = detail::SynchronizedDataType<SynchronizedType>;
public:
using DataType = typename SynchronizedType::DataType;
using MutexType = typename SynchronizedType::MutexType;
using Synchronized = typename std::remove_const<SynchronizedType>::type;
LockedGuardPtr() = delete;
/**
* Takes a Synchronized<T> and locks it.
*/
explicit LockedGuardPtr(SynchronizedType* parent) : parent_(parent) {
LockPolicy::lock(parent_->mutex_);
}
/**
* Destructor releases.
*/
~LockedGuardPtr() {
LockPolicy::unlock(parent_->mutex_);
}
/**
* Access the locked data.
*/
CDataType* operator->() const {
return &parent_->datum_;
}
</s> add template <typename D, typename M, typename... Args>
auto wlock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::wlock(synchronized, std::forward<Args>(args)...);
}
template <typename Data, typename Mutex, typename... Args>
auto rlock(const Synchronized<Data, Mutex>& synchronized, Args&&... args) {
return detail::rlock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto ulock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::ulock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto lock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::lock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto lock(const Synchronized<D, M>& synchronized, Args&&... args) {
return detail::lock(synchronized, std::forward<Args>(args)...);
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep replace keep keep keep keep replace keep keep keep keep
|
<mask>
<mask> ReturnType operator()(Args... args) {
<mask> auto& fn = *static_cast<Function<ReturnType(Args...)>*>(this);
<mask> return fn.call_(fn.data_, static_cast<Args&&>(args)...);
<mask> }
<mask>
<mask> class SharedProxy {
<mask> std::shared_ptr<Function<ReturnType(Args...)>> sp_;
<mask>
<mask> public:
<mask> explicit SharedProxy(Function<ReturnType(Args...)>&& func)
<mask> : sp_(std::make_shared<Function<ReturnType(Args...)>>(
</s> [sdk33] Update iOS with RN 0.59 </s> remove explicit SharedProxy(Function<ReturnType(Args...)>&& func)
: sp_(std::make_shared<Function<ReturnType(Args...)>>(
std::move(func))) {}
</s> add explicit SharedProxy(Function<NonConstSignature>&& func)
: sp_(std::make_shared<Function<NonConstSignature>>(std::move(func))) {} </s> remove struct SharedProxy {
std::shared_ptr<Function<ReturnType(Args...) const>> sp_;
</s> add class SharedProxy {
std::shared_ptr<Function<NonConstSignature>> sp_; </s> remove auto& fn = *static_cast<const Function<ReturnType(Args...) const>*>(this);
</s> add auto& fn = *static_cast<const Function<ConstSignature>*>(this);
return fn.call_(fn.data_, static_cast<Args&&>(args)...);
}
class SharedProxy {
std::shared_ptr<Function<ConstSignature>> sp_;
public:
explicit SharedProxy(Function<ConstSignature>&& func)
: sp_(std::make_shared<Function<ConstSignature>>(std::move(func))) {}
ReturnType operator()(Args&&... args) const {
return (*sp_)(static_cast<Args&&>(args)...);
}
};
};
#if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
struct FunctionTraits<ReturnType(Args...) noexcept> {
using Call = ReturnType (*)(Data&, Args&&...) noexcept;
using IsConst = std::false_type;
using ConstSignature = ReturnType(Args...) const noexcept;
using NonConstSignature = ReturnType(Args...) noexcept;
using OtherSignature = ConstSignature;
template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>;
template <typename Fun>
static ReturnType callSmall(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>((*static_cast<Fun*>(
static_cast<void*>(&p.tiny)))(static_cast<Args&&>(args)...));
}
template <typename Fun>
static ReturnType callBig(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>(
(*static_cast<Fun*>(p.big))(static_cast<Args&&>(args)...));
}
static ReturnType uninitCall(Data&, Args&&...) noexcept {
terminate_with<std::bad_function_call>();
}
ReturnType operator()(Args... args) noexcept {
auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> remove explicit SharedProxy(Function<ReturnType(Args...) const>&& func)
: sp_(std::make_shared<Function<ReturnType(Args...) const>>(
std::move(func))) {}
</s> add explicit SharedProxy(Function<NonConstSignature>&& func)
: sp_(std::make_shared<Function<NonConstSignature>>(std::move(func))) {} </s> add constexpr explicit operator bool() const {
return object_;
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace keep keep keep keep keep
|
<mask> class SharedProxy {
<mask> std::shared_ptr<Function<ReturnType(Args...)>> sp_;
<mask>
<mask> public:
<mask> explicit SharedProxy(Function<ReturnType(Args...)>&& func)
<mask> : sp_(std::make_shared<Function<ReturnType(Args...)>>(
<mask> std::move(func))) {}
<mask> ReturnType operator()(Args&&... args) const {
<mask> return (*sp_)(static_cast<Args&&>(args)...);
<mask> }
<mask> };
<mask> };
</s> [sdk33] Update iOS with RN 0.59 </s> remove explicit SharedProxy(Function<ReturnType(Args...) const>&& func)
: sp_(std::make_shared<Function<ReturnType(Args...) const>>(
std::move(func))) {}
</s> add explicit SharedProxy(Function<NonConstSignature>&& func)
: sp_(std::make_shared<Function<NonConstSignature>>(std::move(func))) {} </s> remove std::shared_ptr<Function<ReturnType(Args...)>> sp_;
</s> add std::shared_ptr<Function<NonConstSignature>> sp_; </s> remove auto& fn = *static_cast<const Function<ReturnType(Args...) const>*>(this);
</s> add auto& fn = *static_cast<const Function<ConstSignature>*>(this);
return fn.call_(fn.data_, static_cast<Args&&>(args)...);
}
class SharedProxy {
std::shared_ptr<Function<ConstSignature>> sp_;
public:
explicit SharedProxy(Function<ConstSignature>&& func)
: sp_(std::make_shared<Function<ConstSignature>>(std::move(func))) {}
ReturnType operator()(Args&&... args) const {
return (*sp_)(static_cast<Args&&>(args)...);
}
};
};
#if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
struct FunctionTraits<ReturnType(Args...) noexcept> {
using Call = ReturnType (*)(Data&, Args&&...) noexcept;
using IsConst = std::false_type;
using ConstSignature = ReturnType(Args...) const noexcept;
using NonConstSignature = ReturnType(Args...) noexcept;
using OtherSignature = ConstSignature;
template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>;
template <typename Fun>
static ReturnType callSmall(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>((*static_cast<Fun*>(
static_cast<void*>(&p.tiny)))(static_cast<Args&&>(args)...));
}
template <typename Fun>
static ReturnType callBig(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>(
(*static_cast<Fun*>(p.big))(static_cast<Args&&>(args)...));
}
static ReturnType uninitCall(Data&, Args&&...) noexcept {
terminate_with<std::bad_function_call>();
}
ReturnType operator()(Args... args) noexcept {
auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> remove struct SharedProxy {
std::shared_ptr<Function<ReturnType(Args...) const>> sp_;
</s> add class SharedProxy {
std::shared_ptr<Function<NonConstSignature>> sp_; </s> remove auto& fn = *static_cast<Function<ReturnType(Args...)>*>(this);
</s> add auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> add constexpr explicit operator bool() const {
return object_;
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace keep keep keep keep keep
|
<mask> using ConstSignature = ReturnType(Args...) const;
<mask> using NonConstSignature = ReturnType(Args...);
<mask> using OtherSignature = NonConstSignature;
<mask>
<mask> template <typename F, typename G = typename std::decay<F>::type>
<mask> using ResultOf = decltype(static_cast<ReturnType>(
<mask> std::declval<const G&>()(std::declval<Args>()...)));
<mask>
<mask> template <typename Fun>
<mask> static ReturnType callSmall(Data& p, Args&&... args) {
<mask> return static_cast<ReturnType>((*static_cast<const Fun*>(
<mask> static_cast<void*>(&p.tiny)))(static_cast<Args&&>(args)...));
</s> [sdk33] Update iOS with RN 0.59 </s> remove template <typename F, typename G = typename std::decay<F>::type>
using ResultOf = decltype(
static_cast<ReturnType>(std::declval<G&>()(std::declval<Args>()...)));
</s> add template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>; </s> remove auto& fn = *static_cast<const Function<ReturnType(Args...) const>*>(this);
</s> add auto& fn = *static_cast<const Function<ConstSignature>*>(this);
return fn.call_(fn.data_, static_cast<Args&&>(args)...);
}
class SharedProxy {
std::shared_ptr<Function<ConstSignature>> sp_;
public:
explicit SharedProxy(Function<ConstSignature>&& func)
: sp_(std::make_shared<Function<ConstSignature>>(std::move(func))) {}
ReturnType operator()(Args&&... args) const {
return (*sp_)(static_cast<Args&&>(args)...);
}
};
};
#if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
struct FunctionTraits<ReturnType(Args...) noexcept> {
using Call = ReturnType (*)(Data&, Args&&...) noexcept;
using IsConst = std::false_type;
using ConstSignature = ReturnType(Args...) const noexcept;
using NonConstSignature = ReturnType(Args...) noexcept;
using OtherSignature = ConstSignature;
template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>;
template <typename Fun>
static ReturnType callSmall(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>((*static_cast<Fun*>(
static_cast<void*>(&p.tiny)))(static_cast<Args&&>(args)...));
}
template <typename Fun>
static ReturnType callBig(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>(
(*static_cast<Fun*>(p.big))(static_cast<Args&&>(args)...));
}
static ReturnType uninitCall(Data&, Args&&...) noexcept {
terminate_with<std::bad_function_call>();
}
ReturnType operator()(Args... args) noexcept {
auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> remove return static_cast<ReturnType>(detail::function::invoke(
*static_cast<Fun*>(object), static_cast<Args&&>(args)...));
</s> add using Pointer = _t<std::add_pointer<Fun>>;
return static_cast<ReturnType>(invoke(
static_cast<Fun&&>(*static_cast<Pointer>(object)),
static_cast<Args&&>(args)...)); </s> remove void* object_{nullptr};
Call call_{&FunctionRef::uninitCall};
</s> add </s> remove inline bool uninitNoop(Op, Data*, Data*) {
return false;
}
</s> add template <typename F, typename... Args>
using CallableResult = decltype(std::declval<F>()(std::declval<Args>()...));
template <
typename From,
typename To,
typename = typename std::enable_if<
!std::is_reference<To>::value || std::is_reference<From>::value>::type>
using SafeResultOf = decltype(static_cast<To>(std::declval<From>())); </s> remove template <class SynchronizedType, class LockPolicy>
class LockedGuardPtr {
private:
// CDataType is the DataType with the appropriate const-qualification
using CDataType = detail::SynchronizedDataType<SynchronizedType>;
public:
using DataType = typename SynchronizedType::DataType;
using MutexType = typename SynchronizedType::MutexType;
using Synchronized = typename std::remove_const<SynchronizedType>::type;
LockedGuardPtr() = delete;
/**
* Takes a Synchronized<T> and locks it.
*/
explicit LockedGuardPtr(SynchronizedType* parent) : parent_(parent) {
LockPolicy::lock(parent_->mutex_);
}
/**
* Destructor releases.
*/
~LockedGuardPtr() {
LockPolicy::unlock(parent_->mutex_);
}
/**
* Access the locked data.
*/
CDataType* operator->() const {
return &parent_->datum_;
}
</s> add template <typename D, typename M, typename... Args>
auto wlock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::wlock(synchronized, std::forward<Args>(args)...);
}
template <typename Data, typename Mutex, typename... Args>
auto rlock(const Synchronized<Data, Mutex>& synchronized, Args&&... args) {
return detail::rlock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto ulock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::ulock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto lock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::lock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto lock(const Synchronized<D, M>& synchronized, Args&&... args) {
return detail::lock(synchronized, std::forward<Args>(args)...);
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep replace keep keep keep replace replace keep keep keep
|
<mask> ReturnType operator()(Args... args) const {
<mask> auto& fn = *static_cast<const Function<ReturnType(Args...) const>*>(this);
<mask> return fn.call_(fn.data_, static_cast<Args&&>(args)...);
<mask> }
<mask>
<mask> struct SharedProxy {
<mask> std::shared_ptr<Function<ReturnType(Args...) const>> sp_;
<mask>
<mask> public:
<mask> explicit SharedProxy(Function<ReturnType(Args...) const>&& func)
</s> [sdk33] Update iOS with RN 0.59 </s> remove explicit SharedProxy(Function<ReturnType(Args...) const>&& func)
: sp_(std::make_shared<Function<ReturnType(Args...) const>>(
std::move(func))) {}
</s> add explicit SharedProxy(Function<NonConstSignature>&& func)
: sp_(std::make_shared<Function<NonConstSignature>>(std::move(func))) {} </s> remove auto& fn = *static_cast<Function<ReturnType(Args...)>*>(this);
</s> add auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> remove std::shared_ptr<Function<ReturnType(Args...)>> sp_;
</s> add std::shared_ptr<Function<NonConstSignature>> sp_; </s> remove explicit SharedProxy(Function<ReturnType(Args...)>&& func)
: sp_(std::make_shared<Function<ReturnType(Args...)>>(
std::move(func))) {}
</s> add explicit SharedProxy(Function<NonConstSignature>&& func)
: sp_(std::make_shared<Function<NonConstSignature>>(std::move(func))) {} </s> add constexpr explicit operator bool() const {
return object_;
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace keep keep keep keep keep
|
<mask> struct SharedProxy {
<mask> std::shared_ptr<Function<ReturnType(Args...) const>> sp_;
<mask>
<mask> public:
<mask> explicit SharedProxy(Function<ReturnType(Args...) const>&& func)
<mask> : sp_(std::make_shared<Function<ReturnType(Args...) const>>(
<mask> std::move(func))) {}
<mask> ReturnType operator()(Args&&... args) const {
<mask> return (*sp_)(static_cast<Args&&>(args)...);
<mask> }
<mask> };
<mask> };
</s> [sdk33] Update iOS with RN 0.59 </s> remove struct SharedProxy {
std::shared_ptr<Function<ReturnType(Args...) const>> sp_;
</s> add class SharedProxy {
std::shared_ptr<Function<NonConstSignature>> sp_; </s> remove explicit SharedProxy(Function<ReturnType(Args...)>&& func)
: sp_(std::make_shared<Function<ReturnType(Args...)>>(
std::move(func))) {}
</s> add explicit SharedProxy(Function<NonConstSignature>&& func)
: sp_(std::make_shared<Function<NonConstSignature>>(std::move(func))) {} </s> remove auto& fn = *static_cast<const Function<ReturnType(Args...) const>*>(this);
</s> add auto& fn = *static_cast<const Function<ConstSignature>*>(this);
return fn.call_(fn.data_, static_cast<Args&&>(args)...);
}
class SharedProxy {
std::shared_ptr<Function<ConstSignature>> sp_;
public:
explicit SharedProxy(Function<ConstSignature>&& func)
: sp_(std::make_shared<Function<ConstSignature>>(std::move(func))) {}
ReturnType operator()(Args&&... args) const {
return (*sp_)(static_cast<Args&&>(args)...);
}
};
};
#if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
struct FunctionTraits<ReturnType(Args...) noexcept> {
using Call = ReturnType (*)(Data&, Args&&...) noexcept;
using IsConst = std::false_type;
using ConstSignature = ReturnType(Args...) const noexcept;
using NonConstSignature = ReturnType(Args...) noexcept;
using OtherSignature = ConstSignature;
template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>;
template <typename Fun>
static ReturnType callSmall(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>((*static_cast<Fun*>(
static_cast<void*>(&p.tiny)))(static_cast<Args&&>(args)...));
}
template <typename Fun>
static ReturnType callBig(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>(
(*static_cast<Fun*>(p.big))(static_cast<Args&&>(args)...));
}
static ReturnType uninitCall(Data&, Args&&...) noexcept {
terminate_with<std::bad_function_call>();
}
ReturnType operator()(Args... args) noexcept {
auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> remove std::shared_ptr<Function<ReturnType(Args...)>> sp_;
</s> add std::shared_ptr<Function<NonConstSignature>> sp_; </s> remove auto& fn = *static_cast<Function<ReturnType(Args...)>*>(this);
</s> add auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> add constexpr explicit operator bool() const {
return object_;
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> FOLLY_FALLTHROUGH;
<mask> case Op::NUKE:
<mask> static_cast<Fun*>(static_cast<void*>(&src->tiny))->~Fun();
<mask> break;
<mask> case Op::FULL:
<mask> return true;
<mask> case Op::HEAP:
<mask> break;
<mask> }
<mask> return false;
<mask> }
</s> [sdk33] Update iOS with RN 0.59 </s> remove case Op::FULL:
</s> add </s> add FOLLY_FALLTHROUGH; </s> remove ++b; // accept the single 'y' character
</s> add ++b; // accept the single 'y' character </s> remove case '+':
if (mode == UriEscapeMode::QUERY) {
out.append(&*last, p - last);
out.push_back(' ');
</s> add case '+':
if (mode == UriEscapeMode::QUERY) {
out.append(&*last, size_t(p - last));
out.push_back(' ');
++p;
last = p;
break;
}
// else fallthrough
FOLLY_FALLTHROUGH;
default: </s> add FOLLY_FALLTHROUGH; </s> add FOLLY_FALLTHROUGH;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> break;
<mask> case Op::NUKE:
<mask> delete static_cast<Fun*>(src->big);
<mask> break;
<mask> case Op::FULL:
<mask> case Op::HEAP:
<mask> break;
<mask> }
<mask> return true;
<mask> }
</s> [sdk33] Update iOS with RN 0.59 </s> remove case Op::FULL:
return true;
</s> add </s> add FOLLY_FALLTHROUGH; </s> remove ++b; // accept the single 'y' character
</s> add ++b; // accept the single 'y' character </s> remove case '+':
if (mode == UriEscapeMode::QUERY) {
out.append(&*last, p - last);
out.push_back(' ');
</s> add case '+':
if (mode == UriEscapeMode::QUERY) {
out.append(&*last, size_t(p - last));
out.push_back(' ');
++p;
last = p;
break;
}
// else fallthrough
FOLLY_FALLTHROUGH;
default: </s> remove result = 10 * result + sum;
break;
}
default:
assert(b == e);
if (size == 0) {
return makeUnexpected(ConversionCode::NO_DIGITS);
</s> add case 1: {
const int32_t sum = shift1[static_cast<size_t>(b[0])];
if (sum >= OOR) {
goto outOfRange;
}
result = UT(10 * result + sum);
break; </s> remove result = 100 * result + sum;
break;
}
case 1: {
const int32_t sum = shift1[static_cast<size_t>(b[0])];
if (sum >= OOR) {
goto outOfRange;
</s> add case 2: {
const int32_t r0 = shift10[static_cast<size_t>(b[0])];
const int32_t r1 = shift1[static_cast<size_t>(b[1])];
const auto sum = r0 + r1;
if (sum >= OOR) {
goto outOfRange;
}
result = UT(100 * result + sum);
break;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask> }
<mask> return true;
<mask> }
<mask>
<mask> // Invoke helper
<mask> template <typename F, typename... Args>
<mask> inline auto invoke(F&& f, Args&&... args)
<mask> -> decltype(std::forward<F>(f)(std::forward<Args>(args)...)) {
<mask> return std::forward<F>(f)(std::forward<Args>(args)...);
<mask> }
<mask>
<mask> template <typename M, typename C, typename... Args>
<mask> inline auto invoke(M(C::*d), Args&&... args)
<mask> -> decltype(std::mem_fn(d)(std::forward<Args>(args)...)) {
<mask> return std::mem_fn(d)(std::forward<Args>(args)...);
<mask> }
<mask>
<mask> } // namespace function
<mask> } // namespace detail
<mask>
<mask> FOLLY_PUSH_WARNING
<mask> FOLLY_MSVC_DISABLE_WARNING(4521) // Multiple copy constructors
</s> [sdk33] Update iOS with RN 0.59 </s> remove template <class SynchronizedType, class LockPolicy>
class LockedGuardPtr {
private:
// CDataType is the DataType with the appropriate const-qualification
using CDataType = detail::SynchronizedDataType<SynchronizedType>;
public:
using DataType = typename SynchronizedType::DataType;
using MutexType = typename SynchronizedType::MutexType;
using Synchronized = typename std::remove_const<SynchronizedType>::type;
LockedGuardPtr() = delete;
/**
* Takes a Synchronized<T> and locks it.
*/
explicit LockedGuardPtr(SynchronizedType* parent) : parent_(parent) {
LockPolicy::lock(parent_->mutex_);
}
/**
* Destructor releases.
*/
~LockedGuardPtr() {
LockPolicy::unlock(parent_->mutex_);
}
/**
* Access the locked data.
*/
CDataType* operator->() const {
return &parent_->datum_;
}
</s> add template <typename D, typename M, typename... Args>
auto wlock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::wlock(synchronized, std::forward<Args>(args)...);
}
template <typename Data, typename Mutex, typename... Args>
auto rlock(const Synchronized<Data, Mutex>& synchronized, Args&&... args) {
return detail::rlock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto ulock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::ulock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto lock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::lock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto lock(const Synchronized<D, M>& synchronized, Args&&... args) {
return detail::lock(synchronized, std::forward<Args>(args)...);
} </s> remove inline bool uninitNoop(Op, Data*, Data*) {
return false;
}
</s> add template <typename F, typename... Args>
using CallableResult = decltype(std::declval<F>()(std::declval<Args>()...));
template <
typename From,
typename To,
typename = typename std::enable_if<
!std::is_reference<To>::value || std::is_reference<From>::value>::type>
using SafeResultOf = decltype(static_cast<To>(std::declval<From>())); </s> remove FOLLY_PUSH_WARNING
FOLLY_MSVC_DISABLE_WARNING(4521) // Multiple copy constructors
FOLLY_MSVC_DISABLE_WARNING(4522) // Multiple assignment operators
</s> add </s> remove } // detail
</s> add template <
typename Synchronized,
typename LockFunc,
typename TryLockFunc,
typename... Args>
class SynchronizedLocker {
public:
using LockedPtr = invoke_result_t<LockFunc&, Synchronized&, const Args&...>;
template <typename LockFuncType, typename TryLockFuncType, typename... As>
SynchronizedLocker(
Synchronized& sync,
LockFuncType&& lockFunc,
TryLockFuncType tryLockFunc,
As&&... as)
: synchronized{sync},
lockFunc_{std::forward<LockFuncType>(lockFunc)},
tryLockFunc_{std::forward<TryLockFuncType>(tryLockFunc)},
args_{std::forward<As>(as)...} {}
auto lock() const {
auto args = std::tuple<const Args&...>{args_};
return apply(lockFunc_, std::tuple_cat(std::tie(synchronized), args));
}
auto tryLock() const {
return tryLockFunc_(synchronized);
}
private:
Synchronized& synchronized;
LockFunc lockFunc_;
TryLockFunc tryLockFunc_;
std::tuple<Args...> args_;
};
template <
typename Synchronized,
typename LockFunc,
typename TryLockFunc,
typename... Args>
auto makeSynchronizedLocker(
Synchronized& synchronized,
LockFunc&& lockFunc,
TryLockFunc&& tryLockFunc,
Args&&... args) {
using LockFuncType = std::decay_t<LockFunc>;
using TryLockFuncType = std::decay_t<TryLockFunc>;
return SynchronizedLocker<
Synchronized,
LockFuncType,
TryLockFuncType,
std::decay_t<Args>...>{synchronized,
std::forward<LockFunc>(lockFunc),
std::forward<TryLockFunc>(tryLockFunc),
std::forward<Args>(args)...};
}
/**
* Acquire locks for multiple Synchronized<T> objects, in a deadlock-safe
* manner.
*
* The function uses the "smart and polite" algorithm from this link
* http://howardhinnant.github.io/dining_philosophers.html#Polite
*
* The gist of the algorithm is that it locks a mutex, then tries to lock the
* other mutexes in a non-blocking manner. If all the locks succeed, we are
* done, if not, we release the locks we have held, yield to allow other
* threads to continue and then block on the mutex that we failed to acquire.
*
* This allows dynamically yielding ownership of all the mutexes but one, so
* that other threads can continue doing work and locking the other mutexes.
* See the benchmarks in folly/test/SynchronizedBenchmark.cpp for more.
*/
template <typename... SynchronizedLocker>
auto lock(SynchronizedLocker... lockersIn)
-> std::tuple<typename SynchronizedLocker::LockedPtr...> {
// capture the list of lockers as a tuple
auto lockers = std::forward_as_tuple(lockersIn...);
// make a list of null LockedPtr instances that we will return to the caller
auto lockedPtrs = std::tuple<typename SynchronizedLocker::LockedPtr...>{};
// start by locking the first thing in the list
std::get<0>(lockedPtrs) = std::get<0>(lockers).lock();
auto indexLocked = 0;
while (true) {
auto couldLockAll = true;
for_each(lockers, [&](auto& locker, auto index) {
// if we should try_lock on the current locker then do so
if (index != indexLocked) {
auto lockedPtr = locker.tryLock();
// if we were unable to lock this mutex,
//
// 1. release all the locks,
// 2. yield control to another thread to be nice
// 3. block on the mutex we failed to lock, acquire the lock
// 4. break out and set the index of the current mutex to indicate
// which mutex we have locked
if (!lockedPtr) {
// writing lockedPtrs = decltype(lockedPtrs){} does not compile on
// gcc, I believe this is a bug D7676798
lockedPtrs = std::tuple<typename SynchronizedLocker::LockedPtr...>{};
std::this_thread::yield();
fetch(lockedPtrs, index) = locker.lock();
indexLocked = index;
couldLockAll = false;
return loop_break;
}
// else store the locked mutex in the list we return
fetch(lockedPtrs, index) = std::move(lockedPtr);
}
return loop_continue;
});
if (couldLockAll) {
return lockedPtrs;
}
}
}
template <typename Synchronized, typename... Args>
auto wlock(Synchronized& synchronized, Args&&... args) {
return detail::makeSynchronizedLocker(
synchronized,
[](auto& s, auto&&... a) {
return s.wlock(std::forward<decltype(a)>(a)...);
},
[](auto& s) { return s.tryWLock(); },
std::forward<Args>(args)...);
}
template <typename Synchronized, typename... Args>
auto rlock(Synchronized& synchronized, Args&&... args) {
return detail::makeSynchronizedLocker(
synchronized,
[](auto& s, auto&&... a) {
return s.rlock(std::forward<decltype(a)>(a)...);
},
[](auto& s) { return s.tryRLock(); },
std::forward<Args>(args)...);
}
template <typename Synchronized, typename... Args>
auto ulock(Synchronized& synchronized, Args&&... args) {
return detail::makeSynchronizedLocker(
synchronized,
[](auto& s, auto&&... a) {
return s.ulock(std::forward<decltype(a)>(a)...);
},
[](auto& s) { return s.tryULock(); },
std::forward<Args>(args)...);
}
template <typename Synchronized, typename... Args>
auto lock(Synchronized& synchronized, Args&&... args) {
return detail::makeSynchronizedLocker(
synchronized,
[](auto& s, auto&&... a) {
return s.lock(std::forward<decltype(a)>(a)...);
},
[](auto& s) { return s.tryLock(); },
std::forward<Args>(args)...);
}
} // namespace detail </s> remove static void enforce(
bool condition,
void (*throw_exc)(const char*),
const char* msg) {
</s> add template <typename Ex, typename... Args>
FOLLY_ALWAYS_INLINE static void enforce(bool condition, Args&&... args) { </s> remove template <typename E, typename V, typename... Args>
void throwOnFail(V&& value, Args&&... args) {
if (!value) {
throw E(std::forward<Args>(args)...);
}
}
</s> add
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace keep keep keep keep keep
|
<mask>
<mask> } // namespace function
<mask> } // namespace detail
<mask>
<mask> FOLLY_PUSH_WARNING
<mask> FOLLY_MSVC_DISABLE_WARNING(4521) // Multiple copy constructors
<mask> FOLLY_MSVC_DISABLE_WARNING(4522) // Multiple assignment operators
<mask> template <typename FunctionType>
<mask> class Function final : private detail::function::FunctionTraits<FunctionType> {
<mask> // These utility types are defined outside of the template to reduce
<mask> // the number of instantiations, and then imported in the class
<mask> // namespace for convenience.
</s> [sdk33] Update iOS with RN 0.59 </s> remove // Invoke helper
template <typename F, typename... Args>
inline auto invoke(F&& f, Args&&... args)
-> decltype(std::forward<F>(f)(std::forward<Args>(args)...)) {
return std::forward<F>(f)(std::forward<Args>(args)...);
}
template <typename M, typename C, typename... Args>
inline auto invoke(M(C::*d), Args&&... args)
-> decltype(std::mem_fn(d)(std::forward<Args>(args)...)) {
return std::mem_fn(d)(std::forward<Args>(args)...);
}
</s> add </s> remove : public IndexableTraitsSeq<small_vector<T, M, A, B, C>> {
};
</s> add : public IndexableTraitsSeq<small_vector<T, M, A, B, C>> {};
} // namespace detail </s> remove struct DefaultTag {};
</s> add </s> remove template<typename ValT, typename NodeT> class csl_iterator;
</s> add template <typename ValT, typename NodeT>
class csl_iterator; </s> remove } // namespace detail
</s> add } // namespace detail </s> remove template<typename T>
</s> add template <typename T>
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace keep keep keep keep replace keep keep keep keep
|
<mask>
<mask> template <typename Fun>
<mask> using IsSmall = detail::function::IsSmall<Fun>;
<mask>
<mask> using OtherSignature = typename Traits::OtherSignature;
<mask>
<mask> // The `data_` member is mutable to allow `constCastFunction` to work without
<mask> // invoking undefined behavior. Const-correctness is only violated when
<mask> // `FunctionType` is a const function type (e.g., `int() const`) and `*this`
<mask> // is the result of calling `constCastFunction`.
<mask> mutable Data data_;
<mask> Call call_{&Traits::uninitCall};
<mask> Exec exec_{&detail::function::uninitNoop};
<mask>
<mask> friend Traits;
</s> [sdk33] Update iOS with RN 0.59 </s> remove Exec exec_{&detail::function::uninitNoop};
</s> add Exec exec_{nullptr};
bool exec(Op o, Data* src, Data* dst) const {
return exec_ && exec_(o, src, dst);
} </s> add // Enable only if the unlock policy of the other LockPolicy is the same as
// ours
template <typename LockPolicyOther>
using EnableIfSameUnlockPolicy = std::enable_if_t<std::is_same<
typename LockPolicy::UnlockPolicy,
typename LockPolicyOther::UnlockPolicy>::value>;
// friend other LockedPtr types
template <typename SynchronizedTypeOther, typename LockPolicyOther>
friend class LockedPtr; </s> add /**
* Friend all instantiations of LockedPtr and LockedPtrBase
*/
template <typename S, typename L>
friend class folly::LockedPtr;
template <typename S, typename M, typename L>
friend class LockedPtrBase;
</s> remove friend class Function<OtherSignature>;
</s> add friend class Function<typename Traits::OtherSignature>; </s> add #elif _CPPLIB_VER
// MSVC 2015+ defines the base even if C++17 is disabled, and
// MSVC 2015 has issues with our fallback implementation due to
// over-eager evaluation of noexcept.
template <typename T>
using IsNothrowSwappable = std::_Is_nothrow_swappable<T>;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep replace keep keep keep keep replace keep keep
|
<mask> mutable Data data_;
<mask> Call call_{&Traits::uninitCall};
<mask> Exec exec_{&detail::function::uninitNoop};
<mask>
<mask> friend Traits;
<mask> friend Function<typename Traits::ConstSignature> folly::constCastFunction<>(
<mask> Function<typename Traits::NonConstSignature>&&) noexcept;
<mask> friend class Function<OtherSignature>;
<mask>
<mask> template <typename Fun>
</s> [sdk33] Update iOS with RN 0.59 </s> remove mutable Data data_;
</s> add mutable Data data_{}; </s> add /**
* Friend all instantiations of LockedPtr and LockedPtrBase
*/
template <typename S, typename L>
friend class folly::LockedPtr;
template <typename S, typename M, typename L>
friend class LockedPtrBase;
</s> remove mutable ttype cache_;
mutable bool valid_;
</s> add mutable Optional<ttype> cache_; </s> add /**
* Friend all instantiations of LockedPtr and LockedPtrBase
*/
template <typename S, typename L>
friend class folly::LockedPtr;
template <typename S, typename M, typename L>
friend class LockedPtrBase;
</s> remove template <class LockedType, class LockPolicy>
friend class folly::LockedGuardPtr;
</s> add
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace replace keep keep keep keep keep
|
<mask> call_ = &Traits::template callBig<FunT>;
<mask> exec_ = &detail::function::execBig<FunT>;
<mask> }
<mask>
<mask> Function(Function<OtherSignature>&& that, CoerceTag) noexcept {
<mask> that.exec_(Op::MOVE, &that.data_, &data_);
<mask> std::swap(call_, that.call_);
<mask> std::swap(exec_, that.exec_);
<mask> }
<mask>
<mask> public:
<mask> /**
<mask> * Default constructor. Constructs an empty Function.
</s> [sdk33] Update iOS with RN 0.59 </s> remove Function(Function&& that) noexcept {
that.exec_(Op::MOVE, &that.data_, &data_);
std::swap(call_, that.call_);
std::swap(exec_, that.exec_);
</s> add Function(Function&& that) noexcept : call_(that.call_), exec_(that.exec_) {
// that must be uninitialized before exec() call in the case of self move
that.call_ = &Traits::uninitCall;
that.exec_ = nullptr;
exec(Op::MOVE, &that.data_, &data_); </s> add void* object_{nullptr};
Call call_{&FunctionRef::uninitCall};
</s> remove return static_cast<ReturnType>(detail::function::invoke(
*static_cast<Fun*>(object), static_cast<Args&&>(args)...));
</s> add using Pointer = _t<std::add_pointer<Fun>>;
return static_cast<ReturnType>(invoke(
static_cast<Fun&&>(*static_cast<Pointer>(object)),
static_cast<Args&&>(args)...)); </s> remove bool Const = Traits::IsConst::value,
typename std::enable_if<!Const, int>::type = 0>
Function(Function<OtherSignature>&& that) noexcept
</s> add typename Signature,
typename = typename Traits::template ResultOf<Function<Signature>>>
Function(Function<Signature>&& that) noexcept(
noexcept(Function(std::move(that), CoerceTag{}))) </s> remove /**
* Default clock class used by ParameterizedDynamicTokenBucket and derived
* classes. User-defined clock classes must be steady (monotonic) and define a
* static function std::chrono::duration<> timeSinceEpoch().
*/
struct DefaultTokenBucketClock {
static auto timeSinceEpoch() noexcept
-> decltype(std::chrono::steady_clock::now().time_since_epoch()) {
return std::chrono::steady_clock::now().time_since_epoch();
}
};
</s> add </s> remove return exec_(Op::FULL, nullptr, nullptr);
</s> add return exec_ != nullptr;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep replace replace replace replace replace keep replace keep keep
|
<mask>
<mask> // not copyable
<mask> // NOTE: Deleting the non-const copy constructor is unusual but necessary to
<mask> // prevent copies from non-const `Function` object from selecting the
<mask> // perfect forwarding implicit converting constructor below
<mask> // (i.e., `template <typename Fun> Function(Fun&&)`).
<mask> Function(Function&) = delete;
<mask> Function(const Function&) = delete;
<mask> Function(const Function&&) = delete;
<mask>
<mask> /**
</s> [sdk33] Update iOS with RN 0.59 </s> remove * For moving a `Function<X(Ys..) const>` into a `Function<X(Ys...)>`.
</s> add * For move-constructing from a `folly::Function<X(Ys...) [const?]>`.
* For a `Function` with a `const` function type, the object must be
* callable from a `const`-reference, i.e. implement `operator() const`.
* For a `Function` with a non-`const` function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise. </s> remove * Constructs a new `Function` from any callable object. This
* handles function pointers, pointers to static member functions,
* `std::reference_wrapper` objects, `std::function` objects, and arbitrary
* objects that implement `operator()` if the parameter signature
* matches (i.e. it returns R when called with Args...).
* For a `Function` with a const function type, the object must be
* callable from a const-reference, i.e. implement `operator() const`.
* For a `Function` with a non-const function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise.
</s> add * Constructs a new `Function` from any callable object that is _not_ a
* `folly::Function`. This handles function pointers, pointers to static
* member functions, `std::reference_wrapper` objects, `std::function`
* objects, and arbitrary objects that implement `operator()` if the parameter
* signature matches (i.e. it returns an object convertible to `R` when called
* with `Args...`). </s> remove Function& operator=(Function&) = delete;
</s> add </s> remove exec_(Op::NUKE, &data_, nullptr);
</s> add exec(Op::NUKE, &data_, nullptr); </s> remove * \note `typename = ResultOf<Fun>` prevents this overload from being
* selected by overload resolution when `fun` is not a compatible function.
</s> add * \note `typename Traits::template ResultOf<Fun>` prevents this overload
* from being selected by overload resolution when `fun` is not a compatible
* function.
*
* \note The noexcept requires some explanation. `IsSmall` is true when the
* decayed type fits within the internal buffer and is noexcept-movable. But
* this ctor might copy, not move. What we need here, if this ctor does a
* copy, is that this ctor be noexcept when the copy is noexcept. That is not
* checked in `IsSmall`, and shouldn't be, because once the `Function` is
* constructed, the contained object is never copied. This check is for this
* ctor only, in the case that this ctor does a copy.
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace replace keep keep keep keep keep
|
<mask>
<mask> /**
<mask> * Move constructor
<mask> */
<mask> Function(Function&& that) noexcept {
<mask> that.exec_(Op::MOVE, &that.data_, &data_);
<mask> std::swap(call_, that.call_);
<mask> std::swap(exec_, that.exec_);
<mask> }
<mask>
<mask> /**
<mask> * Constructs an empty `Function`.
<mask> */
</s> [sdk33] Update iOS with RN 0.59 </s> remove Function(Function<OtherSignature>&& that, CoerceTag) noexcept {
that.exec_(Op::MOVE, &that.data_, &data_);
std::swap(call_, that.call_);
std::swap(exec_, that.exec_);
</s> add template <typename Signature>
Function(Function<Signature>&& that, CoerceTag)
: Function(static_cast<Function<Signature>&&>(that), HeapTag{}) {}
Function(Function<typename Traits::OtherSignature>&& that, CoerceTag) noexcept
: call_(that.call_), exec_(that.exec_) {
that.call_ = &Traits::uninitCall;
that.exec_ = nullptr;
exec(Op::MOVE, &that.data_, &data_); </s> remove bool Const = Traits::IsConst::value,
typename std::enable_if<!Const, int>::type = 0>
Function(Function<OtherSignature>&& that) noexcept
</s> add typename Signature,
typename = typename Traits::template ResultOf<Function<Signature>>>
Function(Function<Signature>&& that) noexcept(
noexcept(Function(std::move(that), CoerceTag{}))) </s> remove Function(const Function&&) = delete;
</s> add #if __OBJC__
// Make sure Objective C blocks are copied
template <class ReturnType, class... Args>
/*implicit*/ Function(ReturnType (^objCBlock)(Args... args))
: Function([blockCopy = (ReturnType(^)(Args...))[objCBlock copy]](
Args... args) { return blockCopy(args...); }){};
#endif </s> add /**
* For assigning from a `Function<X(Ys..) [const?]>`.
*/
template <
typename Signature,
typename = typename Traits::template ResultOf<Function<Signature>>>
Function& operator=(Function<Signature>&& that) noexcept(
noexcept(Function(std::move(that)))) {
return (*this = Function(std::move(that)));
}
</s> add void* object_{nullptr};
Call call_{&FunctionRef::uninitCall};
</s> remove return static_cast<ReturnType>(detail::function::invoke(
*static_cast<Fun*>(object), static_cast<Args&&>(args)...));
</s> add using Pointer = _t<std::add_pointer<Fun>>;
return static_cast<ReturnType>(invoke(
static_cast<Fun&&>(*static_cast<Pointer>(object)),
static_cast<Args&&>(args)...));
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep replace replace replace replace replace replace replace replace replace replace replace keep replace replace keep
|
<mask> /* implicit */ Function(std::nullptr_t) noexcept {}
<mask>
<mask> /**
<mask> * Constructs a new `Function` from any callable object. This
<mask> * handles function pointers, pointers to static member functions,
<mask> * `std::reference_wrapper` objects, `std::function` objects, and arbitrary
<mask> * objects that implement `operator()` if the parameter signature
<mask> * matches (i.e. it returns R when called with Args...).
<mask> * For a `Function` with a const function type, the object must be
<mask> * callable from a const-reference, i.e. implement `operator() const`.
<mask> * For a `Function` with a non-const function type, the object will
<mask> * be called from a non-const reference, which means that it will execute
<mask> * a non-const `operator()` if it is defined, and falls back to
<mask> * `operator() const` otherwise.
<mask> *
<mask> * \note `typename = ResultOf<Fun>` prevents this overload from being
<mask> * selected by overload resolution when `fun` is not a compatible function.
<mask> */
</s> [sdk33] Update iOS with RN 0.59 </s> remove * For moving a `Function<X(Ys..) const>` into a `Function<X(Ys...)>`.
</s> add * For move-constructing from a `folly::Function<X(Ys...) [const?]>`.
* For a `Function` with a `const` function type, the object must be
* callable from a `const`-reference, i.e. implement `operator() const`.
* For a `Function` with a non-`const` function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise. </s> remove * \note `typename = ResultOf<Fun>` prevents this overload from being
* selected by overload resolution when `fun` is not a compatible function.
</s> add * \note `typename = decltype(Function(std::declval<Fun>()))` prevents this
* overload from being selected by overload resolution when `fun` is not a
* compatible function. </s> remove template <class Fun, typename = typename Traits::template ResultOf<Fun>>
/* implicit */ Function(Fun&& fun) noexcept(IsSmall<Fun>::value)
: Function(static_cast<Fun&&>(fun), IsSmall<Fun>{}) {}
</s> add template <
typename Fun,
typename = detail::function::EnableIfNotFunction<Fun>,
typename = typename Traits::template ResultOf<Fun>>
/* implicit */ Function(Fun fun) noexcept(
IsSmall<Fun>::value&& noexcept(Fun(std::declval<Fun>())))
: Function(std::move(fun), IsSmall<Fun>{}) {} </s> remove template <class Fun, typename = typename Traits::template ResultOf<Fun>>
Function& operator=(Fun&& fun) noexcept(
</s> add template <typename Fun, typename = decltype(Function(std::declval<Fun>()))>
Function& operator=(Fun fun) noexcept( </s> remove * Holds a type T, in addition to enough padding to round the size up to the
* next multiple of the false sharing range used by folly.
*
* If T is standard-layout, then casting a T* you get from this class to a
* CachelinePadded<T>* is safe.
*
* This class handles padding, but imperfectly handles alignment. (Note that
* alignment matters for false-sharing: imagine a cacheline size of 64, and two
* adjacent 64-byte objects, with the first starting at an offset of 32. The
* last 32 bytes of the first object share a cacheline with the first 32 bytes
* of the second.). We alignas this class to be at least cacheline-sized, but
* it's implementation-defined what that means (since a cacheline is almost
* certainly larger than the maximum natural alignment). The following should be
* true for recent compilers on common architectures:
*
* For heap objects, alignment needs to be handled at the allocator level, such
* as with posix_memalign (this isn't necessary with jemalloc, which aligns
* objects that are a multiple of cacheline size to a cacheline).
</s> add * Holds a type T, in addition to enough padding to ensure that it isn't subject
* to false sharing within the range used by folly.
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep replace replace replace keep keep replace keep keep
|
<mask> */
<mask> template <class Fun, typename = typename Traits::template ResultOf<Fun>>
<mask> /* implicit */ Function(Fun&& fun) noexcept(IsSmall<Fun>::value)
<mask> : Function(static_cast<Fun&&>(fun), IsSmall<Fun>{}) {}
<mask>
<mask> /**
<mask> * For moving a `Function<X(Ys..) const>` into a `Function<X(Ys...)>`.
<mask> */
<mask> template <
</s> [sdk33] Update iOS with RN 0.59 </s> remove bool Const = Traits::IsConst::value,
typename std::enable_if<!Const, int>::type = 0>
Function(Function<OtherSignature>&& that) noexcept
</s> add typename Signature,
typename = typename Traits::template ResultOf<Function<Signature>>>
Function(Function<Signature>&& that) noexcept(
noexcept(Function(std::move(that), CoerceTag{}))) </s> remove template <class Fun, typename = typename Traits::template ResultOf<Fun>>
Function& operator=(Fun&& fun) noexcept(
</s> add template <typename Fun, typename = decltype(Function(std::declval<Fun>()))>
Function& operator=(Fun fun) noexcept( </s> add /**
* For assigning from a `Function<X(Ys..) [const?]>`.
*/
template <
typename Signature,
typename = typename Traits::template ResultOf<Function<Signature>>>
Function& operator=(Function<Signature>&& that) noexcept(
noexcept(Function(std::move(that)))) {
return (*this = Function(std::move(that)));
}
</s> remove * \note `typename = ResultOf<Fun>` prevents this overload from being
* selected by overload resolution when `fun` is not a compatible function.
</s> add * \note `typename Traits::template ResultOf<Fun>` prevents this overload
* from being selected by overload resolution when `fun` is not a compatible
* function.
*
* \note The noexcept requires some explanation. `IsSmall` is true when the
* decayed type fits within the internal buffer and is noexcept-movable. But
* this ctor might copy, not move. What we need here, if this ctor does a
* copy, is that this ctor be noexcept when the copy is noexcept. That is not
* checked in `IsSmall`, and shouldn't be, because once the `Function` is
* constructed, the contained object is never copied. This check is for this
* ctor only, in the case that this ctor does a copy. </s> remove * \note `typename = ResultOf<Fun>` prevents this overload from being
* selected by overload resolution when `fun` is not a compatible function.
</s> add * \note `typename = decltype(Function(std::declval<Fun>()))` prevents this
* overload from being selected by overload resolution when `fun` is not a
* compatible function.
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace keep keep keep keep keep
|
<mask> /**
<mask> * For moving a `Function<X(Ys..) const>` into a `Function<X(Ys...)>`.
<mask> */
<mask> template <
<mask> bool Const = Traits::IsConst::value,
<mask> typename std::enable_if<!Const, int>::type = 0>
<mask> Function(Function<OtherSignature>&& that) noexcept
<mask> : Function(std::move(that), CoerceTag{}) {}
<mask>
<mask> /**
<mask> * If `ptr` is null, constructs an empty `Function`. Otherwise,
<mask> * this constructor is equivalent to `Function(std::mem_fn(ptr))`.
</s> [sdk33] Update iOS with RN 0.59 </s> remove * For moving a `Function<X(Ys..) const>` into a `Function<X(Ys...)>`.
</s> add * For move-constructing from a `folly::Function<X(Ys...) [const?]>`.
* For a `Function` with a `const` function type, the object must be
* callable from a `const`-reference, i.e. implement `operator() const`.
* For a `Function` with a non-`const` function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise. </s> remove template <class Fun, typename = typename Traits::template ResultOf<Fun>>
/* implicit */ Function(Fun&& fun) noexcept(IsSmall<Fun>::value)
: Function(static_cast<Fun&&>(fun), IsSmall<Fun>{}) {}
</s> add template <
typename Fun,
typename = detail::function::EnableIfNotFunction<Fun>,
typename = typename Traits::template ResultOf<Fun>>
/* implicit */ Function(Fun fun) noexcept(
IsSmall<Fun>::value&& noexcept(Fun(std::declval<Fun>())))
: Function(std::move(fun), IsSmall<Fun>{}) {} </s> add /**
* For assigning from a `Function<X(Ys..) [const?]>`.
*/
template <
typename Signature,
typename = typename Traits::template ResultOf<Function<Signature>>>
Function& operator=(Function<Signature>&& that) noexcept(
noexcept(Function(std::move(that)))) {
return (*this = Function(std::move(that)));
}
</s> remove Function(Function&& that) noexcept {
that.exec_(Op::MOVE, &that.data_, &data_);
std::swap(call_, that.call_);
std::swap(exec_, that.exec_);
</s> add Function(Function&& that) noexcept : call_(that.call_), exec_(that.exec_) {
// that must be uninitialized before exec() call in the case of self move
that.call_ = &Traits::uninitCall;
that.exec_ = nullptr;
exec(Op::MOVE, &that.data_, &data_); </s> remove * \note `typename = ResultOf<Fun>` prevents this overload from being
* selected by overload resolution when `fun` is not a compatible function.
</s> add * \note `typename = decltype(Function(std::declval<Fun>()))` prevents this
* overload from being selected by overload resolution when `fun` is not a
* compatible function. </s> remove Function(Function<OtherSignature>&& that, CoerceTag) noexcept {
that.exec_(Op::MOVE, &that.data_, &data_);
std::swap(call_, that.call_);
std::swap(exec_, that.exec_);
</s> add template <typename Signature>
Function(Function<Signature>&& that, CoerceTag)
: Function(static_cast<Function<Signature>&&>(that), HeapTag{}) {}
Function(Function<typename Traits::OtherSignature>&& that, CoerceTag) noexcept
: call_(that.call_), exec_(that.exec_) {
that.call_ = &Traits::uninitCall;
that.exec_ = nullptr;
exec(Op::MOVE, &that.data_, &data_);
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace keep keep replace
|
<mask> }
<mask> }
<mask>
<mask> ~Function() {
<mask> exec_(Op::NUKE, &data_, nullptr);
<mask> }
<mask>
<mask> Function& operator=(Function&) = delete;
</s> [sdk33] Update iOS with RN 0.59 </s> remove value_type *operator->() {
</s> add value_type* operator->() { </s> remove BenchmarkSuspender(const BenchmarkSuspender &) = delete;
BenchmarkSuspender(BenchmarkSuspender && rhs) noexcept {
</s> add BenchmarkSuspender(const BenchmarkSuspender&) = delete;
BenchmarkSuspender(BenchmarkSuspender&& rhs) noexcept { </s> remove }
</s> add } // namespace detail </s> remove value_type &operator *() const {
</s> add value_type& operator*() const { </s> add /**
* For assigning from a `Function<X(Ys..) [const?]>`.
*/
template <
typename Signature,
typename = typename Traits::template ResultOf<Function<Signature>>>
Function& operator=(Function<Signature>&& that) noexcept(
noexcept(Function(std::move(that)))) {
return (*this = Function(std::move(that)));
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep add keep keep keep keep keep
|
<mask>
<mask> Function& operator=(const Function&) = delete;
<mask>
<mask> /**
<mask> * Move assignment operator
<mask> *
<mask> * \note Leaves `that` in a valid but unspecified state. If `&that == this`
<mask> * then `*this` is left in a valid but unspecified state.
</s> [sdk33] Update iOS with RN 0.59 </s> add *
* \note Leaves `that` in a valid but unspecified state. If `&that == this`
* then `*this` is left in a valid but unspecified state. </s> remove Function& operator=(Function&) = delete;
</s> add </s> remove if (&that != this) {
// Q: Why is is safe to destroy and reconstruct this object in place?
// A: Two reasons: First, `Function` is a final class, so in doing this
// we aren't slicing off any derived parts. And second, the move
// operation is guaranteed not to throw so we always leave the object
// in a valid state.
this->~Function();
::new (this) Function(std::move(that));
}
</s> add // Q: Why is it safe to destroy and reconstruct this object in place?
// A: Two reasons: First, `Function` is a final class, so in doing this
// we aren't slicing off any derived parts. And second, the move
// operation is guaranteed not to throw so we always leave the object
// in a valid state.
// In the case of self-move (this == &that), this leaves the object in
// a default-constructed state. First the object is destroyed, then we
// pass the destroyed object to the move constructor. The first thing the
// move constructor does is default-construct the object. That object is
// "moved" into itself, which is a no-op for a default-constructed Function.
this->~Function();
::new (this) Function(std::move(that)); </s> remove parent_to_pass_on);
</s> add exchange(this->parent_, nullptr)); </s> remove parent_to_pass_on);
</s> add exchange(this->parent_, nullptr)); </s> remove parent_to_pass_on);
</s> add exchange(this->parent_, nullptr));
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep add keep keep keep keep keep
|
<mask>
<mask> /**
<mask> * Move assignment operator
<mask> */
<mask> Function& operator=(Function&& that) noexcept {
<mask> // Q: Why is it safe to destroy and reconstruct this object in place?
<mask> // A: Two reasons: First, `Function` is a final class, so in doing this
<mask> // we aren't slicing off any derived parts. And second, the move
</s> [sdk33] Update iOS with RN 0.59 </s> remove if (&that != this) {
// Q: Why is is safe to destroy and reconstruct this object in place?
// A: Two reasons: First, `Function` is a final class, so in doing this
// we aren't slicing off any derived parts. And second, the move
// operation is guaranteed not to throw so we always leave the object
// in a valid state.
this->~Function();
::new (this) Function(std::move(that));
}
</s> add // Q: Why is it safe to destroy and reconstruct this object in place?
// A: Two reasons: First, `Function` is a final class, so in doing this
// we aren't slicing off any derived parts. And second, the move
// operation is guaranteed not to throw so we always leave the object
// in a valid state.
// In the case of self-move (this == &that), this leaves the object in
// a default-constructed state. First the object is destroyed, then we
// pass the destroyed object to the move constructor. The first thing the
// move constructor does is default-construct the object. That object is
// "moved" into itself, which is a no-op for a default-constructed Function.
this->~Function();
::new (this) Function(std::move(that)); </s> remove ::new (this) Function(static_cast<Fun&&>(fun));
</s> add ::new (this) Function(std::move(fun)); </s> remove template <class Fun, typename = typename Traits::template ResultOf<Fun>>
Function& operator=(Fun&& fun) noexcept(
</s> add template <typename Fun, typename = decltype(Function(std::declval<Fun>()))>
Function& operator=(Fun fun) noexcept( </s> remove * \note `typename = ResultOf<Fun>` prevents this overload from being
* selected by overload resolution when `fun` is not a compatible function.
</s> add * \note `typename = decltype(Function(std::declval<Fun>()))` prevents this
* overload from being selected by overload resolution when `fun` is not a
* compatible function. </s> remove Function& operator=(Function&) = delete;
</s> add </s> remove return exec_(Op::FULL, nullptr, nullptr);
</s> add return exec_ != nullptr;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask> /**
<mask> * Move assignment operator
<mask> */
<mask> Function& operator=(Function&& that) noexcept {
<mask> if (&that != this) {
<mask> // Q: Why is is safe to destroy and reconstruct this object in place?
<mask> // A: Two reasons: First, `Function` is a final class, so in doing this
<mask> // we aren't slicing off any derived parts. And second, the move
<mask> // operation is guaranteed not to throw so we always leave the object
<mask> // in a valid state.
<mask> this->~Function();
<mask> ::new (this) Function(std::move(that));
<mask> }
<mask> return *this;
<mask> }
<mask>
<mask> /**
<mask> * Assigns a callable object to this `Function`. If the operation fails,
</s> [sdk33] Update iOS with RN 0.59 </s> add *
* \note Leaves `that` in a valid but unspecified state. If `&that == this`
* then `*this` is left in a valid but unspecified state. </s> remove ::new (this) Function(static_cast<Fun&&>(fun));
</s> add ::new (this) Function(std::move(fun)); </s> remove template <class Fun, typename = typename Traits::template ResultOf<Fun>>
Function& operator=(Fun&& fun) noexcept(
</s> add template <typename Fun, typename = decltype(Function(std::declval<Fun>()))>
Function& operator=(Fun fun) noexcept( </s> remove * \note `typename = ResultOf<Fun>` prevents this overload from being
* selected by overload resolution when `fun` is not a compatible function.
</s> add * \note `typename = decltype(Function(std::declval<Fun>()))` prevents this
* overload from being selected by overload resolution when `fun` is not a
* compatible function. </s> add #if __OBJC__
// Make sure Objective C blocks are copied
template <class ReturnType, class... Args>
/* implicit */ Function& operator=(ReturnType (^objCBlock)(Args... args)) {
(*this) = [blockCopy = (ReturnType(^)(Args...))[objCBlock copy]](
Args... args) { return blockCopy(args...); };
return *this;
}
#endif
</s> remove return exec_(Op::FULL, nullptr, nullptr);
</s> add return exec_ != nullptr;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep replace replace keep replace replace
|
<mask> *
<mask> * \note `typename = ResultOf<Fun>` prevents this overload from being
<mask> * selected by overload resolution when `fun` is not a compatible function.
<mask> */
<mask> template <class Fun, typename = typename Traits::template ResultOf<Fun>>
<mask> Function& operator=(Fun&& fun) noexcept(
</s> [sdk33] Update iOS with RN 0.59 </s> remove template <class Fun, typename = typename Traits::template ResultOf<Fun>>
/* implicit */ Function(Fun&& fun) noexcept(IsSmall<Fun>::value)
: Function(static_cast<Fun&&>(fun), IsSmall<Fun>{}) {}
</s> add template <
typename Fun,
typename = detail::function::EnableIfNotFunction<Fun>,
typename = typename Traits::template ResultOf<Fun>>
/* implicit */ Function(Fun fun) noexcept(
IsSmall<Fun>::value&& noexcept(Fun(std::declval<Fun>())))
: Function(std::move(fun), IsSmall<Fun>{}) {} </s> remove * \note `typename = ResultOf<Fun>` prevents this overload from being
* selected by overload resolution when `fun` is not a compatible function.
</s> add * \note `typename Traits::template ResultOf<Fun>` prevents this overload
* from being selected by overload resolution when `fun` is not a compatible
* function.
*
* \note The noexcept requires some explanation. `IsSmall` is true when the
* decayed type fits within the internal buffer and is noexcept-movable. But
* this ctor might copy, not move. What we need here, if this ctor does a
* copy, is that this ctor be noexcept when the copy is noexcept. That is not
* checked in `IsSmall`, and shouldn't be, because once the `Function` is
* constructed, the contained object is never copied. This check is for this
* ctor only, in the case that this ctor does a copy. </s> remove * Constructs a new `Function` from any callable object. This
* handles function pointers, pointers to static member functions,
* `std::reference_wrapper` objects, `std::function` objects, and arbitrary
* objects that implement `operator()` if the parameter signature
* matches (i.e. it returns R when called with Args...).
* For a `Function` with a const function type, the object must be
* callable from a const-reference, i.e. implement `operator() const`.
* For a `Function` with a non-const function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise.
</s> add * Constructs a new `Function` from any callable object that is _not_ a
* `folly::Function`. This handles function pointers, pointers to static
* member functions, `std::reference_wrapper` objects, `std::function`
* objects, and arbitrary objects that implement `operator()` if the parameter
* signature matches (i.e. it returns an object convertible to `R` when called
* with `Args...`). </s> add /**
* For assigning from a `Function<X(Ys..) [const?]>`.
*/
template <
typename Signature,
typename = typename Traits::template ResultOf<Function<Signature>>>
Function& operator=(Function<Signature>&& that) noexcept(
noexcept(Function(std::move(that)))) {
return (*this = Function(std::move(that)));
}
</s> remove bool Const = Traits::IsConst::value,
typename std::enable_if<!Const, int>::type = 0>
Function(Function<OtherSignature>&& that) noexcept
</s> add typename Signature,
typename = typename Traits::template ResultOf<Function<Signature>>>
Function(Function<Signature>&& that) noexcept(
noexcept(Function(std::move(that), CoerceTag{})))
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep replace keep keep replace keep keep keep
|
<mask> // Q: Why is is safe to destroy and reconstruct this object in place?
<mask> // A: See the explanation in the move assignment operator.
<mask> this->~Function();
<mask> ::new (this) Function(static_cast<Fun&&>(fun));
<mask> } else {
<mask> // Construct a temporary and (nothrow) swap.
<mask> Function(static_cast<Fun&&>(fun)).swap(*this);
<mask> }
<mask> return *this;
<mask> }
</s> [sdk33] Update iOS with RN 0.59 </s> remove if (&that != this) {
// Q: Why is is safe to destroy and reconstruct this object in place?
// A: Two reasons: First, `Function` is a final class, so in doing this
// we aren't slicing off any derived parts. And second, the move
// operation is guaranteed not to throw so we always leave the object
// in a valid state.
this->~Function();
::new (this) Function(std::move(that));
}
</s> add // Q: Why is it safe to destroy and reconstruct this object in place?
// A: Two reasons: First, `Function` is a final class, so in doing this
// we aren't slicing off any derived parts. And second, the move
// operation is guaranteed not to throw so we always leave the object
// in a valid state.
// In the case of self-move (this == &that), this leaves the object in
// a default-constructed state. First the object is destroyed, then we
// pass the destroyed object to the move constructor. The first thing the
// move constructor does is default-construct the object. That object is
// "moved" into itself, which is a no-op for a default-constructed Function.
this->~Function();
::new (this) Function(std::move(that)); </s> remove template <class Fun, typename = typename Traits::template ResultOf<Fun>>
Function& operator=(Fun&& fun) noexcept(
</s> add template <typename Fun, typename = decltype(Function(std::declval<Fun>()))>
Function& operator=(Fun fun) noexcept( </s> add *
* \note Leaves `that` in a valid but unspecified state. If `&that == this`
* then `*this` is left in a valid but unspecified state. </s> remove * Move assignment operator, only assigns the data, NOT the
* mutex. It locks the two objects in ascending order of their
* addresses.
</s> add * Move assignment operator; deprecated
*
* Takes an exclusive lock on the destination mutex while move-assigning the
* destination data from the source data. The source mutex is not locked or
* otherwise accessed.
*
* Semantically, assumes that the source object is a true rvalue and therefore
* that no synchronization is required for accessing it. </s> remove fbstring class_name() const {
if (item_) {
auto& i = *item_;
return demangle(typeid(i));
} else if (eptr_) {
return ename_;
} else {
return fbstring();
}
}
</s> add template <class Fn>
struct arg_type_;
template <class Fn>
using arg_type = _t<arg_type_<Fn>>;
// exception_wrapper is implemented as a simple variant over four
// different representations:
// 0. Empty, no exception.
// 1. An small object stored in-situ.
// 2. A larger object stored on the heap and referenced with a
// std::shared_ptr.
// 3. A std::exception_ptr, together with either:
// a. A pointer to the referenced std::exception object, or
// b. A pointer to a std::type_info object for the referenced exception,
// or for an unspecified type if the type is unknown.
// This is accomplished with the help of a union and a pointer to a hand-
// rolled virtual table. This virtual table contains pointers to functions
// that know which field of the union is active and do the proper action.
// The class invariant ensures that the vtable ptr and the union stay in sync.
struct VTable {
void (*copy_)(exception_wrapper const*, exception_wrapper*);
void (*move_)(exception_wrapper*, exception_wrapper*);
void (*delete_)(exception_wrapper*);
void (*throw_)(exception_wrapper const*);
std::type_info const* (*type_)(exception_wrapper const*);
std::exception const* (*get_exception_)(exception_wrapper const*);
exception_wrapper (*get_exception_ptr_)(exception_wrapper const*);
};
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep add keep keep keep keep
|
<mask> return *this;
<mask> }
<mask>
<mask> /**
<mask> * Clears this `Function`.
<mask> */
<mask> Function& operator=(std::nullptr_t) noexcept {
</s> [sdk33] Update iOS with RN 0.59 </s> remove Function(Function&& that) noexcept {
that.exec_(Op::MOVE, &that.data_, &data_);
std::swap(call_, that.call_);
std::swap(exec_, that.exec_);
</s> add Function(Function&& that) noexcept : call_(that.call_), exec_(that.exec_) {
// that must be uninitialized before exec() call in the case of self move
that.call_ = &Traits::uninitCall;
that.exec_ = nullptr;
exec(Op::MOVE, &that.data_, &data_); </s> remove Function& operator=(Function&) = delete;
</s> add </s> remove ParameterizedDynamicTokenBucket& operator=(
const ParameterizedDynamicTokenBucket& other) noexcept {
</s> add BasicDynamicTokenBucket& operator=(
const BasicDynamicTokenBucket& other) noexcept { </s> remove if (parent_) {
LockPolicy::unlock(parent_->mutex_);
}
</s> add assignImpl(*this, rhs);
return *this;
} </s> add #if __OBJC__
// Make sure Objective C blocks are copied
template <class ReturnType, class... Args>
/* implicit */ Function& operator=(ReturnType (^objCBlock)(Args... args)) {
(*this) = [blockCopy = (ReturnType(^)(Args...))[objCBlock copy]](
Args... args) { return blockCopy(args...); };
return *this;
}
#endif
</s> remove lock_ = std::move(rhs.lock_);
parent_ = rhs.parent_;
rhs.parent_ = nullptr;
</s> add assignImpl(*this, rhs);
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> * Returns `true` if this `Function` contains a callable, i.e. is
<mask> * non-empty.
<mask> */
<mask> explicit operator bool() const noexcept {
<mask> return exec_(Op::FULL, nullptr, nullptr);
<mask> }
<mask>
<mask> /**
<mask> * Returns `true` if this `Function` stores the callable on the
<mask> * heap. If `false` is returned, there has been no additional memory
</s> [sdk33] Update iOS with RN 0.59 </s> remove return exec_(Op::HEAP, nullptr, nullptr);
</s> add return exec(Op::HEAP, nullptr, nullptr); </s> remove * Constructs a new `Function` from any callable object. This
* handles function pointers, pointers to static member functions,
* `std::reference_wrapper` objects, `std::function` objects, and arbitrary
* objects that implement `operator()` if the parameter signature
* matches (i.e. it returns R when called with Args...).
* For a `Function` with a const function type, the object must be
* callable from a const-reference, i.e. implement `operator() const`.
* For a `Function` with a non-const function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise.
</s> add * Constructs a new `Function` from any callable object that is _not_ a
* `folly::Function`. This handles function pointers, pointers to static
* member functions, `std::reference_wrapper` objects, `std::function`
* objects, and arbitrary objects that implement `operator()` if the parameter
* signature matches (i.e. it returns an object convertible to `R` when called
* with `Args...`). </s> add *
* \note Leaves `that` in a valid but unspecified state. If `&that == this`
* then `*this` is left in a valid but unspecified state. </s> remove if (&that != this) {
// Q: Why is is safe to destroy and reconstruct this object in place?
// A: Two reasons: First, `Function` is a final class, so in doing this
// we aren't slicing off any derived parts. And second, the move
// operation is guaranteed not to throw so we always leave the object
// in a valid state.
this->~Function();
::new (this) Function(std::move(that));
}
</s> add // Q: Why is it safe to destroy and reconstruct this object in place?
// A: Two reasons: First, `Function` is a final class, so in doing this
// we aren't slicing off any derived parts. And second, the move
// operation is guaranteed not to throw so we always leave the object
// in a valid state.
// In the case of self-move (this == &that), this leaves the object in
// a default-constructed state. First the object is destroyed, then we
// pass the destroyed object to the move constructor. The first thing the
// move constructor does is default-construct the object. That object is
// "moved" into itself, which is a no-op for a default-constructed Function.
this->~Function();
::new (this) Function(std::move(that)); </s> remove * For moving a `Function<X(Ys..) const>` into a `Function<X(Ys...)>`.
</s> add * For move-constructing from a `folly::Function<X(Ys...) [const?]>`.
* For a `Function` with a `const` function type, the object must be
* callable from a `const`-reference, i.e. implement `operator() const`.
* For a `Function` with a non-`const` function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise. </s> add /**
* Attempts to acquire the lock in exclusive mode. If acquisition is
* unsuccessful, the returned LockedPtr will be null.
*
* (Use LockedPtr::operator bool() or LockedPtr::isNull() to check for
* validity.)
*/
TryLockedPtr tryLock() {
return TryLockedPtr{static_cast<Subclass*>(this)};
}
ConstTryLockedPtr tryLock() const {
return ConstTryLockedPtr{static_cast<const Subclass*>(this)};
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> * allocation and the callable is stored inside the `Function`
<mask> * object itself.
<mask> */
<mask> bool hasAllocatedMemory() const noexcept {
<mask> return exec_(Op::HEAP, nullptr, nullptr);
<mask> }
<mask>
<mask> using typename Traits::SharedProxy;
<mask>
<mask> /**
</s> [sdk33] Update iOS with RN 0.59 </s> remove return exec_(Op::FULL, nullptr, nullptr);
</s> add return exec_ != nullptr; </s> add /**
* Implementation for the assignment operator
*/
template <typename LockPolicyLhs, typename LockPolicyRhs>
void assignImpl(
LockedPtrBase<SynchronizedType, Mutex, LockPolicyLhs>& lhs,
LockedPtrBase<SynchronizedType, Mutex, LockPolicyRhs>& rhs) noexcept {
if (lhs.parent_) {
LockPolicy::unlock(lhs.parent_->mutex_);
}
lhs.parent_ = exchange(rhs.parent_, nullptr);
}
</s> remove * Constructs a new `Function` from any callable object. This
* handles function pointers, pointers to static member functions,
* `std::reference_wrapper` objects, `std::function` objects, and arbitrary
* objects that implement `operator()` if the parameter signature
* matches (i.e. it returns R when called with Args...).
* For a `Function` with a const function type, the object must be
* callable from a const-reference, i.e. implement `operator() const`.
* For a `Function` with a non-const function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise.
</s> add * Constructs a new `Function` from any callable object that is _not_ a
* `folly::Function`. This handles function pointers, pointers to static
* member functions, `std::reference_wrapper` objects, `std::function`
* objects, and arbitrary objects that implement `operator()` if the parameter
* signature matches (i.e. it returns an object convertible to `R` when called
* with `Args...`). </s> remove * For moving a `Function<X(Ys..) const>` into a `Function<X(Ys...)>`.
</s> add * For move-constructing from a `folly::Function<X(Ys...) [const?]>`.
* For a `Function` with a `const` function type, the object must be
* callable from a `const`-reference, i.e. implement `operator() const`.
* For a `Function` with a non-`const` function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise. </s> remove if (&that != this) {
// Q: Why is is safe to destroy and reconstruct this object in place?
// A: Two reasons: First, `Function` is a final class, so in doing this
// we aren't slicing off any derived parts. And second, the move
// operation is guaranteed not to throw so we always leave the object
// in a valid state.
this->~Function();
::new (this) Function(std::move(that));
}
</s> add // Q: Why is it safe to destroy and reconstruct this object in place?
// A: Two reasons: First, `Function` is a final class, so in doing this
// we aren't slicing off any derived parts. And second, the move
// operation is guaranteed not to throw so we always leave the object
// in a valid state.
// In the case of self-move (this == &that), this leaves the object in
// a default-constructed state. First the object is destroyed, then we
// pass the destroyed object to the move constructor. The first thing the
// move constructor does is default-construct the object. That object is
// "moved" into itself, which is a no-op for a default-constructed Function.
this->~Function();
::new (this) Function(std::move(that)); </s> remove template <typename Fun>
/* implicit */ FunctionRef(Fun&& fun) noexcept {
using ReferencedType = typename std::remove_reference<Fun>::type;
static_assert(
std::is_convertible<
typename std::result_of<ReferencedType&(Args && ...)>::type,
ReturnType>::value,
"FunctionRef cannot be constructed from object with "
"incompatible function signature");
// `Fun` may be a const type, in which case we have to do a const_cast
// to store the address in a `void*`. This is safe because the `void*`
// will be cast back to `Fun*` (which is a const pointer whenever `Fun`
// is a const type) inside `FunctionRef::call`
object_ = const_cast<void*>(static_cast<void const*>(std::addressof(fun)));
call_ = &FunctionRef::call<ReferencedType>;
}
</s> add template <
typename Fun,
typename std::enable_if<
Conjunction<
Negation<std::is_same<FunctionRef, _t<std::decay<Fun>>>>,
is_invocable_r<ReturnType, Fun&&, Args&&...>>::value,
int>::type = 0>
constexpr /* implicit */ FunctionRef(Fun&& fun) noexcept
// `Fun` may be a const type, in which case we have to do a const_cast
// to store the address in a `void*`. This is safe because the `void*`
// will be cast back to `Fun*` (which is a const pointer whenever `Fun`
// is a const type) inside `FunctionRef::call`
: object_(
const_cast<void*>(static_cast<void const*>(std::addressof(fun)))),
call_(&FunctionRef::call<Fun>) {}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> std::function<typename Traits::NonConstSignature> asStdFunction() && {
<mask> return std::move(*this).asSharedProxy();
<mask> }
<mask> };
<mask> FOLLY_POP_WARNING
<mask>
<mask> template <typename FunctionType>
<mask> void swap(Function<FunctionType>& lhs, Function<FunctionType>& rhs) noexcept {
<mask> lhs.swap(rhs);
<mask> }
</s> [sdk33] Update iOS with RN 0.59 </s> add /**
* Implementation for the assignment operator
*/
template <typename LockPolicyLhs, typename LockPolicyRhs>
void assignImpl(
LockedPtrBase<SynchronizedType, Mutex, LockPolicyLhs>& lhs,
LockedPtrBase<SynchronizedType, Mutex, LockPolicyRhs>& rhs) noexcept {
if (lhs.parent_) {
LockPolicy::unlock(lhs.parent_->mutex_);
}
lhs.parent_ = exchange(rhs.parent_, nullptr);
}
</s> remove LockedPtrBase(LockedPtrBase&& rhs) noexcept : parent_(rhs.parent_) {
rhs.parent_ = nullptr;
}
</s> add LockedPtrBase(LockedPtrBase&& rhs) noexcept
: parent_{exchange(rhs.parent_, nullptr)} {} </s> remove BenchmarkSuspender(const BenchmarkSuspender &) = delete;
BenchmarkSuspender(BenchmarkSuspender && rhs) noexcept {
</s> add BenchmarkSuspender(const BenchmarkSuspender&) = delete;
BenchmarkSuspender(BenchmarkSuspender&& rhs) noexcept { </s> remove if (parent_) {
LockPolicy::unlock(parent_->mutex_);
}
</s> add assignImpl(*this, rhs);
return *this;
} </s> remove auto& fn = *static_cast<const Function<ReturnType(Args...) const>*>(this);
</s> add auto& fn = *static_cast<const Function<ConstSignature>*>(this);
return fn.call_(fn.data_, static_cast<Args&&>(args)...);
}
class SharedProxy {
std::shared_ptr<Function<ConstSignature>> sp_;
public:
explicit SharedProxy(Function<ConstSignature>&& func)
: sp_(std::make_shared<Function<ConstSignature>>(std::move(func))) {}
ReturnType operator()(Args&&... args) const {
return (*sp_)(static_cast<Args&&>(args)...);
}
};
};
#if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
struct FunctionTraits<ReturnType(Args...) noexcept> {
using Call = ReturnType (*)(Data&, Args&&...) noexcept;
using IsConst = std::false_type;
using ConstSignature = ReturnType(Args...) const noexcept;
using NonConstSignature = ReturnType(Args...) noexcept;
using OtherSignature = ConstSignature;
template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>;
template <typename Fun>
static ReturnType callSmall(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>((*static_cast<Fun*>(
static_cast<void*>(&p.tiny)))(static_cast<Args&&>(args)...));
}
template <typename Fun>
static ReturnType callBig(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>(
(*static_cast<Fun*>(p.big))(static_cast<Args&&>(args)...));
}
static ReturnType uninitCall(Data&, Args&&...) noexcept {
terminate_with<std::bad_function_call>();
}
ReturnType operator()(Args... args) noexcept {
auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> remove for (; e_ != &accessor_->meta_.head_ && !valid(); e_ = e_->prev) { }
</s> add for (; e_ != &accessor_->meta_.head_.elements[accessor_->id_].node &&
!valid();
e_ = e_->getPrev()) {
}
}
public:
using difference_type = ssize_t;
using value_type = T;
using reference = T const&;
using pointer = T const*;
using iterator_category = std::bidirectional_iterator_tag;
Iterator& operator++() {
increment();
return *this;
}
Iterator& operator++(int) {
Iterator copy(*this);
increment();
return copy;
}
Iterator& operator--() {
decrement();
return *this;
}
Iterator& operator--(int) {
Iterator copy(*this);
decrement();
return copy;
}
T& operator*() {
return dereference();
}
T const& operator*() const {
return dereference();
}
T* operator->() {
return &dereference();
}
T const* operator->() const {
return &dereference();
}
bool operator==(Iterator const& rhs) const {
return equal(rhs);
}
bool operator!=(Iterator const& rhs) const {
return !equal(rhs);
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep add keep keep keep keep keep keep
|
<mask> Function<ReturnType(Args...) const>&& that) noexcept {
<mask> return std::move(that);
<mask> }
<mask>
<mask> /**
<mask> * @class FunctionRef
<mask> *
<mask> * @brief A reference wrapper for callable objects
<mask> *
<mask> * FunctionRef is similar to std::reference_wrapper, but the template parameter
</s> [sdk33] Update iOS with RN 0.59 </s> remove * Constructs a new `Function` from any callable object. This
* handles function pointers, pointers to static member functions,
* `std::reference_wrapper` objects, `std::function` objects, and arbitrary
* objects that implement `operator()` if the parameter signature
* matches (i.e. it returns R when called with Args...).
* For a `Function` with a const function type, the object must be
* callable from a const-reference, i.e. implement `operator() const`.
* For a `Function` with a non-const function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise.
</s> add * Constructs a new `Function` from any callable object that is _not_ a
* `folly::Function`. This handles function pointers, pointers to static
* member functions, `std::reference_wrapper` objects, `std::function`
* objects, and arbitrary objects that implement `operator()` if the parameter
* signature matches (i.e. it returns an object convertible to `R` when called
* with `Args...`). </s> remove return exec_(Op::HEAP, nullptr, nullptr);
</s> add return exec(Op::HEAP, nullptr, nullptr); </s> add /**
* For assigning from a `Function<X(Ys..) [const?]>`.
*/
template <
typename Signature,
typename = typename Traits::template ResultOf<Function<Signature>>>
Function& operator=(Function<Signature>&& that) noexcept(
noexcept(Function(std::move(that)))) {
return (*this = Function(std::move(that)));
}
</s> remove return exec_(Op::FULL, nullptr, nullptr);
</s> add return exec_ != nullptr; </s> remove Function(Function&& that) noexcept {
that.exec_(Op::MOVE, &that.data_, &data_);
std::swap(call_, that.call_);
std::swap(exec_, that.exec_);
</s> add Function(Function&& that) noexcept : call_(that.call_), exec_(that.exec_) {
// that must be uninitialized before exec() call in the case of self move
that.call_ = &Traits::uninitCall;
that.exec_ = nullptr;
exec(Op::MOVE, &that.data_, &data_); </s> remove template <typename Fun>
/* implicit */ FunctionRef(Fun&& fun) noexcept {
using ReferencedType = typename std::remove_reference<Fun>::type;
static_assert(
std::is_convertible<
typename std::result_of<ReferencedType&(Args && ...)>::type,
ReturnType>::value,
"FunctionRef cannot be constructed from object with "
"incompatible function signature");
// `Fun` may be a const type, in which case we have to do a const_cast
// to store the address in a `void*`. This is safe because the `void*`
// will be cast back to `Fun*` (which is a const pointer whenever `Fun`
// is a const type) inside `FunctionRef::call`
object_ = const_cast<void*>(static_cast<void const*>(std::addressof(fun)));
call_ = &FunctionRef::call<ReferencedType>;
}
</s> add template <
typename Fun,
typename std::enable_if<
Conjunction<
Negation<std::is_same<FunctionRef, _t<std::decay<Fun>>>>,
is_invocable_r<ReturnType, Fun&&, Args&&...>>::value,
int>::type = 0>
constexpr /* implicit */ FunctionRef(Fun&& fun) noexcept
// `Fun` may be a const type, in which case we have to do a const_cast
// to store the address in a `void*`. This is safe because the `void*`
// will be cast back to `Fun*` (which is a const pointer whenever `Fun`
// is a const type) inside `FunctionRef::call`
: object_(
const_cast<void*>(static_cast<void const*>(std::addressof(fun)))),
call_(&FunctionRef::call<Fun>) {}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace keep keep keep keep keep
|
<mask> template <typename ReturnType, typename... Args>
<mask> class FunctionRef<ReturnType(Args...)> final {
<mask> using Call = ReturnType (*)(void*, Args&&...);
<mask>
<mask> void* object_{nullptr};
<mask> Call call_{&FunctionRef::uninitCall};
<mask>
<mask> static ReturnType uninitCall(void*, Args&&...) {
<mask> throw std::bad_function_call();
<mask> }
<mask>
<mask> template <typename Fun>
</s> [sdk33] Update iOS with RN 0.59 </s> remove auto& fn = *static_cast<const Function<ReturnType(Args...) const>*>(this);
</s> add auto& fn = *static_cast<const Function<ConstSignature>*>(this);
return fn.call_(fn.data_, static_cast<Args&&>(args)...);
}
class SharedProxy {
std::shared_ptr<Function<ConstSignature>> sp_;
public:
explicit SharedProxy(Function<ConstSignature>&& func)
: sp_(std::make_shared<Function<ConstSignature>>(std::move(func))) {}
ReturnType operator()(Args&&... args) const {
return (*sp_)(static_cast<Args&&>(args)...);
}
};
};
#if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
struct FunctionTraits<ReturnType(Args...) noexcept> {
using Call = ReturnType (*)(Data&, Args&&...) noexcept;
using IsConst = std::false_type;
using ConstSignature = ReturnType(Args...) const noexcept;
using NonConstSignature = ReturnType(Args...) noexcept;
using OtherSignature = ConstSignature;
template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>;
template <typename Fun>
static ReturnType callSmall(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>((*static_cast<Fun*>(
static_cast<void*>(&p.tiny)))(static_cast<Args&&>(args)...));
}
template <typename Fun>
static ReturnType callBig(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>(
(*static_cast<Fun*>(p.big))(static_cast<Args&&>(args)...));
}
static ReturnType uninitCall(Data&, Args&&...) noexcept {
terminate_with<std::bad_function_call>();
}
ReturnType operator()(Args... args) noexcept {
auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> add void* object_{nullptr};
Call call_{&FunctionRef::uninitCall};
</s> remove inline bool uninitNoop(Op, Data*, Data*) {
return false;
}
</s> add template <typename F, typename... Args>
using CallableResult = decltype(std::declval<F>()(std::declval<Args>()...));
template <
typename From,
typename To,
typename = typename std::enable_if<
!std::is_reference<To>::value || std::is_reference<From>::value>::type>
using SafeResultOf = decltype(static_cast<To>(std::declval<From>())); </s> add #if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
Function<ReturnType(Args...) const noexcept> constCastFunction(
Function<ReturnType(Args...) noexcept>&&) noexcept;
#endif
</s> remove return static_cast<ReturnType>(detail::function::invoke(
*static_cast<Fun*>(object), static_cast<Args&&>(args)...));
</s> add using Pointer = _t<std::add_pointer<Fun>>;
return static_cast<ReturnType>(invoke(
static_cast<Fun&&>(*static_cast<Pointer>(object)),
static_cast<Args&&>(args)...)); </s> remove template <typename F, typename G = typename std::decay<F>::type>
using ResultOf = decltype(
static_cast<ReturnType>(std::declval<G&>()(std::declval<Args>()...)));
</s> add template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> }
<mask>
<mask> template <typename Fun>
<mask> static ReturnType call(void* object, Args&&... args) {
<mask> return static_cast<ReturnType>(detail::function::invoke(
<mask> *static_cast<Fun*>(object), static_cast<Args&&>(args)...));
<mask> }
<mask>
<mask> public:
<mask> /**
<mask> * Default constructor. Constructs an empty FunctionRef.
</s> [sdk33] Update iOS with RN 0.59 </s> add void* object_{nullptr};
Call call_{&FunctionRef::uninitCall};
</s> remove auto& fn = *static_cast<const Function<ReturnType(Args...) const>*>(this);
</s> add auto& fn = *static_cast<const Function<ConstSignature>*>(this);
return fn.call_(fn.data_, static_cast<Args&&>(args)...);
}
class SharedProxy {
std::shared_ptr<Function<ConstSignature>> sp_;
public:
explicit SharedProxy(Function<ConstSignature>&& func)
: sp_(std::make_shared<Function<ConstSignature>>(std::move(func))) {}
ReturnType operator()(Args&&... args) const {
return (*sp_)(static_cast<Args&&>(args)...);
}
};
};
#if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
struct FunctionTraits<ReturnType(Args...) noexcept> {
using Call = ReturnType (*)(Data&, Args&&...) noexcept;
using IsConst = std::false_type;
using ConstSignature = ReturnType(Args...) const noexcept;
using NonConstSignature = ReturnType(Args...) noexcept;
using OtherSignature = ConstSignature;
template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>;
template <typename Fun>
static ReturnType callSmall(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>((*static_cast<Fun*>(
static_cast<void*>(&p.tiny)))(static_cast<Args&&>(args)...));
}
template <typename Fun>
static ReturnType callBig(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>(
(*static_cast<Fun*>(p.big))(static_cast<Args&&>(args)...));
}
static ReturnType uninitCall(Data&, Args&&...) noexcept {
terminate_with<std::bad_function_call>();
}
ReturnType operator()(Args... args) noexcept {
auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> remove Function(Function<OtherSignature>&& that, CoerceTag) noexcept {
that.exec_(Op::MOVE, &that.data_, &data_);
std::swap(call_, that.call_);
std::swap(exec_, that.exec_);
</s> add template <typename Signature>
Function(Function<Signature>&& that, CoerceTag)
: Function(static_cast<Function<Signature>&&>(that), HeapTag{}) {}
Function(Function<typename Traits::OtherSignature>&& that, CoerceTag) noexcept
: call_(that.call_), exec_(that.exec_) {
that.call_ = &Traits::uninitCall;
that.exec_ = nullptr;
exec(Op::MOVE, &that.data_, &data_); </s> remove void* object_{nullptr};
Call call_{&FunctionRef::uninitCall};
</s> add </s> remove template <typename F, typename G = typename std::decay<F>::type>
using ResultOf = decltype(
static_cast<ReturnType>(std::declval<G&>()(std::declval<Args>()...)));
</s> add template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>; </s> remove template <class SynchronizedType, class LockPolicy>
class LockedGuardPtr {
private:
// CDataType is the DataType with the appropriate const-qualification
using CDataType = detail::SynchronizedDataType<SynchronizedType>;
public:
using DataType = typename SynchronizedType::DataType;
using MutexType = typename SynchronizedType::MutexType;
using Synchronized = typename std::remove_const<SynchronizedType>::type;
LockedGuardPtr() = delete;
/**
* Takes a Synchronized<T> and locks it.
*/
explicit LockedGuardPtr(SynchronizedType* parent) : parent_(parent) {
LockPolicy::lock(parent_->mutex_);
}
/**
* Destructor releases.
*/
~LockedGuardPtr() {
LockPolicy::unlock(parent_->mutex_);
}
/**
* Access the locked data.
*/
CDataType* operator->() const {
return &parent_->datum_;
}
</s> add template <typename D, typename M, typename... Args>
auto wlock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::wlock(synchronized, std::forward<Args>(args)...);
}
template <typename Data, typename Mutex, typename... Args>
auto rlock(const Synchronized<Data, Mutex>& synchronized, Args&&... args) {
return detail::rlock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto ulock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::ulock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto lock(Synchronized<D, M>& synchronized, Args&&... args) {
return detail::lock(synchronized, std::forward<Args>(args)...);
}
template <typename D, typename M, typename... Args>
auto lock(const Synchronized<D, M>& synchronized, Args&&... args) {
return detail::lock(synchronized, std::forward<Args>(args)...);
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep add keep keep keep keep keep
|
<mask> static_cast<Fun&&>(*static_cast<Pointer>(object)),
<mask> static_cast<Args&&>(args)...));
<mask> }
<mask>
<mask> public:
<mask> /**
<mask> * Default constructor. Constructs an empty FunctionRef.
<mask> *
<mask> * Invoking it will throw std::bad_function_call.
</s> [sdk33] Update iOS with RN 0.59 </s> remove return static_cast<ReturnType>(detail::function::invoke(
*static_cast<Fun*>(object), static_cast<Args&&>(args)...));
</s> add using Pointer = _t<std::add_pointer<Fun>>;
return static_cast<ReturnType>(invoke(
static_cast<Fun&&>(*static_cast<Pointer>(object)),
static_cast<Args&&>(args)...)); </s> remove Function(Function<OtherSignature>&& that, CoerceTag) noexcept {
that.exec_(Op::MOVE, &that.data_, &data_);
std::swap(call_, that.call_);
std::swap(exec_, that.exec_);
</s> add template <typename Signature>
Function(Function<Signature>&& that, CoerceTag)
: Function(static_cast<Function<Signature>&&>(that), HeapTag{}) {}
Function(Function<typename Traits::OtherSignature>&& that, CoerceTag) noexcept
: call_(that.call_), exec_(that.exec_) {
that.call_ = &Traits::uninitCall;
that.exec_ = nullptr;
exec(Op::MOVE, &that.data_, &data_); </s> remove Function(Function&& that) noexcept {
that.exec_(Op::MOVE, &that.data_, &data_);
std::swap(call_, that.call_);
std::swap(exec_, that.exec_);
</s> add Function(Function&& that) noexcept : call_(that.call_), exec_(that.exec_) {
// that must be uninitialized before exec() call in the case of self move
that.call_ = &Traits::uninitCall;
that.exec_ = nullptr;
exec(Op::MOVE, &that.data_, &data_); </s> remove * Constructs a new `Function` from any callable object. This
* handles function pointers, pointers to static member functions,
* `std::reference_wrapper` objects, `std::function` objects, and arbitrary
* objects that implement `operator()` if the parameter signature
* matches (i.e. it returns R when called with Args...).
* For a `Function` with a const function type, the object must be
* callable from a const-reference, i.e. implement `operator() const`.
* For a `Function` with a non-const function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise.
</s> add * Constructs a new `Function` from any callable object that is _not_ a
* `folly::Function`. This handles function pointers, pointers to static
* member functions, `std::reference_wrapper` objects, `std::function`
* objects, and arbitrary objects that implement `operator()` if the parameter
* signature matches (i.e. it returns an object convertible to `R` when called
* with `Args...`). </s> remove * acquisition is unsuccessful, the returned ConstLockedPtr is NULL.
</s> add * acquisition is unsuccessful, the returned ConstLockedPtr is nullptr. </s> remove * acquisition is unsuccessful, the returned LockedPtr is NULL.
</s> add * acquisition is unsuccessful, the returned LockedPtr is nullptr.
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask>
<mask> /**
<mask> * Construct a FunctionRef from a reference to a callable object.
<mask> */
<mask> template <typename Fun>
<mask> /* implicit */ FunctionRef(Fun&& fun) noexcept {
<mask> using ReferencedType = typename std::remove_reference<Fun>::type;
<mask>
<mask> static_assert(
<mask> std::is_convertible<
<mask> typename std::result_of<ReferencedType&(Args && ...)>::type,
<mask> ReturnType>::value,
<mask> "FunctionRef cannot be constructed from object with "
<mask> "incompatible function signature");
<mask>
<mask> // `Fun` may be a const type, in which case we have to do a const_cast
<mask> // to store the address in a `void*`. This is safe because the `void*`
<mask> // will be cast back to `Fun*` (which is a const pointer whenever `Fun`
<mask> // is a const type) inside `FunctionRef::call`
<mask> object_ = const_cast<void*>(static_cast<void const*>(std::addressof(fun)));
<mask> call_ = &FunctionRef::call<ReferencedType>;
<mask> }
<mask>
<mask> ReturnType operator()(Args... args) const {
<mask> return call_(object_, static_cast<Args&&>(args)...);
<mask> }
<mask> };
</s> [sdk33] Update iOS with RN 0.59 </s> remove * For moving a `Function<X(Ys..) const>` into a `Function<X(Ys...)>`.
</s> add * For move-constructing from a `folly::Function<X(Ys...) [const?]>`.
* For a `Function` with a `const` function type, the object must be
* callable from a `const`-reference, i.e. implement `operator() const`.
* For a `Function` with a non-`const` function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise. </s> remove * Constructs a new `Function` from any callable object. This
* handles function pointers, pointers to static member functions,
* `std::reference_wrapper` objects, `std::function` objects, and arbitrary
* objects that implement `operator()` if the parameter signature
* matches (i.e. it returns R when called with Args...).
* For a `Function` with a const function type, the object must be
* callable from a const-reference, i.e. implement `operator() const`.
* For a `Function` with a non-const function type, the object will
* be called from a non-const reference, which means that it will execute
* a non-const `operator()` if it is defined, and falls back to
* `operator() const` otherwise.
</s> add * Constructs a new `Function` from any callable object that is _not_ a
* `folly::Function`. This handles function pointers, pointers to static
* member functions, `std::reference_wrapper` objects, `std::function`
* objects, and arbitrary objects that implement `operator()` if the parameter
* signature matches (i.e. it returns an object convertible to `R` when called
* with `Args...`). </s> remove template <class Fun, typename = typename Traits::template ResultOf<Fun>>
Function& operator=(Fun&& fun) noexcept(
</s> add template <typename Fun, typename = decltype(Function(std::declval<Fun>()))>
Function& operator=(Fun fun) noexcept( </s> remove * \note `typename = ResultOf<Fun>` prevents this overload from being
* selected by overload resolution when `fun` is not a compatible function.
</s> add * \note `typename Traits::template ResultOf<Fun>` prevents this overload
* from being selected by overload resolution when `fun` is not a compatible
* function.
*
* \note The noexcept requires some explanation. `IsSmall` is true when the
* decayed type fits within the internal buffer and is noexcept-movable. But
* this ctor might copy, not move. What we need here, if this ctor does a
* copy, is that this ctor be noexcept when the copy is noexcept. That is not
* checked in `IsSmall`, and shouldn't be, because once the `Function` is
* constructed, the contained object is never copied. This check is for this
* ctor only, in the case that this ctor does a copy. </s> remove if (&that != this) {
// Q: Why is is safe to destroy and reconstruct this object in place?
// A: Two reasons: First, `Function` is a final class, so in doing this
// we aren't slicing off any derived parts. And second, the move
// operation is guaranteed not to throw so we always leave the object
// in a valid state.
this->~Function();
::new (this) Function(std::move(that));
}
</s> add // Q: Why is it safe to destroy and reconstruct this object in place?
// A: Two reasons: First, `Function` is a final class, so in doing this
// we aren't slicing off any derived parts. And second, the move
// operation is guaranteed not to throw so we always leave the object
// in a valid state.
// In the case of self-move (this == &that), this leaves the object in
// a default-constructed state. First the object is destroyed, then we
// pass the destroyed object to the move constructor. The first thing the
// move constructor does is default-construct the object. That object is
// "moved" into itself, which is a no-op for a default-constructed Function.
this->~Function();
::new (this) Function(std::move(that)); </s> remove /**
* Sometimes, although you have a mutable object, you only want to
* call a const method against it. The most efficient way to achieve
* that is by using a read lock. You get to do so by using
* obj.asConst()->method() instead of obj->method().
*
* NOTE: This API is planned to be deprecated in an upcoming diff.
* Use rlock() instead.
*/
const Synchronized& asConst() const {
return *this;
}
</s> add
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep keep add keep keep keep
|
<mask> ReturnType operator()(Args... args) const {
<mask> return call_(object_, static_cast<Args&&>(args)...);
<mask> }
<mask> };
<mask>
<mask> } // namespace folly
</s> [sdk33] Update iOS with RN 0.59 </s> remove auto& fn = *static_cast<const Function<ReturnType(Args...) const>*>(this);
</s> add auto& fn = *static_cast<const Function<ConstSignature>*>(this);
return fn.call_(fn.data_, static_cast<Args&&>(args)...);
}
class SharedProxy {
std::shared_ptr<Function<ConstSignature>> sp_;
public:
explicit SharedProxy(Function<ConstSignature>&& func)
: sp_(std::make_shared<Function<ConstSignature>>(std::move(func))) {}
ReturnType operator()(Args&&... args) const {
return (*sp_)(static_cast<Args&&>(args)...);
}
};
};
#if FOLLY_HAVE_NOEXCEPT_FUNCTION_TYPE
template <typename ReturnType, typename... Args>
struct FunctionTraits<ReturnType(Args...) noexcept> {
using Call = ReturnType (*)(Data&, Args&&...) noexcept;
using IsConst = std::false_type;
using ConstSignature = ReturnType(Args...) const noexcept;
using NonConstSignature = ReturnType(Args...) noexcept;
using OtherSignature = ConstSignature;
template <typename F>
using ResultOf =
SafeResultOf<CallableResult<_t<std::decay<F>>&, Args...>, ReturnType>;
template <typename Fun>
static ReturnType callSmall(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>((*static_cast<Fun*>(
static_cast<void*>(&p.tiny)))(static_cast<Args&&>(args)...));
}
template <typename Fun>
static ReturnType callBig(Data& p, Args&&... args) noexcept {
return static_cast<ReturnType>(
(*static_cast<Fun*>(p.big))(static_cast<Args&&>(args)...));
}
static ReturnType uninitCall(Data&, Args&&...) noexcept {
terminate_with<std::bad_function_call>();
}
ReturnType operator()(Args... args) noexcept {
auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> remove auto& fn = *static_cast<Function<ReturnType(Args...)>*>(this);
</s> add auto& fn = *static_cast<Function<NonConstSignature>*>(this); </s> remove explicit SharedProxy(Function<ReturnType(Args...)>&& func)
: sp_(std::make_shared<Function<ReturnType(Args...)>>(
std::move(func))) {}
</s> add explicit SharedProxy(Function<NonConstSignature>&& func)
: sp_(std::make_shared<Function<NonConstSignature>>(std::move(func))) {} </s> remove explicit SharedProxy(Function<ReturnType(Args...) const>&& func)
: sp_(std::make_shared<Function<ReturnType(Args...) const>>(
std::move(func))) {}
</s> add explicit SharedProxy(Function<NonConstSignature>&& func)
: sp_(std::make_shared<Function<NonConstSignature>>(std::move(func))) {} </s> remove template <typename Fun>
/* implicit */ FunctionRef(Fun&& fun) noexcept {
using ReferencedType = typename std::remove_reference<Fun>::type;
static_assert(
std::is_convertible<
typename std::result_of<ReferencedType&(Args && ...)>::type,
ReturnType>::value,
"FunctionRef cannot be constructed from object with "
"incompatible function signature");
// `Fun` may be a const type, in which case we have to do a const_cast
// to store the address in a `void*`. This is safe because the `void*`
// will be cast back to `Fun*` (which is a const pointer whenever `Fun`
// is a const type) inside `FunctionRef::call`
object_ = const_cast<void*>(static_cast<void const*>(std::addressof(fun)));
call_ = &FunctionRef::call<ReferencedType>;
}
</s> add template <
typename Fun,
typename std::enable_if<
Conjunction<
Negation<std::is_same<FunctionRef, _t<std::decay<Fun>>>>,
is_invocable_r<ReturnType, Fun&&, Args&&...>>::value,
int>::type = 0>
constexpr /* implicit */ FunctionRef(Fun&& fun) noexcept
// `Fun` may be a const type, in which case we have to do a const_cast
// to store the address in a `void*`. This is safe because the `void*`
// will be cast back to `Fun*` (which is a const pointer whenever `Fun`
// is a const type) inside `FunctionRef::call`
: object_(
const_cast<void*>(static_cast<void const*>(std::addressof(fun)))),
call_(&FunctionRef::call<Fun>) {} </s> remove } // namespace detail
</s> add } // namespace folly
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Function.h
|
keep replace keep keep keep keep keep
|
<mask> /*
<mask> * Copyright 2016 Facebook, Inc.
<mask> *
<mask> * Licensed under the Apache License, Version 2.0 (the "License");
<mask> * you may not use this file except in compliance with the License.
<mask> * You may obtain a copy of the License at
<mask> *
</s> [sdk33] Update iOS with RN 0.59
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> template <typename Tag, typename VaultTag>
<mask> SingletonHolder<T>& SingletonHolder<T>::singleton() {
<mask> /* library-local */ static auto entry =
<mask> createGlobal<SingletonHolder<T>, std::pair<Tag, VaultTag>>([]() {
<mask> return new SingletonHolder<T>({typeid(T), typeid(Tag)},
<mask> *SingletonVault::singleton<VaultTag>());
<mask> });
<mask> return *entry;
<mask> }
<mask>
<mask> [[noreturn]] void singletonWarnDoubleRegistrationAndAbort(
</s> [sdk33] Update iOS with RN 0.59 </s> add std::list<T*> leakedPtrs; </s> remove static T& get() { return instance(); }
</s> add static T& get() {
return instance();
}
static void make_mock(std::nullptr_t /* c */ = nullptr) {
make_mock([]() { return new T; });
}
static void make_mock(CreateFunc createFunc) {
if (createFunc == nullptr) {
detail::singletonThrowNullCreator(typeid(T));
}
auto& entry = entryInstance();
if (entry.ptr) {
// Make sure existing pointer doesn't get reported as a leak by LSAN.
entry.leakedPtrs.push_back(std::exchange(entry.ptr, nullptr));
}
entry.createFunc = createFunc;
entry.state = State::Dead;
} </s> remove typedef std::string(*StackTraceGetterPtr)();
</s> add typedef std::string (*StackTraceGetterPtr)(); </s> remove } // namespace folly
</s> add namespace threadlocal_detail {
template <typename>
struct static_meta_of;
template <typename T, typename Tag, typename AccessMode>
struct static_meta_of<ThreadLocalPtr<T, Tag, AccessMode>> {
using type = StaticMeta<Tag, AccessMode>;
};
template <typename T, typename Tag, typename AccessMode>
struct static_meta_of<ThreadLocal<T, Tag, AccessMode>> {
using type = StaticMeta<Tag, AccessMode>;
};
} // namespace threadlocal_detail
} // namespace folly </s> remove explicit Singleton(std::nullptr_t /* _ */ = nullptr,
typename Singleton::TeardownFunc t = nullptr)
</s> add // Quickly ensure the instance exists.
static void vivify() {
getEntry().vivify();
}
explicit Singleton(
std::nullptr_t /* _ */ = nullptr,
typename Singleton::TeardownFunc t = nullptr) </s> remove template <class Ex>
bool is_compatible_with() const {
if (item_) {
return dynamic_cast<const Ex*>(item_.get());
} else if (eptr_) {
try {
std::rethrow_exception(eptr_);
} catch (typename std::decay<Ex>::type&) {
return true;
} catch (...) {
// fall through
}
}
return false;
}
</s> add [[noreturn]] static void onNoExceptionError(char const* name);
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep replace replace keep replace keep
|
<mask> void SingletonHolder<T>::registerSingletonMock(CreateFunc c, TeardownFunc t) {
<mask> if (state_ == SingletonHolderState::NotRegistered) {
<mask> LOG(FATAL) << "Registering mock before singleton was registered: "
<mask> << type().name();
<mask> }
<mask> destroyInstance();
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> remove std::this_thread::get_id()) {
LOG(FATAL) << "circular singleton dependency: " << type().name();
</s> add std::this_thread::get_id()) {
detail::singletonWarnCreateCircularDependencyAndAbort(type()); </s> remove SingletonHolderState::NotRegistered) {
auto ptr = SingletonVault::stackTraceGetter().load();
LOG(FATAL) << "Creating instance for unregistered singleton: "
<< type().name() << "\n"
<< "Stacktrace:"
<< "\n"
<< (ptr ? (*ptr)() : "(not available)");
</s> add SingletonHolderState::NotRegistered) {
detail::singletonWarnCreateUnregisteredAndAbort(type()); </s> remove RWSpinLock::ReadHolder rh(&vault_.stateMutex_);
if (vault_.state_ == SingletonVault::SingletonVaultState::Quiescing) {
if (vault_.type_ != SingletonVault::Type::Relaxed) {
LOG(FATAL) << "Requesting singleton after vault was destroyed.";
}
</s> add auto state = vault_.state_.rlock();
if (vault_.type_ != SingletonVault::Type::Relaxed &&
!state->registrationComplete) {
detail::singletonWarnCreateBeforeRegistrationCompleteAndAbort(type());
}
if (state->state == detail::SingletonVaultState::Type::Quiescing) { </s> remove auto wait_result = destroy_baton_->timed_wait(
std::chrono::steady_clock::now() + kDestroyWaitTime);
if (!wait_result) {
</s> add auto last_reference_released =
destroy_baton_->try_wait_for(kDestroyWaitTime);
if (last_reference_released) {
teardown_(instance_ptr_);
} else { </s> remove LOG(ERROR) << "Singleton of type " << type().name() << " has a "
<< "living reference at destroyInstances time; beware! Raw "
<< "pointer is " << instance_ptr_ << ". It is very likely "
<< "that some other singleton is holding a shared_ptr to it. "
<< "Make sure dependencies between these singletons are "
<< "properly defined.";
</s> add detail::singletonWarnDestroyInstanceLeak(type(), instance_ptr_);
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> }
<mask> destroyInstance();
<mask>
<mask> {
<mask> RWSpinLock::WriteHolder wh(&vault_.mutex_);
<mask>
<mask> auto it = std::find(
<mask> vault_.creation_order_.begin(), vault_.creation_order_.end(), type());
<mask> if (it != vault_.creation_order_.end()) {
<mask> vault_.creation_order_.erase(it);
</s> [sdk33] Update iOS with RN 0.59 </s> remove auto it = std::find(
vault_.creation_order_.begin(), vault_.creation_order_.end(), type());
if (it != vault_.creation_order_.end()) {
vault_.creation_order_.erase(it);
</s> add auto it = std::find(creationOrder->begin(), creationOrder->end(), type());
if (it != creationOrder->end()) {
creationOrder->erase(it); </s> remove destroyInstance();
</s> add </s> remove LOG(FATAL) << "Registering mock before singleton was registered: "
<< type().name();
</s> add detail::singletonWarnRegisterMockEarlyAndAbort(type());
}
if (state_ == SingletonHolderState::Living) {
destroyInstance(); </s> remove {
RWSpinLock::WriteHolder wh(&vault_.mutex_);
vault_.creation_order_.push_back(type());
}
</s> add vault_.creationOrder_.wlock()->push_back(type()); </s> remove RWSpinLock::ReadHolder rh(&vault_.stateMutex_);
if (vault_.state_ == SingletonVault::SingletonVaultState::Quiescing) {
if (vault_.type_ != SingletonVault::Type::Relaxed) {
LOG(FATAL) << "Requesting singleton after vault was destroyed.";
}
</s> add auto state = vault_.state_.rlock();
if (vault_.type_ != SingletonVault::Type::Relaxed &&
!state->registrationComplete) {
detail::singletonWarnCreateBeforeRegistrationCompleteAndAbort(type());
}
if (state->state == detail::SingletonVaultState::Type::Quiescing) { </s> remove // TODO: we'd like to make use of makeSize (it can be optimized better,
// because it manipulates the internals)
// unfortunately the current implementation only supports moving from
// a supplied rvalue, and doing an extra move just to reuse it is a perf
// net loss
if (size() == capacity()) {// && isInside(&t)) {
value_type tmp(t);
emplaceBack(std::move(tmp));
} else {
emplaceBack(t);
}
</s> add emplace_back(t);
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace replace replace replace keep keep keep keep keep
|
<mask>
<mask> {
<mask> RWSpinLock::WriteHolder wh(&vault_.mutex_);
<mask>
<mask> auto it = std::find(
<mask> vault_.creation_order_.begin(), vault_.creation_order_.end(), type());
<mask> if (it != vault_.creation_order_.end()) {
<mask> vault_.creation_order_.erase(it);
<mask> }
<mask> }
<mask>
<mask> std::lock_guard<std::mutex> entry_lock(mutex_);
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> remove RWSpinLock::WriteHolder wh(&vault_.mutex_);
</s> add auto creationOrder = vault_.creationOrder_.wlock(); </s> remove destroyInstance();
</s> add </s> remove std::this_thread::get_id()) {
LOG(FATAL) << "circular singleton dependency: " << type().name();
</s> add std::this_thread::get_id()) {
detail::singletonWarnCreateCircularDependencyAndAbort(type()); </s> remove LOG(FATAL) << "Registering mock before singleton was registered: "
<< type().name();
</s> add detail::singletonWarnRegisterMockEarlyAndAbort(type());
}
if (state_ == SingletonHolderState::Living) {
destroyInstance(); </s> remove {
RWSpinLock::WriteHolder wh(&vault_.mutex_);
vault_.creation_order_.push_back(type());
}
</s> add vault_.creationOrder_.wlock()->push_back(type()); </s> remove RWSpinLock::ReadHolder rh(&vault_.stateMutex_);
if (vault_.state_ == SingletonVault::SingletonVaultState::Quiescing) {
if (vault_.type_ != SingletonVault::Type::Relaxed) {
LOG(FATAL) << "Requesting singleton after vault was destroyed.";
}
</s> add auto state = vault_.state_.rlock();
if (vault_.type_ != SingletonVault::Type::Relaxed &&
!state->registrationComplete) {
detail::singletonWarnCreateBeforeRegistrationCompleteAndAbort(type());
}
if (state->state == detail::SingletonVaultState::Type::Quiescing) {
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> }
<mask>
<mask> template <typename T>
<mask> T* SingletonHolder<T>::get() {
<mask> if (LIKELY(state_.load(std::memory_order_acquire) ==
<mask> SingletonHolderState::Living)) {
<mask> return instance_ptr_;
<mask> }
<mask> createInstance();
<mask>
<mask> if (instance_weak_.expired()) {
</s> [sdk33] Update iOS with RN 0.59 </s> remove if (UNLIKELY(state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) {
</s> add if (UNLIKELY(
state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) { </s> remove if (UNLIKELY(state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) {
</s> add if (UNLIKELY(
state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) { </s> remove if (UNLIKELY(state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) {
</s> add if (UNLIKELY(
state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) { </s> add template <typename T>
void SingletonHolder<T>::vivify() {
if (UNLIKELY(
state_.load(std::memory_order_relaxed) !=
SingletonHolderState::Living)) {
createInstance();
}
}
</s> remove throw std::runtime_error(
"Raw pointer to a singleton requested after its destruction."
" Singleton type is: " +
type().name());
</s> add detail::singletonThrowGetInvokedAfterDestruction(type()); </s> remove template <class T>
T* pointerFlagSet(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) | 1);
}
template <class T>
bool pointerFlagGet(T* p) {
return reinterpret_cast<uintptr_t>(p) & 1;
}
template <class T>
T* pointerFlagClear(T* p) {
return reinterpret_cast<T*>(
reinterpret_cast<uintptr_t>(p) & ~uintptr_t(1));
}
inline void* shiftPointer(void* p, size_t sizeBytes) {
return static_cast<char*>(p) + sizeBytes;
}
</s> add template <class T>
T* pointerFlagSet(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) | 1);
}
template <class T>
bool pointerFlagGet(T* p) {
return reinterpret_cast<uintptr_t>(p) & 1;
}
template <class T>
T* pointerFlagClear(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & ~uintptr_t(1));
}
inline void* shiftPointer(void* p, size_t sizeBytes) {
return static_cast<char*>(p) + sizeBytes;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace replace replace replace keep keep keep keep keep
|
<mask> }
<mask> createInstance();
<mask>
<mask> if (instance_weak_.expired()) {
<mask> throw std::runtime_error(
<mask> "Raw pointer to a singleton requested after its destruction."
<mask> " Singleton type is: " +
<mask> type().name());
<mask> }
<mask>
<mask> return instance_ptr_;
<mask> }
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> remove if (LIKELY(state_.load(std::memory_order_acquire) ==
SingletonHolderState::Living)) {
</s> add if (LIKELY(
state_.load(std::memory_order_acquire) ==
SingletonHolderState::Living)) { </s> remove LOG(ERROR) << "Singleton of type " << type().name() << " has a "
<< "living reference at destroyInstances time; beware! Raw "
<< "pointer is " << instance_ptr_ << ". It is very likely "
<< "that some other singleton is holding a shared_ptr to it. "
<< "Make sure dependencies between these singletons are "
<< "properly defined.";
</s> add detail::singletonWarnDestroyInstanceLeak(type(), instance_ptr_); </s> remove auto wait_result = destroy_baton_->timed_wait(
std::chrono::steady_clock::now() + kDestroyWaitTime);
if (!wait_result) {
</s> add auto last_reference_released =
destroy_baton_->try_wait_for(kDestroyWaitTime);
if (last_reference_released) {
teardown_(instance_ptr_);
} else { </s> remove LOG(FATAL) << "Double registration of singletons of the same "
<< "underlying type; check for multiple definitions "
<< "of type folly::LeakySingleton<" + entry.type_.name() + ">";
</s> add detail::singletonWarnLeakyDoubleRegistrationAndAbort(entry.type_); </s> remove #define CHECK_THROW(cond, E) \
::folly::throwOnFail<E>((cond), "Check failed: " #cond)
} // namespace folly
</s> add #define CHECK_THROW(cond, E) \
do { \
if (!(cond)) { \
throw E("Check failed: " #cond); \
} \
} while (0)
} // namespace folly </s> remove create_(),
[destroy_baton, print_destructor_stack_trace, teardown, type = type()]
(T* instance_ptr) mutable {
teardown(instance_ptr);
destroy_baton->post();
if (print_destructor_stack_trace->load()) {
std::string output = "Singleton " + type.name() + " was destroyed.\n";
auto stack_trace_getter = SingletonVault::stackTraceGetter().load();
auto stack_trace = stack_trace_getter ? stack_trace_getter() : "";
if (stack_trace.empty()) {
output += "Failed to get destructor stack trace.";
} else {
output += "Destructor stack trace:\n";
output += stack_trace;
</s> add create_(),
[destroy_baton, print_destructor_stack_trace, type = type()](T*) mutable {
destroy_baton->post();
if (print_destructor_stack_trace->load()) {
detail::singletonPrintDestructionStackTrace(type);
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> }
<mask>
<mask> template <typename T>
<mask> std::weak_ptr<T> SingletonHolder<T>::get_weak() {
<mask> if (UNLIKELY(state_.load(std::memory_order_acquire) !=
<mask> SingletonHolderState::Living)) {
<mask> createInstance();
<mask> }
<mask>
<mask> return instance_weak_;
<mask> }
</s> [sdk33] Update iOS with RN 0.59 </s> remove if (UNLIKELY(state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) {
</s> add if (UNLIKELY(
state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) { </s> remove if (UNLIKELY(state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) {
</s> add if (UNLIKELY(
state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) { </s> add template <typename T>
void SingletonHolder<T>::vivify() {
if (UNLIKELY(
state_.load(std::memory_order_relaxed) !=
SingletonHolderState::Living)) {
createInstance();
}
}
</s> remove if (LIKELY(state_.load(std::memory_order_acquire) ==
SingletonHolderState::Living)) {
</s> add if (LIKELY(
state_.load(std::memory_order_acquire) ==
SingletonHolderState::Living)) { </s> remove template<typename T>
</s> add template <typename T> </s> remove template <class T>
T* pointerFlagSet(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) | 1);
}
template <class T>
bool pointerFlagGet(T* p) {
return reinterpret_cast<uintptr_t>(p) & 1;
}
template <class T>
T* pointerFlagClear(T* p) {
return reinterpret_cast<T*>(
reinterpret_cast<uintptr_t>(p) & ~uintptr_t(1));
}
inline void* shiftPointer(void* p, size_t sizeBytes) {
return static_cast<char*>(p) + sizeBytes;
}
</s> add template <class T>
T* pointerFlagSet(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) | 1);
}
template <class T>
bool pointerFlagGet(T* p) {
return reinterpret_cast<uintptr_t>(p) & 1;
}
template <class T>
T* pointerFlagClear(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & ~uintptr_t(1));
}
inline void* shiftPointer(void* p, size_t sizeBytes) {
return static_cast<char*>(p) + sizeBytes;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> }
<mask>
<mask> template <typename T>
<mask> std::shared_ptr<T> SingletonHolder<T>::try_get() {
<mask> if (UNLIKELY(state_.load(std::memory_order_acquire) !=
<mask> SingletonHolderState::Living)) {
<mask> createInstance();
<mask> }
<mask>
<mask> return instance_weak_.lock();
<mask> }
</s> [sdk33] Update iOS with RN 0.59 </s> remove if (UNLIKELY(state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) {
</s> add if (UNLIKELY(
state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) { </s> remove if (UNLIKELY(state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) {
</s> add if (UNLIKELY(
state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) { </s> add template <typename T>
void SingletonHolder<T>::vivify() {
if (UNLIKELY(
state_.load(std::memory_order_relaxed) !=
SingletonHolderState::Living)) {
createInstance();
}
}
</s> remove if (LIKELY(state_.load(std::memory_order_acquire) ==
SingletonHolderState::Living)) {
</s> add if (LIKELY(
state_.load(std::memory_order_acquire) ==
SingletonHolderState::Living)) { </s> remove template<typename T>
</s> add template <typename T> </s> remove template <class T>
T* pointerFlagSet(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) | 1);
}
template <class T>
bool pointerFlagGet(T* p) {
return reinterpret_cast<uintptr_t>(p) & 1;
}
template <class T>
T* pointerFlagClear(T* p) {
return reinterpret_cast<T*>(
reinterpret_cast<uintptr_t>(p) & ~uintptr_t(1));
}
inline void* shiftPointer(void* p, size_t sizeBytes) {
return static_cast<char*>(p) + sizeBytes;
}
</s> add template <class T>
T* pointerFlagSet(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) | 1);
}
template <class T>
bool pointerFlagGet(T* p) {
return reinterpret_cast<uintptr_t>(p) & 1;
}
template <class T>
T* pointerFlagClear(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & ~uintptr_t(1));
}
inline void* shiftPointer(void* p, size_t sizeBytes) {
return static_cast<char*>(p) + sizeBytes;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> }
<mask>
<mask> template <typename T>
<mask> folly::ReadMostlySharedPtr<T> SingletonHolder<T>::try_get_fast() {
<mask> if (UNLIKELY(state_.load(std::memory_order_acquire) !=
<mask> SingletonHolderState::Living)) {
<mask> createInstance();
<mask> }
<mask>
<mask> return instance_weak_fast_.lock();
<mask> }
</s> [sdk33] Update iOS with RN 0.59 </s> remove if (UNLIKELY(state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) {
</s> add if (UNLIKELY(
state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) { </s> remove if (UNLIKELY(state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) {
</s> add if (UNLIKELY(
state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) { </s> add template <typename T>
void SingletonHolder<T>::vivify() {
if (UNLIKELY(
state_.load(std::memory_order_relaxed) !=
SingletonHolderState::Living)) {
createInstance();
}
}
</s> remove if (LIKELY(state_.load(std::memory_order_acquire) ==
SingletonHolderState::Living)) {
</s> add if (LIKELY(
state_.load(std::memory_order_acquire) ==
SingletonHolderState::Living)) { </s> remove template<typename T>
</s> add template <typename T> </s> remove template <class T>
T* pointerFlagSet(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) | 1);
}
template <class T>
bool pointerFlagGet(T* p) {
return reinterpret_cast<uintptr_t>(p) & 1;
}
template <class T>
T* pointerFlagClear(T* p) {
return reinterpret_cast<T*>(
reinterpret_cast<uintptr_t>(p) & ~uintptr_t(1));
}
inline void* shiftPointer(void* p, size_t sizeBytes) {
return static_cast<char*>(p) + sizeBytes;
}
</s> add template <class T>
T* pointerFlagSet(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) | 1);
}
template <class T>
bool pointerFlagGet(T* p) {
return reinterpret_cast<uintptr_t>(p) & 1;
}
template <class T>
T* pointerFlagClear(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & ~uintptr_t(1));
}
inline void* shiftPointer(void* p, size_t sizeBytes) {
return static_cast<char*>(p) + sizeBytes;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep add keep keep keep keep
|
<mask> return instance_weak_fast_.lock();
<mask> }
<mask>
<mask> template <typename T>
<mask> bool SingletonHolder<T>::hasLiveInstance() {
<mask> return !instance_weak_.expired();
<mask> }
</s> [sdk33] Update iOS with RN 0.59 </s> remove if (UNLIKELY(state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) {
</s> add if (UNLIKELY(
state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) { </s> remove template <class T>
T* pointerFlagSet(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) | 1);
}
template <class T>
bool pointerFlagGet(T* p) {
return reinterpret_cast<uintptr_t>(p) & 1;
}
template <class T>
T* pointerFlagClear(T* p) {
return reinterpret_cast<T*>(
reinterpret_cast<uintptr_t>(p) & ~uintptr_t(1));
}
inline void* shiftPointer(void* p, size_t sizeBytes) {
return static_cast<char*>(p) + sizeBytes;
}
</s> add template <class T>
T* pointerFlagSet(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) | 1);
}
template <class T>
bool pointerFlagGet(T* p) {
return reinterpret_cast<uintptr_t>(p) & 1;
}
template <class T>
T* pointerFlagClear(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & ~uintptr_t(1));
}
inline void* shiftPointer(void* p, size_t sizeBytes) {
return static_cast<char*>(p) + sizeBytes; </s> remove template<typename T>
</s> add template <typename T> </s> remove if (UNLIKELY(state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) {
</s> add if (UNLIKELY(
state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) { </s> remove if (UNLIKELY(state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) {
</s> add if (UNLIKELY(
state_.load(std::memory_order_acquire) !=
SingletonHolderState::Living)) { </s> remove template <typename T>
constexpr T constexpr_max(T a, T b) {
return a > b ? a : b;
}
template <typename T>
constexpr T constexpr_min(T a, T b) {
return a < b ? a : b;
}
</s> add
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace replace replace keep replace replace replace replace replace replace keep
|
<mask> instance_.reset();
<mask> instance_copy_.reset();
<mask> if (destroy_baton_) {
<mask> constexpr std::chrono::seconds kDestroyWaitTime{5};
<mask> auto wait_result = destroy_baton_->timed_wait(
<mask> std::chrono::steady_clock::now() + kDestroyWaitTime);
<mask> if (!wait_result) {
<mask> print_destructor_stack_trace_->store(true);
<mask> LOG(ERROR) << "Singleton of type " << type().name() << " has a "
<mask> << "living reference at destroyInstances time; beware! Raw "
<mask> << "pointer is " << instance_ptr_ << ". It is very likely "
<mask> << "that some other singleton is holding a shared_ptr to it. "
<mask> << "Make sure dependencies between these singletons are "
<mask> << "properly defined.";
<mask> }
</s> [sdk33] Update iOS with RN 0.59 </s> remove << " nodeheight=" << nodeHeight;
</s> add << " nodeheight=" << nodeHeight; </s> remove LOG(FATAL) << "Double registration of singletons of the same "
<< "underlying type; check for multiple definitions "
<< "of type folly::LeakySingleton<" + entry.type_.name() + ">";
</s> add detail::singletonWarnLeakyDoubleRegistrationAndAbort(entry.type_); </s> remove SingletonHolderState::NotRegistered) {
auto ptr = SingletonVault::stackTraceGetter().load();
LOG(FATAL) << "Creating instance for unregistered singleton: "
<< type().name() << "\n"
<< "Stacktrace:"
<< "\n"
<< (ptr ? (*ptr)() : "(not available)");
</s> add SingletonHolderState::NotRegistered) {
detail::singletonWarnCreateUnregisteredAndAbort(type()); </s> remove destroyInstance();
</s> add </s> remove std::this_thread::get_id()) {
LOG(FATAL) << "circular singleton dependency: " << type().name();
</s> add std::this_thread::get_id()) {
detail::singletonWarnCreateCircularDependencyAndAbort(type());
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask>
<mask> template <typename T>
<mask> void SingletonHolder<T>::createInstance() {
<mask> if (creating_thread_.load(std::memory_order_acquire) ==
<mask> std::this_thread::get_id()) {
<mask> LOG(FATAL) << "circular singleton dependency: " << type().name();
<mask> }
<mask>
<mask> std::lock_guard<std::mutex> entry_lock(mutex_);
<mask> if (state_.load(std::memory_order_acquire) == SingletonHolderState::Living) {
<mask> return;
</s> [sdk33] Update iOS with RN 0.59 </s> remove SingletonHolderState::NotRegistered) {
auto ptr = SingletonVault::stackTraceGetter().load();
LOG(FATAL) << "Creating instance for unregistered singleton: "
<< type().name() << "\n"
<< "Stacktrace:"
<< "\n"
<< (ptr ? (*ptr)() : "(not available)");
</s> add SingletonHolderState::NotRegistered) {
detail::singletonWarnCreateUnregisteredAndAbort(type()); </s> remove LOG(FATAL) << "Registering mock before singleton was registered: "
<< type().name();
</s> add detail::singletonWarnRegisterMockEarlyAndAbort(type());
}
if (state_ == SingletonHolderState::Living) {
destroyInstance(); </s> remove destroyInstance();
</s> add </s> remove RWSpinLock::ReadHolder rh(&vault_.stateMutex_);
if (vault_.state_ == SingletonVault::SingletonVaultState::Quiescing) {
if (vault_.type_ != SingletonVault::Type::Relaxed) {
LOG(FATAL) << "Requesting singleton after vault was destroyed.";
}
</s> add auto state = vault_.state_.rlock();
if (vault_.type_ != SingletonVault::Type::Relaxed &&
!state->registrationComplete) {
detail::singletonWarnCreateBeforeRegistrationCompleteAndAbort(type());
}
if (state->state == detail::SingletonVaultState::Type::Quiescing) { </s> remove LOG(ERROR) << "Singleton of type " << type().name() << " has a "
<< "living reference at destroyInstances time; beware! Raw "
<< "pointer is " << instance_ptr_ << ". It is very likely "
<< "that some other singleton is holding a shared_ptr to it. "
<< "Make sure dependencies between these singletons are "
<< "properly defined.";
</s> add detail::singletonWarnDestroyInstanceLeak(type(), instance_ptr_); </s> remove auto wait_result = destroy_baton_->timed_wait(
std::chrono::steady_clock::now() + kDestroyWaitTime);
if (!wait_result) {
</s> add auto last_reference_released =
destroy_baton_->try_wait_for(kDestroyWaitTime);
if (last_reference_released) {
teardown_(instance_ptr_);
} else {
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask> if (state_.load(std::memory_order_acquire) == SingletonHolderState::Living) {
<mask> return;
<mask> }
<mask> if (state_.load(std::memory_order_acquire) ==
<mask> SingletonHolderState::NotRegistered) {
<mask> auto ptr = SingletonVault::stackTraceGetter().load();
<mask> LOG(FATAL) << "Creating instance for unregistered singleton: "
<mask> << type().name() << "\n"
<mask> << "Stacktrace:"
<mask> << "\n"
<mask> << (ptr ? (*ptr)() : "(not available)");
<mask> }
<mask>
<mask> if (state_.load(std::memory_order_acquire) == SingletonHolderState::Living) {
<mask> return;
<mask> }
</s> [sdk33] Update iOS with RN 0.59 </s> remove std::this_thread::get_id()) {
LOG(FATAL) << "circular singleton dependency: " << type().name();
</s> add std::this_thread::get_id()) {
detail::singletonWarnCreateCircularDependencyAndAbort(type()); </s> remove LOG(FATAL) << "Registering mock before singleton was registered: "
<< type().name();
</s> add detail::singletonWarnRegisterMockEarlyAndAbort(type());
}
if (state_ == SingletonHolderState::Living) {
destroyInstance(); </s> remove destroyInstance();
</s> add </s> remove auto wait_result = destroy_baton_->timed_wait(
std::chrono::steady_clock::now() + kDestroyWaitTime);
if (!wait_result) {
</s> add auto last_reference_released =
destroy_baton_->try_wait_for(kDestroyWaitTime);
if (last_reference_released) {
teardown_(instance_ptr_);
} else { </s> remove LOG(ERROR) << "Singleton of type " << type().name() << " has a "
<< "living reference at destroyInstances time; beware! Raw "
<< "pointer is " << instance_ptr_ << ". It is very likely "
<< "that some other singleton is holding a shared_ptr to it. "
<< "Make sure dependencies between these singletons are "
<< "properly defined.";
</s> add detail::singletonWarnDestroyInstanceLeak(type(), instance_ptr_); </s> remove RWSpinLock::ReadHolder rh(&vault_.stateMutex_);
if (vault_.state_ == SingletonVault::SingletonVaultState::Quiescing) {
if (vault_.type_ != SingletonVault::Type::Relaxed) {
LOG(FATAL) << "Requesting singleton after vault was destroyed.";
}
</s> add auto state = vault_.state_.rlock();
if (vault_.type_ != SingletonVault::Type::Relaxed &&
!state->registrationComplete) {
detail::singletonWarnCreateBeforeRegistrationCompleteAndAbort(type());
}
if (state->state == detail::SingletonVaultState::Type::Quiescing) {
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
|
<mask> };
<mask>
<mask> creating_thread_.store(std::this_thread::get_id(), std::memory_order_release);
<mask>
<mask> RWSpinLock::ReadHolder rh(&vault_.stateMutex_);
<mask> if (vault_.state_ == SingletonVault::SingletonVaultState::Quiescing) {
<mask> if (vault_.type_ != SingletonVault::Type::Relaxed) {
<mask> LOG(FATAL) << "Requesting singleton after vault was destroyed.";
<mask> }
<mask> return;
<mask> }
<mask>
<mask> auto destroy_baton = std::make_shared<folly::Baton<>>();
<mask> auto print_destructor_stack_trace =
</s> [sdk33] Update iOS with RN 0.59 </s> remove destroyInstance();
</s> add </s> remove SingletonHolderState::NotRegistered) {
auto ptr = SingletonVault::stackTraceGetter().load();
LOG(FATAL) << "Creating instance for unregistered singleton: "
<< type().name() << "\n"
<< "Stacktrace:"
<< "\n"
<< (ptr ? (*ptr)() : "(not available)");
</s> add SingletonHolderState::NotRegistered) {
detail::singletonWarnCreateUnregisteredAndAbort(type()); </s> remove std::this_thread::get_id()) {
LOG(FATAL) << "circular singleton dependency: " << type().name();
</s> add std::this_thread::get_id()) {
detail::singletonWarnCreateCircularDependencyAndAbort(type()); </s> remove LOG(FATAL) << "Registering mock before singleton was registered: "
<< type().name();
</s> add detail::singletonWarnRegisterMockEarlyAndAbort(type());
}
if (state_ == SingletonHolderState::Living) {
destroyInstance(); </s> remove std::make_shared<std::atomic<bool>>(false);
auto teardown = teardown_;
</s> add std::make_shared<std::atomic<bool>>(false); </s> remove auto wait_result = destroy_baton_->timed_wait(
std::chrono::steady_clock::now() + kDestroyWaitTime);
if (!wait_result) {
</s> add auto last_reference_released =
destroy_baton_->try_wait_for(kDestroyWaitTime);
if (last_reference_released) {
teardown_(instance_ptr_);
} else {
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep replace replace keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep
|
<mask> auto print_destructor_stack_trace =
<mask> std::make_shared<std::atomic<bool>>(false);
<mask> auto teardown = teardown_;
<mask>
<mask> // Can't use make_shared -- no support for a custom deleter, sadly.
<mask> std::shared_ptr<T> instance(
<mask> create_(),
<mask> [destroy_baton, print_destructor_stack_trace, teardown, type = type()]
<mask> (T* instance_ptr) mutable {
<mask> teardown(instance_ptr);
<mask> destroy_baton->post();
<mask> if (print_destructor_stack_trace->load()) {
<mask> std::string output = "Singleton " + type.name() + " was destroyed.\n";
<mask>
<mask> auto stack_trace_getter = SingletonVault::stackTraceGetter().load();
<mask> auto stack_trace = stack_trace_getter ? stack_trace_getter() : "";
<mask> if (stack_trace.empty()) {
<mask> output += "Failed to get destructor stack trace.";
<mask> } else {
<mask> output += "Destructor stack trace:\n";
<mask> output += stack_trace;
<mask> }
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> remove
LOG(ERROR) << output;
}
});
</s> add }); </s> remove if (c == '\r') output += 'r';
else if (c == '\n') output += 'n';
else if (c == '\t') output += 't';
else if (c == '\a') output += 'a';
else if (c == '\b') output += 'b';
else if (c == '\0') output += '0';
else if (c == '\\') output += '\\';
else {
</s> add if (c == '\r') {
output += 'r';
} else if (c == '\n') {
output += 'n';
} else if (c == '\t') {
output += 't';
} else if (c == '\a') {
output += 'a';
} else if (c == '\b') {
output += 'b';
} else if (c == '\0') {
output += '0';
} else if (c == '\\') {
output += '\\';
} else { </s> remove auto wait_result = destroy_baton_->timed_wait(
std::chrono::steady_clock::now() + kDestroyWaitTime);
if (!wait_result) {
</s> add auto last_reference_released =
destroy_baton_->try_wait_for(kDestroyWaitTime);
if (last_reference_released) {
teardown_(instance_ptr_);
} else { </s> remove result += sum;
</s> add result += UT(sum); </s> remove std::string name() const {
auto ret = demangle(ti_.name());
if (tag_ti_ != std::type_index(typeid(DefaultTag))) {
ret += "/";
ret += demangle(tag_ti_.name());
}
return ret.toStdString();
}
</s> add std::string name() const;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace replace replace replace keep keep keep keep keep
|
<mask> } else {
<mask> output += "Destructor stack trace:\n";
<mask> output += stack_trace;
<mask> }
<mask>
<mask> LOG(ERROR) << output;
<mask> }
<mask> });
<mask>
<mask> // We should schedule destroyInstances() only after the singleton was
<mask> // created. This will ensure it will be destroyed before singletons,
<mask> // not managed by folly::Singleton, which were initialized in its
<mask> // constructor
</s> [sdk33] Update iOS with RN 0.59 </s> remove create_(),
[destroy_baton, print_destructor_stack_trace, teardown, type = type()]
(T* instance_ptr) mutable {
teardown(instance_ptr);
destroy_baton->post();
if (print_destructor_stack_trace->load()) {
std::string output = "Singleton " + type.name() + " was destroyed.\n";
auto stack_trace_getter = SingletonVault::stackTraceGetter().load();
auto stack_trace = stack_trace_getter ? stack_trace_getter() : "";
if (stack_trace.empty()) {
output += "Failed to get destructor stack trace.";
} else {
output += "Destructor stack trace:\n";
output += stack_trace;
</s> add create_(),
[destroy_baton, print_destructor_stack_trace, type = type()](T*) mutable {
destroy_baton->post();
if (print_destructor_stack_trace->load()) {
detail::singletonPrintDestructionStackTrace(type); </s> remove if (c == '\r') output += 'r';
else if (c == '\n') output += 'n';
else if (c == '\t') output += 't';
else if (c == '\a') output += 'a';
else if (c == '\b') output += 'b';
else if (c == '\0') output += '0';
else if (c == '\\') output += '\\';
else {
</s> add if (c == '\r') {
output += 'r';
} else if (c == '\n') {
output += 'n';
} else if (c == '\t') {
output += 't';
} else if (c == '\a') {
output += 'a';
} else if (c == '\b') {
output += 'b';
} else if (c == '\0') {
output += '0';
} else if (c == '\\') {
output += '\\';
} else { </s> remove unsigned int niter = 0;
while (times-- > 0) {
niter += lambda();
}
return niter;
});
</s> add unsigned int niter = 0;
while (times-- > 0) {
niter += lambda();
}
return niter;
}); </s> remove bool operator!=(const exception_wrapper& a) const {
return !(*this == a);
}
</s> add template <class Fn, class A, class B, class... Bs>
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN auto
fold(Fn&& fn, A&& a, B&& b, Bs&&... bs) {
return fold(
// This looks like a use of fn after a move of fn, but in reality, this is
// just a cast and not a move. That's because regardless of which fold
// overload is selected, fn gets bound to a &&. Had fold taken fn by value
// there would indeed be a problem here.
static_cast<Fn&&>(fn),
static_cast<Fn&&>(fn)(static_cast<A&&>(a), static_cast<B&&>(b)),
static_cast<Bs&&>(bs)...);
} </s> remove destroyInstance();
</s> add </s> remove * Construct and inject a mock singleton which should be used only from tests.
* Unlike regular singletons which are initialized once per process lifetime,
* mock singletons live for the duration of a test. This means that one process
* running multiple tests can initialize and register the same singleton
* multiple times. This functionality should be used only from tests
* since it relaxes validation and performance in order to be able to perform
* the injection. The returned mock singleton is functionality identical to
* regular singletons.
*/
static void make_mock(std::nullptr_t /* c */ = nullptr,
typename Singleton<T>::TeardownFunc t = nullptr) {
</s> add * Construct and inject a mock singleton which should be used only from tests.
* Unlike regular singletons which are initialized once per process lifetime,
* mock singletons live for the duration of a test. This means that one
* process running multiple tests can initialize and register the same
* singleton multiple times. This functionality should be used only from tests
* since it relaxes validation and performance in order to be able to perform
* the injection. The returned mock singleton is functionality identical to
* regular singletons.
*/
static void make_mock(
std::nullptr_t /* c */ = nullptr,
typename Singleton<T>::TeardownFunc t = nullptr) {
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep replace replace replace replace keep keep replace
|
<mask> state_.store(SingletonHolderState::Living, std::memory_order_release);
<mask>
<mask> {
<mask> RWSpinLock::WriteHolder wh(&vault_.mutex_);
<mask> vault_.creation_order_.push_back(type());
<mask> }
<mask> }
<mask>
<mask> }
</s> [sdk33] Update iOS with RN 0.59 </s> remove RWSpinLock::WriteHolder wh(&vault_.mutex_);
</s> add auto creationOrder = vault_.creationOrder_.wlock(); </s> remove auto it = std::find(
vault_.creation_order_.begin(), vault_.creation_order_.end(), type());
if (it != vault_.creation_order_.end()) {
vault_.creation_order_.erase(it);
</s> add auto it = std::find(creationOrder->begin(), creationOrder->end(), type());
if (it != creationOrder->end()) {
creationOrder->erase(it); </s> remove destroyInstance();
</s> add </s> remove LOG(FATAL) << "Registering mock before singleton was registered: "
<< type().name();
</s> add detail::singletonWarnRegisterMockEarlyAndAbort(type());
}
if (state_ == SingletonHolderState::Living) {
destroyInstance(); </s> remove if (UNLIKELY(numUpdates_ >
parent_->cacheSize_.load(std::memory_order_acquire))) {
</s> add if (UNLIKELY(
numUpdates_ >
parent_->cacheSize_.load(std::memory_order_acquire))) {
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep keep keep keep replace
|
<mask> }
<mask>
<mask> }
<mask>
<mask> }
</s> [sdk33] Update iOS with RN 0.59 </s> remove }
</s> add } // namespace detail </s> remove } // namespace folly
</s> add } // namespace folly </s> remove } // namespace folly
</s> add } // namespace folly </s> remove iterator begin() { return data(); }
iterator end() { return data() + size(); }
const_iterator begin() const { return data(); }
const_iterator end() const { return data() + size(); }
const_iterator cbegin() const { return begin(); }
const_iterator cend() const { return end(); }
</s> add iterator begin() {
return data();
}
iterator end() {
return data() + size();
}
const_iterator begin() const {
return data();
}
const_iterator end() const {
return data() + size();
}
const_iterator cbegin() const {
return begin();
}
const_iterator cend() const {
return end();
} </s> remove if (parent_) {
flush();
}
</s> add flush(); </s> remove size_t size() const { return size_.load(std::memory_order_relaxed); }
</s> add size_t size() const {
return size_.load(std::memory_order_relaxed);
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton-inl.h
|
keep replace keep keep keep keep keep
|
<mask> /*
<mask> * Copyright 2016 Facebook, Inc.
<mask> *
<mask> * Licensed under the Apache License, Version 2.0 (the "License");
<mask> * you may not use this file except in compliance with the License.
<mask> * You may obtain a copy of the License at
<mask> *
</s> [sdk33] Update iOS with RN 0.59
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep keep replace keep keep keep keep replace
|
<mask>
<mask> // SingletonVault - a library to manage the creation and destruction
<mask> // of interdependent singletons.
<mask> //
<mask> // Basic usage of this class is very simple; suppose you have a class
<mask> // called MyExpensiveService, and you only want to construct one (ie,
<mask> // it's a singleton), but you only want to construct it if it is used.
<mask> //
<mask> // In your .h file:
<mask> // class MyExpensiveService { ... };
</s> [sdk33] Update iOS with RN 0.59 </s> remove // namespace { folly::Singleton<MyExpensiveService> the_singleton; }
</s> add // namespace { struct PrivateTag {}; }
// static folly::Singleton<MyExpensiveService, PrivateTag> the_singleton;
// std::shared_ptr<MyExpensiveService> MyExpensiveService::getInstance() {
// return the_singleton.try_get();
// } </s> remove // each must be given a unique tag. If no tag is specified - default tag is used
</s> add // each must be given a unique tag. If no tag is specified a default tag is
// used. We recommend that you use a tag from an anonymous namespace private to
// your implementation file, as this ensures that the singleton is only
// available via your interface and not also through Singleton<T>::try_get() </s> remove bool operator!=(const exception_wrapper& a) const {
return !(*this == a);
}
</s> add template <class Fn, class A, class B, class... Bs>
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN auto
fold(Fn&& fn, A&& a, B&& b, Bs&&... bs) {
return fold(
// This looks like a use of fn after a move of fn, but in reality, this is
// just a cast and not a move. That's because regardless of which fold
// overload is selected, fn gets bound to a &&. Had fold taken fn by value
// there would indeed be a problem here.
static_cast<Fn&&>(fn),
static_cast<Fn&&>(fn)(static_cast<A&&>(a), static_cast<B&&>(b)),
static_cast<Bs&&>(bs)...);
} </s> remove * Subprocess proc(cmd, Subprocess::pipeStdin());
* // write to proc.stdin()
</s> add * Subprocess proc(cmd, Subprocess::Options().pipeStdin());
* // write to proc.stdinFd() </s> remove // This is actually defined in our pthread implementation on
// Windows, but we don't want to include all of that just for this.
using pid_t = void*;
</s> add // This is a massive pain to have be an `int` due to the pthread implementation
// we support, but it's far more compatible with the rest of the windows world
// as an `int` than it would be as a `void*`
using pid_t = int;
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> // In your .h file:
<mask> // class MyExpensiveService { ... };
<mask> //
<mask> // In your .cpp file:
<mask> // namespace { folly::Singleton<MyExpensiveService> the_singleton; }
<mask> //
<mask> // Code can access it via:
<mask> //
<mask> // MyExpensiveService* instance = Singleton<MyExpensiveService>::get();
<mask> // or
</s> [sdk33] Update iOS with RN 0.59 </s> remove // Code can access it via:
</s> add // Code in other modules can access it via: </s> remove // class MyExpensiveService { ... };
</s> add // class MyExpensiveService {
// // Caution - may return a null ptr during startup and shutdown.
// static std::shared_ptr<MyExpensiveService> getInstance();
// ....
// }; </s> remove // MyExpensiveService* instance = Singleton<MyExpensiveService>::get();
// or
// std::weak_ptr<MyExpensiveService> instance =
// Singleton<MyExpensiveService>::get_weak();
</s> add // auto instance = MyExpensiveService::getInstance(); </s> remove // Basic usage of this class is very simple; suppose you have a class
</s> add // Recommended usage of this class: suppose you have a class </s> remove // each must be given a unique tag. If no tag is specified - default tag is used
</s> add // each must be given a unique tag. If no tag is specified a default tag is
// used. We recommend that you use a tag from an anonymous namespace private to
// your implementation file, as this ensures that the singleton is only
// available via your interface and not also through Singleton<T>::try_get() </s> remove // Please note, however, that all non-weak_ptr interfaces are
// inherently subject to races with destruction. Use responsibly.
</s> add // You can also access a singleton instance with
// `Singleton<ObjectType, TagType>::try_get()`. We recommend
// that you prefer the form `the_singleton.try_get()` because it ensures that
// `the_singleton` is used and cannot be garbage-collected during linking: this
// is necessary because the constructor of `the_singleton` is what registers it
// to the SingletonVault.
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep replace keep replace replace replace replace keep keep keep keep
|
<mask> //
<mask> // Code can access it via:
<mask> //
<mask> // MyExpensiveService* instance = Singleton<MyExpensiveService>::get();
<mask> // or
<mask> // std::weak_ptr<MyExpensiveService> instance =
<mask> // Singleton<MyExpensiveService>::get_weak();
<mask> //
<mask> // You also can directly access it by the variable defining the
<mask> // singleton rather than via get(), and even treat that variable like
<mask> // a smart pointer (dereferencing it or using the -> operator).
</s> [sdk33] Update iOS with RN 0.59 </s> remove // You also can directly access it by the variable defining the
// singleton rather than via get(), and even treat that variable like
// a smart pointer (dereferencing it or using the -> operator).
</s> add // Advanced usage and notes: </s> remove // Please note, however, that all non-weak_ptr interfaces are
// inherently subject to races with destruction. Use responsibly.
</s> add // You can also access a singleton instance with
// `Singleton<ObjectType, TagType>::try_get()`. We recommend
// that you prefer the form `the_singleton.try_get()` because it ensures that
// `the_singleton` is used and cannot be garbage-collected during linking: this
// is necessary because the constructor of `the_singleton` is what registers it
// to the SingletonVault. </s> remove // namespace { folly::Singleton<MyExpensiveService> the_singleton; }
</s> add // namespace { struct PrivateTag {}; }
// static folly::Singleton<MyExpensiveService, PrivateTag> the_singleton;
// std::shared_ptr<MyExpensiveService> MyExpensiveService::getInstance() {
// return the_singleton.try_get();
// } </s> remove // class MyExpensiveService { ... };
</s> add // class MyExpensiveService {
// // Caution - may return a null ptr during startup and shutdown.
// static std::shared_ptr<MyExpensiveService> getInstance();
// ....
// }; </s> remove * LockedGuardPtr is a simplified version of LockedPtr.
</s> add * Helper functions that should be passed to either a lock() or synchronized()
* invocation, these return implementation defined structs that will be used
* to lock the synchronized instance appropriately.
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep replace replace replace keep replace replace keep keep keep keep
|
<mask> // std::weak_ptr<MyExpensiveService> instance =
<mask> // Singleton<MyExpensiveService>::get_weak();
<mask> //
<mask> // You also can directly access it by the variable defining the
<mask> // singleton rather than via get(), and even treat that variable like
<mask> // a smart pointer (dereferencing it or using the -> operator).
<mask> //
<mask> // Please note, however, that all non-weak_ptr interfaces are
<mask> // inherently subject to races with destruction. Use responsibly.
<mask> //
<mask> // The singleton will be created on demand. If the constructor for
<mask> // MyExpensiveService actually makes use of *another* Singleton, then
<mask> // the right thing will happen -- that other singleton will complete
</s> [sdk33] Update iOS with RN 0.59 </s> remove // MyExpensiveService* instance = Singleton<MyExpensiveService>::get();
// or
// std::weak_ptr<MyExpensiveService> instance =
// Singleton<MyExpensiveService>::get_weak();
</s> add // auto instance = MyExpensiveService::getInstance(); </s> remove // Code can access it via:
</s> add // Code in other modules can access it via: </s> remove * The relationship between LockedGuardPtr and LockedPtr is similar to that
* between std::lock_guard and std::unique_lock.
</s> add * For example in the above rlock() produces an implementation defined read
* locking helper instance and wlock() a write locking helper
*
* Subsequent arguments passed to these locking helpers, after the first, will
* be passed by const-ref to the corresponding function on the synchronized
* instance. This means that if the function accepts these parameters by
* value, they will be copied. Note that it is not necessary that the primary
* locking function will be invoked at all (for eg. the implementation might
* just invoke the try*Lock() method)
*
* // Try to acquire the lock for one second
* synchronized([](auto) { ... }, wlock(one, 1s));
*
* // The timed lock acquire might never actually be called, if it is not
* // needed by the underlying deadlock avoiding algorithm
* synchronized([](auto, auto) { ... }, rlock(one), wlock(two, 1s));
*
* Note that the arguments passed to to *lock() calls will be passed by
* const-ref to the function invocation, as the implementation might use them
* many times </s> remove // each must be given a unique tag. If no tag is specified - default tag is used
</s> add // each must be given a unique tag. If no tag is specified a default tag is
// used. We recommend that you use a tag from an anonymous namespace private to
// your implementation file, as this ensures that the singleton is only
// available via your interface and not also through Singleton<T>::try_get() </s> remove FOLLY_DEPRECATED("Replaced by try_get")
static std::weak_ptr<T> get_weak() { return getEntry().get_weak(); }
</s> add [[deprecated("Replaced by try_get")]] static std::weak_ptr<T> get_weak() {
return getEntry().get_weak();
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> // construction before get() returns. However, in the event of a
<mask> // circular dependency, a runtime error will occur.
<mask> //
<mask> // You can have multiple singletons of the same underlying type, but
<mask> // each must be given a unique tag. If no tag is specified - default tag is used
<mask> //
<mask> // namespace {
<mask> // struct Tag1 {};
<mask> // struct Tag2 {};
<mask> // folly::Singleton<MyExpensiveService> s_default;
</s> [sdk33] Update iOS with RN 0.59 </s> remove struct DefaultTag {};
</s> add </s> remove // Please note, however, that all non-weak_ptr interfaces are
// inherently subject to races with destruction. Use responsibly.
</s> add // You can also access a singleton instance with
// `Singleton<ObjectType, TagType>::try_get()`. We recommend
// that you prefer the form `the_singleton.try_get()` because it ensures that
// `the_singleton` is used and cannot be garbage-collected during linking: this
// is necessary because the constructor of `the_singleton` is what registers it
// to the SingletonVault. </s> remove * Construct and inject a mock singleton which should be used only from tests.
* Unlike regular singletons which are initialized once per process lifetime,
* mock singletons live for the duration of a test. This means that one process
* running multiple tests can initialize and register the same singleton
* multiple times. This functionality should be used only from tests
* since it relaxes validation and performance in order to be able to perform
* the injection. The returned mock singleton is functionality identical to
* regular singletons.
*/
static void make_mock(std::nullptr_t /* c */ = nullptr,
typename Singleton<T>::TeardownFunc t = nullptr) {
</s> add * Construct and inject a mock singleton which should be used only from tests.
* Unlike regular singletons which are initialized once per process lifetime,
* mock singletons live for the duration of a test. This means that one
* process running multiple tests can initialize and register the same
* singleton multiple times. This functionality should be used only from tests
* since it relaxes validation and performance in order to be able to perform
* the injection. The returned mock singleton is functionality identical to
* regular singletons.
*/
static void make_mock(
std::nullptr_t /* c */ = nullptr,
typename Singleton<T>::TeardownFunc t = nullptr) { </s> remove // namespace { folly::Singleton<MyExpensiveService> the_singleton; }
</s> add // namespace { struct PrivateTag {}; }
// static folly::Singleton<MyExpensiveService, PrivateTag> the_singleton;
// std::shared_ptr<MyExpensiveService> MyExpensiveService::getInstance() {
// return the_singleton.try_get();
// } </s> remove template <typename Fun>
/* implicit */ FunctionRef(Fun&& fun) noexcept {
using ReferencedType = typename std::remove_reference<Fun>::type;
static_assert(
std::is_convertible<
typename std::result_of<ReferencedType&(Args && ...)>::type,
ReturnType>::value,
"FunctionRef cannot be constructed from object with "
"incompatible function signature");
// `Fun` may be a const type, in which case we have to do a const_cast
// to store the address in a `void*`. This is safe because the `void*`
// will be cast back to `Fun*` (which is a const pointer whenever `Fun`
// is a const type) inside `FunctionRef::call`
object_ = const_cast<void*>(static_cast<void const*>(std::addressof(fun)));
call_ = &FunctionRef::call<ReferencedType>;
}
</s> add template <
typename Fun,
typename std::enable_if<
Conjunction<
Negation<std::is_same<FunctionRef, _t<std::decay<Fun>>>>,
is_invocable_r<ReturnType, Fun&&, Args&&...>>::value,
int>::type = 0>
constexpr /* implicit */ FunctionRef(Fun&& fun) noexcept
// `Fun` may be a const type, in which case we have to do a const_cast
// to store the address in a `void*`. This is safe because the `void*`
// will be cast back to `Fun*` (which is a const pointer whenever `Fun`
// is a const type) inside `FunctionRef::call`
: object_(
const_cast<void*>(static_cast<void const*>(std::addressof(fun)))),
call_(&FunctionRef::call<Fun>) {} </s> remove // This will return a non-nullptr only if the exception is held as a
// copy. It is the only interface which will distinguish between an
// exception held this way, and by exception_ptr. You probably
// shouldn't use it at all.
std::exception* getCopied() { return item_.get(); }
const std::exception* getCopied() const { return item_.get(); }
fbstring what() const {
if (item_) {
return exceptionStr(*item_);
} else if (eptr_) {
return estr_;
} else {
return fbstring();
}
}
</s> add } // namespace exception_wrapper_detail
//! Throwing exceptions can be a convenient way to handle errors. Storing
//! exceptions in an `exception_ptr` makes it easy to handle exceptions in a
//! different thread or at a later time. `exception_ptr` can also be used in a
//! very generic result/exception wrapper.
//!
//! However, there are some issues with throwing exceptions and
//! `std::exception_ptr`. These issues revolve around `throw` being expensive,
//! particularly in a multithreaded environment (see
//! ExceptionWrapperBenchmark.cpp).
//!
//! Imagine we have a library that has an API which returns a result/exception
//! wrapper. Let's consider some approaches for implementing this wrapper.
//! First, we could store a `std::exception`. This approach loses the derived
//! exception type, which can make exception handling more difficult for users
//! that prefer rethrowing the exception. We could use a `folly::dynamic` for
//! every possible type of exception. This is not very flexible - adding new
//! types of exceptions requires a change to the result/exception wrapper. We
//! could use an `exception_ptr`. However, constructing an `exception_ptr` as
//! well as accessing the error requires a call to throw. That means that there
//! will be two calls to throw in order to process the exception. For
//! performance sensitive applications, this may be unacceptable.
//!
//! `exception_wrapper` is designed to handle exception management for both
//! convenience and high performance use cases. `make_exception_wrapper` is
//! templated on derived type, allowing us to rethrow the exception properly for
//! users that prefer convenience. These explicitly named exception types can
//! therefore be handled without any peformance penalty. `exception_wrapper` is
//! also flexible enough to accept any type. If a caught exception is not of an
//! explicitly named type, then `std::exception_ptr` is used to preserve the
//! exception state. For performance sensitive applications, the accessor
//! methods can test or extract a pointer to a specific exception type with very
//! little overhead.
//!
//! \par Example usage:
//! \par
//! \code
//! exception_wrapper globalExceptionWrapper;
//!
//! // Thread1
//! void doSomethingCrazy() {
//! int rc = doSomethingCrazyWithLameReturnCodes();
//! if (rc == NAILED_IT) {
//! globalExceptionWrapper = exception_wrapper();
//! } else if (rc == FACE_PLANT) {
//! globalExceptionWrapper = make_exception_wrapper<FacePlantException>();
//! } else if (rc == FAIL_WHALE) {
//! globalExceptionWrapper = make_exception_wrapper<FailWhaleException>();
//! }
//! }
//!
//! // Thread2: Exceptions are ok!
//! void processResult() {
//! try {
//! globalExceptionWrapper.throw_exception();
//! } catch (const FacePlantException& e) {
//! LOG(ERROR) << "FACEPLANT!";
//! } catch (const FailWhaleException& e) {
//! LOG(ERROR) << "FAILWHALE!";
//! }
//! }
//!
//! // Thread2: Exceptions are bad!
//! void processResult() {
//! globalExceptionWrapper.handle(
//! [&](FacePlantException& faceplant) {
//! LOG(ERROR) << "FACEPLANT";
//! },
//! [&](FailWhaleException& failwhale) {
//! LOG(ERROR) << "FAILWHALE!";
//! },
//! [](...) {
//! LOG(FATAL) << "Unrecognized exception";
//! });
//! }
//! \endcode
class exception_wrapper final {
private:
struct FOLLY_EXPORT AnyException : std::exception {
std::type_info const* typeinfo_;
template <class T>
/* implicit */ AnyException(T&& t) noexcept : typeinfo_(&typeid(t)) {}
};
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep replace keep replace replace replace replace keep keep keep keep
|
<mask> // should call reenableInstances.
<mask>
<mask> #pragma once
<mask> #include <folly/Baton.h>
<mask> #include <folly/Exception.h>
<mask> #include <folly/Hash.h>
<mask> #include <folly/Memory.h>
<mask> #include <folly/RWSpinLock.h>
<mask> #include <folly/Demangle.h>
<mask> #include <folly/Executor.h>
<mask> #include <folly/experimental/ReadMostlySharedPtr.h>
<mask> #include <folly/detail/StaticSingletonManager.h>
<mask>
</s> [sdk33] Update iOS with RN 0.59 </s> remove #include <folly/experimental/ReadMostlySharedPtr.h>
</s> add #include <folly/Memory.h>
#include <folly/Synchronized.h>
#include <folly/detail/Singleton.h> </s> add #include <folly/experimental/ReadMostlySharedPtr.h>
#include <folly/hash/Hash.h>
#include <folly/lang/Exception.h>
#include <folly/synchronization/Baton.h>
#include <folly/synchronization/RWSpinLock.h> </s> add #include <folly/CPortability.h> </s> add #include <cstdint> </s> remove #include <boost/iterator/iterator_facade.hpp>
</s> add #include <iterator>
#include <type_traits>
#include <utility>
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> #include <folly/Memory.h>
<mask> #include <folly/RWSpinLock.h>
<mask> #include <folly/Demangle.h>
<mask> #include <folly/Executor.h>
<mask> #include <folly/experimental/ReadMostlySharedPtr.h>
<mask> #include <folly/detail/StaticSingletonManager.h>
<mask>
<mask> #include <algorithm>
<mask> #include <atomic>
<mask> #include <condition_variable>
</s> [sdk33] Update iOS with RN 0.59 </s> remove #include <folly/Hash.h>
#include <folly/Memory.h>
#include <folly/RWSpinLock.h>
#include <folly/Demangle.h>
</s> add </s> add #include <folly/experimental/ReadMostlySharedPtr.h>
#include <folly/hash/Hash.h>
#include <folly/lang/Exception.h>
#include <folly/synchronization/Baton.h>
#include <folly/synchronization/RWSpinLock.h> </s> add #include <list> </s> remove #include <folly/Baton.h>
</s> add </s> add #include <new>
#include <type_traits>
#include <typeinfo>
#include <utility>
#include <folly/CPortability.h>
#include <folly/Demangle.h> </s> remove #include <boost/implicit_cast.hpp>
</s> add
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep add keep keep keep keep keep
|
<mask> #include <folly/detail/Singleton.h>
<mask> #include <folly/detail/StaticSingletonManager.h>
<mask>
<mask> #include <algorithm>
<mask> #include <atomic>
<mask> #include <condition_variable>
<mask> #include <functional>
</s> [sdk33] Update iOS with RN 0.59 </s> remove #include <folly/experimental/ReadMostlySharedPtr.h>
</s> add #include <folly/Memory.h>
#include <folly/Synchronized.h>
#include <folly/detail/Singleton.h> </s> add #include <list> </s> remove #include <folly/Hash.h>
#include <folly/Memory.h>
#include <folly/RWSpinLock.h>
#include <folly/Demangle.h>
</s> add </s> remove #include <memory>
</s> add #include <functional> </s> remove #include <iterator>
</s> add </s> add #include <cstdlib>
#include <cstring>
#include <iterator>
#include <stdexcept>
#include <type_traits>
#include <utility>
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep add keep keep keep keep
|
<mask> #include <algorithm>
<mask> #include <atomic>
<mask> #include <condition_variable>
<mask> #include <functional>
<mask> #include <memory>
<mask> #include <mutex>
<mask> #include <string>
<mask> #include <thread>
</s> [sdk33] Update iOS with RN 0.59 </s> add #include <folly/experimental/ReadMostlySharedPtr.h>
#include <folly/hash/Hash.h>
#include <folly/lang/Exception.h>
#include <folly/synchronization/Baton.h>
#include <folly/synchronization/RWSpinLock.h> </s> remove #include <folly/experimental/ReadMostlySharedPtr.h>
</s> add #include <folly/Memory.h>
#include <folly/Synchronized.h>
#include <folly/detail/Singleton.h> </s> remove #include <memory>
</s> add #include <functional> </s> remove #include <functional>
</s> add </s> add #include <memory> </s> remove #include <iterator>
</s> add
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> class SingletonVault;
<mask>
<mask> namespace detail {
<mask>
<mask> struct DefaultTag {};
<mask>
<mask> // A TypeDescriptor is the unique handle for a given singleton. It is
<mask> // a combinaiton of the type and of the optional name, and is used as
<mask> // a key in unordered_maps.
<mask> class TypeDescriptor {
<mask> public:
</s> [sdk33] Update iOS with RN 0.59 </s> remove TypeDescriptor(const std::type_info& ti,
const std::type_info& tag_ti)
: ti_(ti), tag_ti_(tag_ti) {
}
</s> add TypeDescriptor(const std::type_info& ti, const std::type_info& tag_ti)
: ti_(ti), tag_ti_(tag_ti) {} </s> remove // each must be given a unique tag. If no tag is specified - default tag is used
</s> add // each must be given a unique tag. If no tag is specified a default tag is
// used. We recommend that you use a tag from an anonymous namespace private to
// your implementation file, as this ensures that the singleton is only
// available via your interface and not also through Singleton<T>::try_get() </s> remove fbstring class_name() const {
if (item_) {
auto& i = *item_;
return demangle(typeid(i));
} else if (eptr_) {
return ename_;
} else {
return fbstring();
}
}
</s> add template <class Fn>
struct arg_type_;
template <class Fn>
using arg_type = _t<arg_type_<Fn>>;
// exception_wrapper is implemented as a simple variant over four
// different representations:
// 0. Empty, no exception.
// 1. An small object stored in-situ.
// 2. A larger object stored on the heap and referenced with a
// std::shared_ptr.
// 3. A std::exception_ptr, together with either:
// a. A pointer to the referenced std::exception object, or
// b. A pointer to a std::type_info object for the referenced exception,
// or for an unspecified type if the type is unknown.
// This is accomplished with the help of a union and a pointer to a hand-
// rolled virtual table. This virtual table contains pointers to functions
// that know which field of the union is active and do the proper action.
// The class invariant ensures that the vtable ptr and the union stay in sync.
struct VTable {
void (*copy_)(exception_wrapper const*, exception_wrapper*);
void (*move_)(exception_wrapper*, exception_wrapper*);
void (*delete_)(exception_wrapper*);
void (*throw_)(exception_wrapper const*);
std::type_info const* (*type_)(exception_wrapper const*);
std::exception const* (*get_exception_)(exception_wrapper const*);
exception_wrapper (*get_exception_ptr_)(exception_wrapper const*);
}; </s> remove /*
</s> add /** </s> remove bool operator!=(const exception_wrapper& a) const {
return !(*this == a);
}
</s> add template <class Fn, class A, class B, class... Bs>
FOLLY_ALWAYS_INLINE FOLLY_ATTR_VISIBILITY_HIDDEN auto
fold(Fn&& fn, A&& a, B&& b, Bs&&... bs) {
return fold(
// This looks like a use of fn after a move of fn, but in reality, this is
// just a cast and not a move. That's because regardless of which fold
// overload is selected, fn gets bound to a &&. Had fold taken fn by value
// there would indeed be a problem here.
static_cast<Fn&&>(fn),
static_cast<Fn&&>(fn)(static_cast<A&&>(a), static_cast<B&&>(b)),
static_cast<Bs&&>(bs)...);
} </s> remove #include <boost/type_traits.hpp>
#include <boost/mpl/has_xxx.hpp>
</s> add #define FOLLY_CREATE_HAS_MEMBER_TYPE_TRAITS(classname, type_name) \
template <typename TTheClass_> \
struct classname##__folly_traits_impl__ { \
template <typename UTheClass_> \
static constexpr bool test(typename UTheClass_::type_name*) { \
return true; \
} \
template <typename> \
static constexpr bool test(...) { \
return false; \
} \
}; \
template <typename TTheClass_> \
using classname = typename std::conditional< \
classname##__folly_traits_impl__<TTheClass_>::template test<TTheClass_>( \
nullptr), \
std::true_type, \
std::false_type>::type
#define FOLLY_CREATE_HAS_MEMBER_FN_TRAITS_IMPL(classname, func_name, cv_qual) \
template <typename TTheClass_, typename RTheReturn_, typename... TTheArgs_> \
struct classname##__folly_traits_impl__< \
TTheClass_, \
RTheReturn_(TTheArgs_...) cv_qual> { \
template < \
typename UTheClass_, \
RTheReturn_ (UTheClass_::*)(TTheArgs_...) cv_qual> \
struct sfinae {}; \
template <typename UTheClass_> \
static std::true_type test(sfinae<UTheClass_, &UTheClass_::func_name>*); \
template <typename> \
static std::false_type test(...); \
}
/*
* The FOLLY_CREATE_HAS_MEMBER_FN_TRAITS is used to create traits
* classes that check for the existence of a member function with
* a given name and signature. It currently does not support
* checking for inherited members.
*
* Such classes receive two template parameters: the class to be checked
* and the signature of the member function. A static boolean field
* named `value` (which is also constexpr) tells whether such member
* function exists.
*
* Each traits class created is bound only to the member name, not to
* its signature nor to the type of the class containing it.
*
* Say you need to know if a given class has a member function named
* `test` with the following signature:
*
* int test() const;
*
* You'd need this macro to create a traits class to check for a member
* named `test`, and then use this traits class to check for the signature:
*
* namespace {
*
* FOLLY_CREATE_HAS_MEMBER_FN_TRAITS(has_test_traits, test);
*
* } // unnamed-namespace
*
* void some_func() {
* cout << "Does class Foo have a member int test() const? "
* << boolalpha << has_test_traits<Foo, int() const>::value;
* }
*
* You can use the same traits class to test for a completely different
* signature, on a completely different class, as long as the member name
* is the same:
*
* void some_func() {
* cout << "Does class Foo have a member int test()? "
* << boolalpha << has_test_traits<Foo, int()>::value;
* cout << "Does class Foo have a member int test() const? "
* << boolalpha << has_test_traits<Foo, int() const>::value;
* cout << "Does class Bar have a member double test(const string&, long)? "
* << boolalpha << has_test_traits<Bar, double(const string&, long)>::value;
* }
*
* @author: Marcelo Juchem <[email protected]>
*/
#define FOLLY_CREATE_HAS_MEMBER_FN_TRAITS(classname, func_name) \
template <typename, typename> \
struct classname##__folly_traits_impl__; \
FOLLY_CREATE_HAS_MEMBER_FN_TRAITS_IMPL(classname, func_name, ); \
FOLLY_CREATE_HAS_MEMBER_FN_TRAITS_IMPL(classname, func_name, const); \
FOLLY_CREATE_HAS_MEMBER_FN_TRAITS_IMPL( \
classname, func_name, /* nolint */ volatile); \
FOLLY_CREATE_HAS_MEMBER_FN_TRAITS_IMPL( \
classname, func_name, /* nolint */ volatile const); \
template <typename TTheClass_, typename TTheSignature_> \
using classname = \
decltype(classname##__folly_traits_impl__<TTheClass_, TTheSignature_>:: \
template test<TTheClass_>(nullptr))
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep keep replace replace replace replace keep keep replace replace keep keep keep keep
|
<mask> // a combinaiton of the type and of the optional name, and is used as
<mask> // a key in unordered_maps.
<mask> class TypeDescriptor {
<mask> public:
<mask> TypeDescriptor(const std::type_info& ti,
<mask> const std::type_info& tag_ti)
<mask> : ti_(ti), tag_ti_(tag_ti) {
<mask> }
<mask>
<mask> TypeDescriptor(const TypeDescriptor& other)
<mask> : ti_(other.ti_), tag_ti_(other.tag_ti_) {
<mask> }
<mask>
<mask> TypeDescriptor& operator=(const TypeDescriptor& other) {
<mask> if (this != &other) {
<mask> ti_ = other.ti_;
</s> [sdk33] Update iOS with RN 0.59 </s> remove struct DefaultTag {};
</s> add </s> remove std::string name() const {
auto ret = demangle(ti_.name());
if (tag_ti_ != std::type_index(typeid(DefaultTag))) {
ret += "/";
ret += demangle(tag_ti_.name());
}
return ret.toStdString();
}
</s> add std::string name() const; </s> remove ThreadLocalPtr(ThreadLocalPtr&& other) noexcept :
id_(std::move(other.id_)) {
}
</s> add ThreadLocalPtr(ThreadLocalPtr&& other) noexcept : id_(std::move(other.id_)) {} </s> remove : ptr_(other.ptr_), data_(std::move(other.data_)) {
other.ptr_ = nullptr;
}
</s> add : ptr_(exchange(other.ptr_, nullptr)), data_(std::move(other.data_)) {} </s> remove Accessor(const Accessor &accessor) :
sl_(accessor.sl_),
slHolder_(accessor.slHolder_) {
</s> add Accessor(const Accessor& accessor)
: sl_(accessor.sl_), slHolder_(accessor.slHolder_) {
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask>
<mask> return *this;
<mask> }
<mask>
<mask> std::string name() const {
<mask> auto ret = demangle(ti_.name());
<mask> if (tag_ti_ != std::type_index(typeid(DefaultTag))) {
<mask> ret += "/";
<mask> ret += demangle(tag_ti_.name());
<mask> }
<mask> return ret.toStdString();
<mask> }
<mask>
<mask> friend class TypeDescriptorHasher;
<mask>
<mask> bool operator==(const TypeDescriptor& other) const {
<mask> return ti_ == other.ti_ && tag_ti_ == other.tag_ti_;
</s> [sdk33] Update iOS with RN 0.59 </s> remove : ti_(other.ti_), tag_ti_(other.tag_ti_) {
}
</s> add : ti_(other.ti_), tag_ti_(other.tag_ti_) {} </s> remove template<class,class> friend class csl_iterator;
</s> add template <class, class>
friend class csl_iterator; </s> remove void increment() { node_ = node_->next(); };
bool equal(const csl_iterator& other) const { return node_ == other.node_; }
value_type& dereference() const { return node_->data(); }
</s> add void increment() {
node_ = node_->next();
}
bool equal(const csl_iterator& other) const {
return node_ == other.node_;
}
value_type& dereference() const {
return node_->data();
} </s> remove auto accessor = cache_.accessAllThreads();
</s> add const auto accessor = cache_.accessAllThreads(); </s> remove if (c == '\r') output += 'r';
else if (c == '\n') output += 'n';
else if (c == '\t') output += 't';
else if (c == '\a') output += 'a';
else if (c == '\b') output += 'b';
else if (c == '\0') output += '0';
else if (c == '\\') output += '\\';
else {
</s> add if (c == '\r') {
output += 'r';
} else if (c == '\n') {
output += 'n';
} else if (c == '\t') {
output += 't';
} else if (c == '\a') {
output += 'a';
} else if (c == '\b') {
output += 'b';
} else if (c == '\0') {
output += '0';
} else if (c == '\\') {
output += '\\';
} else { </s> remove bool good() const { return node_ != nullptr; }
</s> add bool good() const {
return node_ != nullptr;
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep add keep keep keep keep
|
<mask> inline T* get();
<mask> inline std::weak_ptr<T> get_weak();
<mask> inline std::shared_ptr<T> try_get();
<mask> inline folly::ReadMostlySharedPtr<T> try_get_fast();
<mask>
<mask> void registerSingleton(CreateFunc c, TeardownFunc t);
<mask> void registerSingletonMock(CreateFunc c, TeardownFunc t);
<mask> bool hasLiveInstance() override;
</s> [sdk33] Update iOS with RN 0.59 </s> remove virtual bool hasLiveInstance() override;
virtual void createInstance() override;
virtual bool creationStarted() override;
virtual void preDestroyInstance(ReadMostlyMainPtrDeleter<>&) override;
virtual void destroyInstance() override;
</s> add bool hasLiveInstance() override;
void createInstance() override;
bool creationStarted() override;
void preDestroyInstance(ReadMostlyMainPtrDeleter<>&) override;
void destroyInstance() override; </s> remove inline size_t delimSize(char) { return 1; }
inline size_t delimSize(StringPiece s) { return s.size(); }
</s> add inline size_t delimSize(char) {
return 1;
}
inline size_t delimSize(StringPiece s) {
return s.size();
} </s> remove return *s == c;
</s> add return *s == c; </s> remove inline char prepareDelim(char c) { return c; }
</s> add inline char prepareDelim(char c) {
return c;
}
template <class OutputType>
void toOrIgnore(StringPiece input, OutputType& output) {
output = folly::to<OutputType>(input);
}
inline void toOrIgnore(StringPiece, decltype(std::ignore)&) {} </s> remove static inline void
derefToCache(std::pair<F, S>* mem, const dynamic::const_item_iterator& it) {
new (mem) std::pair<F, S>(
convertTo<F>(it->first), convertTo<S>(it->second)
);
</s> add static inline void derefToCache(
Optional<std::pair<F, S>>* mem,
const dynamic::const_item_iterator& it) {
mem->emplace(convertTo<F>(it->first), convertTo<S>(it->second)); </s> remove throw BadFormatArg(errorStr(std::forward<Args>(args)...));
</s> add throw_exception<BadFormatArg>(errorStr(std::forward<Args>(args)...));
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
|
<mask> inline folly::ReadMostlySharedPtr<T> try_get_fast();
<mask>
<mask> void registerSingleton(CreateFunc c, TeardownFunc t);
<mask> void registerSingletonMock(CreateFunc c, TeardownFunc t);
<mask> virtual bool hasLiveInstance() override;
<mask> virtual void createInstance() override;
<mask> virtual bool creationStarted() override;
<mask> virtual void preDestroyInstance(ReadMostlyMainPtrDeleter<>&) override;
<mask> virtual void destroyInstance() override;
<mask>
<mask> private:
<mask> SingletonHolder(TypeDescriptor type, SingletonVault& vault);
<mask>
<mask> enum class SingletonHolderState {
</s> [sdk33] Update iOS with RN 0.59 </s> add inline void vivify(); </s> remove static void make_mock(CreateFunc c,
typename Singleton<T>::TeardownFunc t = nullptr) {
</s> add static void make_mock(
CreateFunc c,
typename Singleton<T>::TeardownFunc t = nullptr) { </s> remove fbstring class_name() const {
if (item_) {
auto& i = *item_;
return demangle(typeid(i));
} else if (eptr_) {
return ename_;
} else {
return fbstring();
}
}
</s> add template <class Fn>
struct arg_type_;
template <class Fn>
using arg_type = _t<arg_type_<Fn>>;
// exception_wrapper is implemented as a simple variant over four
// different representations:
// 0. Empty, no exception.
// 1. An small object stored in-situ.
// 2. A larger object stored on the heap and referenced with a
// std::shared_ptr.
// 3. A std::exception_ptr, together with either:
// a. A pointer to the referenced std::exception object, or
// b. A pointer to a std::type_info object for the referenced exception,
// or for an unspecified type if the type is unknown.
// This is accomplished with the help of a union and a pointer to a hand-
// rolled virtual table. This virtual table contains pointers to functions
// that know which field of the union is active and do the proper action.
// The class invariant ensures that the vtable ptr and the union stay in sync.
struct VTable {
void (*copy_)(exception_wrapper const*, exception_wrapper*);
void (*move_)(exception_wrapper*, exception_wrapper*);
void (*delete_)(exception_wrapper*);
void (*throw_)(exception_wrapper const*);
std::type_info const* (*type_)(exception_wrapper const*);
std::exception const* (*get_exception_)(exception_wrapper const*);
exception_wrapper (*get_exception_ptr_)(exception_wrapper const*);
}; </s> remove LOG(FATAL) << "Registering mock before singleton was registered: "
<< type().name();
</s> add detail::singletonWarnRegisterMockEarlyAndAbort(type());
}
if (state_ == SingletonHolderState::Living) {
destroyInstance(); </s> remove inline char prepareDelim(char c) { return c; }
</s> add inline char prepareDelim(char c) {
return c;
}
template <class OutputType>
void toOrIgnore(StringPiece input, OutputType& output) {
output = folly::to<OutputType>(input);
}
inline void toOrIgnore(StringPiece, decltype(std::ignore)&) {} </s> remove void increment() { node_ = node_->next(); };
bool equal(const csl_iterator& other) const { return node_ == other.node_; }
value_type& dereference() const { return node_->data(); }
</s> add void increment() {
node_ = node_->next();
}
bool equal(const csl_iterator& other) const {
return node_ == other.node_;
}
value_type& dereference() const {
return node_->data();
}
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> // instance_weak can be safely accessed w/o synchronization.
<mask> std::atomic<SingletonHolderState> state_{SingletonHolderState::NotRegistered};
<mask>
<mask> // the thread creating the singleton (only valid while creating an object)
<mask> std::atomic<std::thread::id> creating_thread_;
<mask>
<mask> // The singleton itself and related functions.
<mask>
<mask> // holds a ReadMostlyMainPtr to singleton instance, set when state is changed
<mask> // from Dead to Living. Reset when state is changed from Living to Dead.
</s> [sdk33] Update iOS with RN 0.59 </s> remove {
RWSpinLock::WriteHolder wh(&vault_.mutex_);
vault_.creation_order_.push_back(type());
}
</s> add vault_.creationOrder_.wlock()->push_back(type()); </s> remove // The two stages of life for a vault, as mentioned in the class comment.
enum class SingletonVaultState {
Running,
Quiescing,
};
// Each singleton in the vault can be in two states: dead
// (registered but never created), living (CreateFunc returned an instance).
void stateCheck(SingletonVaultState expected,
const char* msg="Unexpected singleton state change") {
if (expected != state_) {
throw std::logic_error(msg);
}
}
</s> add </s> remove * Construct and inject a mock singleton which should be used only from tests.
* Unlike regular singletons which are initialized once per process lifetime,
* mock singletons live for the duration of a test. This means that one process
* running multiple tests can initialize and register the same singleton
* multiple times. This functionality should be used only from tests
* since it relaxes validation and performance in order to be able to perform
* the injection. The returned mock singleton is functionality identical to
* regular singletons.
*/
static void make_mock(std::nullptr_t /* c */ = nullptr,
typename Singleton<T>::TeardownFunc t = nullptr) {
</s> add * Construct and inject a mock singleton which should be used only from tests.
* Unlike regular singletons which are initialized once per process lifetime,
* mock singletons live for the duration of a test. This means that one
* process running multiple tests can initialize and register the same
* singleton multiple times. This functionality should be used only from tests
* since it relaxes validation and performance in order to be able to perform
* the injection. The returned mock singleton is functionality identical to
* regular singletons.
*/
static void make_mock(
std::nullptr_t /* c */ = nullptr,
typename Singleton<T>::TeardownFunc t = nullptr) { </s> remove // Please note, however, that all non-weak_ptr interfaces are
// inherently subject to races with destruction. Use responsibly.
</s> add // You can also access a singleton instance with
// `Singleton<ObjectType, TagType>::try_get()`. We recommend
// that you prefer the form `the_singleton.try_get()` because it ensures that
// `the_singleton` is used and cannot be garbage-collected during linking: this
// is necessary because the constructor of `the_singleton` is what registers it
// to the SingletonVault. </s> remove FOLLY_DEPRECATED("Replaced by try_get")
static std::weak_ptr<T> get_weak() { return getEntry().get_weak(); }
</s> add [[deprecated("Replaced by try_get")]] static std::weak_ptr<T> get_weak() {
return getEntry().get_weak();
} </s> remove parent_to_pass_on);
</s> add exchange(this->parent_, nullptr));
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> SingletonHolder& operator=(SingletonHolder&&) = delete;
<mask> SingletonHolder(SingletonHolder&&) = delete;
<mask> };
<mask>
<mask> }
<mask>
<mask> class SingletonVault {
<mask> public:
<mask> enum class Type {
<mask> Strict, // Singletons can't be created before registrationComplete()
</s> [sdk33] Update iOS with RN 0.59 </s> remove BenchmarkSuspender(const BenchmarkSuspender &) = delete;
BenchmarkSuspender(BenchmarkSuspender && rhs) noexcept {
</s> add BenchmarkSuspender(const BenchmarkSuspender&) = delete;
BenchmarkSuspender(BenchmarkSuspender&& rhs) noexcept { </s> remove enum {
</s> add enum : uint16_t { </s> remove static SkipListRandomHeight *instance() {
</s> add static SkipListRandomHeight* instance() { </s> remove exec_(Op::NUKE, &data_, nullptr);
</s> add exec(Op::NUKE, &data_, nullptr); </s> remove : ptr_(other.ptr_), data_(std::move(other.data_)) {
other.ptr_ = nullptr;
}
</s> add : ptr_(exchange(other.ptr_, nullptr)), data_(std::move(other.data_)) {} </s> remove OTHER
</s> add OTHER,
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> * Other, better approaches to this need are "plz 2 refactor" ....
<mask> */
<mask> struct ScopedExpunger {
<mask> SingletonVault* vault;
<mask> explicit ScopedExpunger(SingletonVault* v) : vault(v) { expunge(); }
<mask> ~ScopedExpunger() { expunge(); }
<mask> void expunge() {
<mask> vault->destroyInstances();
<mask> vault->reenableInstances();
<mask> }
<mask> };
</s> [sdk33] Update iOS with RN 0.59 </s> remove return [](T* v) { delete v; };
</s> add return [](T* v) { delete v; }; </s> remove TeardownFunc t) {
</s> add TeardownFunc t) { </s> remove void addRef() { }
void releaseRef() { }
</s> add void addRef() {}
void releaseRef() {} </s> remove explicit NodeRecycler(const NodeAlloc& alloc) : alloc_(alloc) { }
</s> add explicit NodeRecycler(const NodeAlloc& alloc) : alloc_(alloc) {} </s> remove explicit NodeRecycler() : refs_(0), dirty_(false) { lock_.init(); }
</s> add explicit NodeRecycler() : refs_(0), dirty_(false) {
lock_.init();
} </s> remove detail::DefaultValueWrapper<Container, Value>
defaulted(const Container& c, const Value& v) {
</s> add detail::DefaultValueWrapper<Container, Value> defaulted(
const Container& c,
const Value& v) {
|
https://github.com/expo/expo/commit/6de1d01531ce3e3388db436409963b83ec2f7911
|
ios/Pods/Folly/folly/Singleton.h
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.