Commit Graph
9 Commits
Author SHA1 Message Date
Marc RousavyandGitHub 6dbb34f9d3 fix: Add NON_NULL, NULLABLE and CONTIGUOUS_MEMORY annotations on pointers (#902)
* chore: Add `NON_NULL` and `NULLABLE` annotations on all pointers

* feat: Add `CONTIGUOUS_MEMORY` and `NON_NULL`

* Create `InstanceMethod<...>`

* chore: Use `InstanceMethod<...>`
2025-09-26 13:45:54 +02:00
Marc RousavyandGitHub 52ff673034 feat: Add ArrayBuffer.wrap(HardwareBuffer) API (#691)
* feat: Add `ArrayBuffer.wrap(HardwareBuffer)` API

* fix: Rename it

* Add `#if __ANDROID_API__ >= 26` check to C++

* Format

* feat: Implement `copyHardwareBuffer(..)`

* fix: Throw runtime error

* feat: Add `isHardwareBuffer` and `getHardwareBuffer()` for Kotlin

* fix: Register `copyHardwareBuffer` static JNI method properly

* feat: Add tests for "native" buffer

* Fix `_isLocked`

* chore: Move ArrayBuffer + HardwareBuffer to `HardwareBufferUtils`

* fix: It's called `getHardwareBufferBoxed()`

* fix: `@JvmStatic`

* feat: Implement `copyBuffer()` tests

* fix: Compile below API 26

* fix: Add SDK 26 check to `isHardwareBuffer` fast path

* fix: `getHardwareBufferBoxed` API 26

* fix: Slap good ol' API 26 `@RequiresApi` on it
2025-06-11 15:58:33 +02:00
Marc RousavyandGitHub 13e9977e9a fix: Make ArrayBuffer::copy(..) methods const (#596) 2025-03-03 16:12:11 +01:00
Marc RousavyandGitHub 0c5e716ab1 fix: Fix a case where a nullptr BorrowingReference<T> could be accessed (#568)
* fix: Fix a case where a `nullptr` `BorrowingReference<T>` could be accessed

* Update HybridObjectPrototype.cpp

* chore: Replace `jsi::Runtime*` with `jsi::Runtime&` in `JSArrayBuffer`

* Update ArrayBuffer.cpp
2025-02-23 17:16:50 +01:00
Marc RousavyandGitHub 9adb7df925 perf: Remove OwningLock<T> (#567)
* perf: Remove `OwningLock<T>`

* fix: Fix Java Class name
2025-02-23 16:33:53 +01:00
Marc RousavyandGitHub 6998588b70 chore: Rename BorrowingReference<T> -> WeakReference<T>, and OwningReference<T> -> BorrowingReference<T> (#523)
* chore: Rename `BorrowingReference<T>` -> `WeakReference<T>`, and `OwningReference<T>` -> `BorrowingReference<T>`

* chore: Remove unused flag

* chore: Lint

* fix: remove unnecessary nullptr compare
2025-02-03 18:30:04 +01:00
Marc RousavyandGitHub a06c7d44af feat: Add new ArrayBuffer APIs (copy(), wrap(), allocate(), toData()) (#463)
* feat: Add `ArrayBuffer::copyBuffer(..)` API

* feat: Add `wrap` API for Kotlin

* feat: Add `ArrayBuffer.copy(data:)`

* perf: Copy Data a bit more effectively

* fix: Rename a bunch of things

* docs: Add creating docs

* feat: Add `ArrayBufferHolder.toData()`

* feat: Add `ArrayBuffer::copy(std::vector&)`

* perf: Change type of `.data` to `uint8_t*` to avoid upcast

* feat: Add `copyIfNeeded` flag

* Update array-buffers.md
2025-01-07 16:35:59 +01:00
Marc RousavyandGitHub 992c709caf feat: Safely wrap a Swift closure in a C++ accessible SwiftClosure struct and allow parameters bi-directionally (#81)
* feat: Safely wrap a Swift closure in a `SwiftClosure` struct callable from C++

* Unsafely unwrap (`!`)

* fix: Fix visibility modifiers

* fix: Rename `ClosureWrapper` -> `SwiftClosure`

* Update SwiftClosure.hpp

* Update SwiftClosure.hpp

* Create `SwiftFunction` base

* regen

* feat: Properly create `std::function` from Swift closure

* fix: Forward params I think

* Update SwiftCxxBridgedType.ts

* feat: Use static function pointer to allow for C++ types

* fix: Only do this for Swift

* Update SwiftCxxBridgedType.ts

* fix: Properly unwrap using `Unmanaged`

* fix: Fix Swift compiler crash by moving function to `std::shared_ptr` before capturing it

* feat: Properly share func before capturing it

* Update SwiftCxxTypeHelper.ts
2024-08-29 15:21:25 +02:00
Marc RousavyandGitHub c31936286d feat: Support ArrayBuffer in Swift 🥳 (#37)
* feat: Support `ArrayBuffer` in Swift

* feat: Create `ArrayBufferHolder` that holds a `std::shared_ptr<ArrayBuffer>`

* fix: Fix `void*` cast in Swift

* feat: Create `.allocate(..)` helper init

* fix: Fix `initializeToZero`

* feat: Add `createNewBuffer`

* fix: regenerate missing specs

* fix: Move import to iOS only, on Android we dont have that

* chore: Format
2024-08-14 19:34:31 +02:00