|
6 | 6 |
|
7 | 7 | #include <executorch/runtime/core/exec_aten/util/scalar_type_util.h> |
8 | 8 | #include <jsi/jsi.h> |
| 9 | +#include <rnexecutorch/Log.h> |
| 10 | +#include <rnexecutorch/jsi/OwningArrayBuffer.h> |
9 | 11 | #include <rnexecutorch/utils/JsiTensorView.h> |
10 | 12 |
|
11 | 13 | namespace rnexecutorch::jsiconversion { |
@@ -105,7 +107,7 @@ inline JsiTensorView getValue<JsiTensorView>(const jsi::Value &val, |
105 | 107 | throw jsi::JSError(runtime, "Data must be an ArrayBuffer or TypedArray"); |
106 | 108 | } |
107 | 109 | } |
108 | | - return std::move(tensorView); |
| 110 | + return tensorView; |
109 | 111 | } |
110 | 112 |
|
111 | 113 | template <> |
@@ -182,6 +184,17 @@ inline jsi::Value getJsiValue(int val, jsi::Runtime &runtime) { |
182 | 184 | return jsi::Value(runtime, val); |
183 | 185 | } |
184 | 186 |
|
| 187 | +inline jsi::Value |
| 188 | +getJsiValue(const std::vector<std::shared_ptr<OwningArrayBuffer>> &vec, |
| 189 | + jsi::Runtime &runtime) { |
| 190 | + jsi::Array array(runtime, vec.size()); |
| 191 | + for (size_t i = 0; i < vec.size(); i++) { |
| 192 | + jsi::ArrayBuffer arrayBuffer(runtime, vec[i]); |
| 193 | + array.setValueAtIndex(runtime, i, jsi::Value(runtime, arrayBuffer)); |
| 194 | + } |
| 195 | + return jsi::Value(runtime, array); |
| 196 | +} |
| 197 | + |
185 | 198 | inline jsi::Value getJsiValue(const std::string &str, jsi::Runtime &runtime) { |
186 | 199 | return jsi::String::createFromAscii(runtime, str); |
187 | 200 | } |
|
0 commit comments