Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,9 @@ class HermesExecutorRuntimeAdapter : public RuntimeAdapter {
thread_->quitSynchronous();
}

#if REACT_NATIVE_MINOR_VERSION >= 71
facebook::hermes::HermesRuntime &getRuntime() override {
return hermesRuntime_;
}
#else
facebook::jsi::Runtime &getRuntime() override {
return hermesRuntime_;
}

facebook::hermes::debugger::Debugger &getDebugger() override {
return hermesRuntime_.getDebugger();
}
#endif // REACT_NATIVE_MINOR_VERSION

// This is not empty in the original implementation, but we decided to tickle
// the runtime by running a small piece of code on every frame as using this
Expand All @@ -83,11 +73,7 @@ ReanimatedHermesRuntime::ReanimatedHermesRuntime(
#if HERMES_ENABLE_DEBUGGER
auto adapter =
std::make_unique<HermesExecutorRuntimeAdapter>(*runtime_, jsQueue);
#if REACT_NATIVE_MINOR_VERSION >= 71
debugToken_ = chrome::enableDebugging(std::move(adapter), name);
#else
chrome::enableDebugging(std::move(adapter), name);
#endif // REACT_NATIVE_MINOR_VERSION
#else
// This is required by iOS, because there is an assertion in the destructor
// that the thread was indeed `quit` before
Expand Down Expand Up @@ -127,11 +113,7 @@ ReanimatedHermesRuntime::ReanimatedHermesRuntime(
ReanimatedHermesRuntime::~ReanimatedHermesRuntime() {
#if HERMES_ENABLE_DEBUGGER
// We have to disable debugging before the runtime is destroyed.
#if REACT_NATIVE_MINOR_VERSION >= 71
chrome::disableDebugging(debugToken_);
#else
chrome::disableDebugging(*runtime_);
#endif // REACT_NATIVE_MINOR_VERSION
#endif // HERMES_ENABLE_DEBUGGER
}

Expand Down
2 changes: 0 additions & 2 deletions Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ class ReanimatedHermesRuntime
std::unique_ptr<facebook::hermes::HermesRuntime> runtime_;
ReanimatedReentrancyCheck reentrancyCheck_;
#if HERMES_ENABLE_DEBUGGER
#if REACT_NATIVE_MINOR_VERSION >= 71
chrome::DebugSessionToken debugToken_;
#endif // REACT_NATIVE_MINOR_VERSION >= 71
#endif // HERMES_ENABLE_DEBUGGER
};

Expand Down
4 changes: 0 additions & 4 deletions Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
#elif JS_RUNTIME_V8
#include <v8runtime/V8RuntimeFactory.h>
#else
#if REACT_NATIVE_MINOR_VERSION >= 71
#include <jsc/JSCRuntime.h>
#else
#include <jsi/JSCRuntime.h>
#endif // REACT_NATIVE_MINOR_VERSION
#endif // JS_RUNTIME

namespace reanimated {
Expand Down
10 changes: 0 additions & 10 deletions Common/cpp/SharedItems/Shareables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ jsi::Value makeShareableClone(
shareable = std::make_shared<ShareableScalar>(value.getBool());
} else if (value.isNumber()) {
shareable = std::make_shared<ShareableScalar>(value.getNumber());
#if REACT_NATIVE_MINOR_VERSION >= 71
} else if (value.isBigInt()) {
shareable = std::make_shared<ShareableBigInt>(rt, value.getBigInt(rt));
#endif
} else if (value.isSymbol()) {
// TODO: this is only a placeholder implementation, here we replace symbols
// with strings in order to make certain objects to be captured. There isn't
Expand Down Expand Up @@ -200,24 +198,20 @@ ShareableObject::ShareableObject(jsi::Runtime &rt, const jsi::Object &object)
auto value = extractShareableOrThrow(rt, object.getProperty(rt, key));
data_.emplace_back(key.utf8(rt), value);
}
#if REACT_NATIVE_MINOR_VERSION >= 71
if (object.hasNativeState(rt)) {
nativeState_ = object.getNativeState(rt);
}
#endif
}

ShareableObject::ShareableObject(
jsi::Runtime &rt,
const jsi::Object &object,
const jsi::Value &nativeStateSource)
: ShareableObject(rt, object) {
#if REACT_NATIVE_MINOR_VERSION >= 71
if (nativeStateSource.isObject() &&
nativeStateSource.asObject(rt).hasNativeState(rt)) {
nativeState_ = nativeStateSource.asObject(rt).getNativeState(rt);
}
#endif
}

jsi::Value ShareableObject::toJSValue(jsi::Runtime &rt) {
Expand All @@ -226,11 +220,9 @@ jsi::Value ShareableObject::toJSValue(jsi::Runtime &rt) {
obj.setProperty(
rt, data_[i].first.c_str(), data_[i].second->getJSValue(rt));
}
#if REACT_NATIVE_MINOR_VERSION >= 71
if (nativeState_ != nullptr) {
obj.setNativeState(rt, nativeState_);
}
#endif
return obj;
}

Expand Down Expand Up @@ -297,13 +289,11 @@ jsi::Value ShareableString::toJSValue(jsi::Runtime &rt) {
return jsi::String::createFromUtf8(rt, data_);
}

#if REACT_NATIVE_MINOR_VERSION >= 71
jsi::Value ShareableBigInt::toJSValue(jsi::Runtime &rt) {
return rt.global()
.getPropertyAsFunction(rt, "BigInt")
.call(rt, jsi::String::createFromUtf8(rt, string_));
}
#endif

jsi::Value ShareableScalar::toJSValue(jsi::Runtime &) {
switch (valueType_) {
Expand Down
4 changes: 0 additions & 4 deletions Common/cpp/SharedItems/Shareables.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@ class ShareableObject : public Shareable {

protected:
std::vector<std::pair<std::string, std::shared_ptr<Shareable>>> data_;
#if REACT_NATIVE_MINOR_VERSION >= 71
std::shared_ptr<jsi::NativeState> nativeState_;
#endif
};

class ShareableHostObject : public Shareable {
Expand Down Expand Up @@ -322,7 +320,6 @@ class ShareableString : public Shareable {
const std::string data_;
};

#if REACT_NATIVE_MINOR_VERSION >= 71
class ShareableBigInt : public Shareable {
public:
explicit ShareableBigInt(jsi::Runtime &rt, const jsi::BigInt &bigint)
Expand All @@ -333,7 +330,6 @@ class ShareableBigInt : public Shareable {
protected:
const std::string string_;
};
#endif

class ShareableScalar : public Shareable {
public:
Expand Down
2 changes: 0 additions & 2 deletions Common/cpp/Tools/JSISerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,9 @@ std::string JSISerializer::stringifyJSIValueRecursively(
if (value.isSymbol()) {
return value.getSymbol(rt_).toString(rt_);
}
#if REACT_NATIVE_MINOR_VERSION >= 71
if (value.isBigInt()) {
return value.getBigInt(rt_).toString(rt_).utf8(rt_) + 'n';
}
#endif
if (value.isUndefined()) {
return "undefined";
}
Expand Down
Loading