feat: Replace *NativeMap and *NativeArray with Map<K,V> and List<T> for faster JSI -> JNI calls (#1720)
Replaces `ReadableNativeMap`/`WritableNativeMap` with `Map<String, Object>` and `ReadableNativeArray`/`WritableNativeArray` with `List<Object>`, making the JSI -> JNI conversion a bit faster and more logical. Also, we could now convert Array Buffers or HostObjects if we wanted to.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// Created by Marc Rousavy on 21.07.23.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <jsi/jsi.h>
|
||||
#include "JFrameProcessorPlugin.h"
|
||||
#include <memory>
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <vector>
|
||||
|
||||
namespace vision {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
class FrameProcessorPluginHostObject: public jsi::HostObject {
|
||||
public:
|
||||
explicit FrameProcessorPluginHostObject(jni::alias_ref<JFrameProcessorPlugin::javaobject> plugin):
|
||||
_plugin(make_global(plugin)) { }
|
||||
~FrameProcessorPluginHostObject() { }
|
||||
|
||||
public:
|
||||
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override;
|
||||
jsi::Value get(jsi::Runtime& runtime, const jsi::PropNameID& name) override;
|
||||
|
||||
private:
|
||||
jni::global_ref<JFrameProcessorPlugin::javaobject> _plugin;
|
||||
};
|
||||
|
||||
} // namespace vision
|
||||
Reference in New Issue
Block a user