Skip to content

Commit

Permalink
Merge branch '@tjzel/worklets/native-worklets-module-stub' into @tjze…
Browse files Browse the repository at this point in the history
…l/worklets/move-shareables-to-worklets
  • Loading branch information
tjzel committed Oct 5, 2024
2 parents 3ff6608 + a4eac93 commit f143d25
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ jni::local_ref<WorkletsModule::jhybriddata> WorkletsModule::initHybrid(
return makeCxxInstance(jThis, (jsi::Runtime *)jsContext, valueUnpackerCode);
}

void WorkletsModule::installJSIBindings() {}

void WorkletsModule::registerNatives() {
registerHybrid(
{makeNativeMethod("initHybrid", WorkletsModule::initHybrid),
makeNativeMethod(
"installJSIBindings", WorkletsModule::installJSIBindings)});
registerHybrid({makeNativeMethod("initHybrid", WorkletsModule::initHybrid)});
}
} // namespace worklets
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include <memory>
#include <string>
#include <utility>

namespace worklets {

Expand Down Expand Up @@ -48,30 +47,6 @@ class WorkletsModule : public jni::HybridClass<WorkletsModule> {
jsi::Runtime *rnRuntime_;
std::shared_ptr<NativeWorkletsModule> nativeWorkletsModule_;

void installJSIBindings();

/***
* Wraps a method of `WorkletsModule` in a function object capturing
* `this`
* @tparam TReturn return type of passed method
* @tparam TParams parameter types of passed method
* @param methodPtr pointer to method to be wrapped
* @return a function object with the same signature as the method, calling
* that method on `this`
*/
template <class TReturn, class... TParams>
std::function<TReturn(TParams...)> bindThis(
TReturn (WorkletsModule::*methodPtr)(TParams...)) {
return [this, methodPtr](TParams &&...args) {
return (this->*methodPtr)(std::forward<TParams>(args)...);
};
}

template <class Signature>
JMethod<Signature> getJniMethod(std::string const &methodName) {
return javaPart_->getClass()->getMethod<Signature>(methodName.c_str());
}

explicit WorkletsModule(
jni::alias_ref<WorkletsModule::jhybridobject> jThis,
jsi::Runtime *rnRuntime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class WorkletsModule extends NativeWorkletsModuleSpec {
/**
* @noinspection unused
*/
// TODO: Do I need this?
protected HybridData getHybridData() {
return mHybridData;
}
Expand All @@ -35,22 +34,10 @@ protected HybridData getHybridData() {
@OptIn(markerClass = FrameworkAPI.class)
private native HybridData initHybrid(long jsContext, String valueUnpackerCode);

// TODO: Remove this
public WorkletsModule(ReactApplicationContext reactContext) {
super(reactContext);
}

/**
* @noinspection JavaJniMissingFunction
*/
// TODO: Remove this
protected native void installJSIBindings();

// TODO: Remove this
@Override
public void initialize() {
// Do nothing.
}

@OptIn(markerClass = FrameworkAPI.class)
@ReactMethod(isBlockingSynchronousMethod = true)
Expand All @@ -64,9 +51,4 @@ public boolean installTurboModule(String valueUnpackerCode) {
return true;
}

// TODO: Remove this
@Override
public void invalidate() {
super.invalidate();
}
}

0 comments on commit f143d25

Please sign in to comment.