Commit Graph
41 Commits
Author SHA1 Message Date
Marc RousavyandGitHub 03e1a716cf fix: Fix NITRO_DEBUG debug/release preprocessor directive (#132)
* fix: Use `NITRO_DEBUG` flag to predictably run debug/release code

* feat: Add `NitroModules.buildType`

* fix: Style `debug` label
2024-09-16 16:18:05 +02:00
Marc Rousavy d291f63ec0 fix: Remove LOG_MEMORY_ALLOCATIONS test 2024-09-16 15:47:40 +02:00
Marc RousavyandGitHub 661bea4cec feat: Add dispose() to HybridObject (and registerRawHybridMethod(...)) (#82)
* fix: Fix `SwiftClosure` not reading `void*` properly - use `Unmanaged<T>` again

* feat: Add a `dispose()` method to `HybridObject`

* feat: Split `registerRawHybridMethod` out of `registerHybridMethod`

* fix: Throw better error for when `NativeState` is nullptr

* Better debug info

* `FunctionType` -> `FunctionKind`

* fix: Either dynamically get name, or statically through typeinfo.
2024-08-29 16:51:11 +02:00
Marc RousavyandGitHub b4592244f2 feat: AnyMap for Kotlin/Android (#60)
* feat: Create `JAnyMap` base

* Update JNIOnLoad.cpp

* feat: Create `AnyMap` methods

* fix: Fix wrong name & format

* feat: `setNull`

* log dimmed

* Update README.md
2024-08-27 18:02:39 +02:00
Marc RousavyandGitHub e7b9f412eb fix: Rewrite Logger to use platform NSLog / __android_log_print (#54)
* fix: Fix wrong include..?

* fix: Reimplement NitroLogger as a platform-specific logger

* fix: Copy args, and use proper tag

* fix: Fix sprintf crash because of wrong format argument

* fix: Fix Logger usage on iOS
2024-08-20 16:20:44 +02:00
Marc RousavyandGitHub acca5baaa4 fix: Replace #if DEBUG with #ifndef NDEBUG to make it work on Android (#53)
* fix: Fix `hasNativeState` checks and provide better errors

* fix: Replace `#if DEBUG` with `#ifndef NDEBUG` to make it work on Android
2024-08-20 15:30:03 +02:00
Marc Rousavy f7646c34ba fix: Remove unresolved import on Android 2024-08-09 17:01:42 +02:00
Marc RousavyandGitHub c101faf948 feat: Cache toObject(...) using jsi::WeakObject and correctly set externalExternalMemoryPressure (#13)
* feat: Cache `toObject(...)` using `jsi::WeakObject` and set `externalMemoryPressure` properly

* feat: Support caching different JSI types - strongly typed
2024-08-08 12:28:33 +02:00
Marc Rousavy 0807098c86 Update HybridObject.cpp 2024-08-08 11:48:49 +02:00
Marc RousavyandGitHub 86c3702ffc feat: Make HybridObject a NativeState (#11)
* feat: Make `HybridObject` a `NativeState`

* feat: Get `NativeState` inside `callMethod(...)`, no more passing `this*`

* Update HybridObject.hpp

* fix: Convert NativeState to `jsi::Value` again

* Use `Object.create`

* fix broken test

* feat: Add `__type` hidden state to objects

* chore: Format

* `makeGlobal` -> `makeShared`

* feat: Extract to `HybridObjectPrototype`

* Update HybridObject.hpp

* feat: Properly build Prototype chain

* Cache prototypes

* fix: Fix prototype caching

* Extract to separate file

* fix: Some comments

* chore: Format

* feat: Freeze prototypes

* Remove freeze

* feat: Optimize `NativeState` performance, make it 56x faster (#12)

* fix: Fix `HybridFunction` usage

* Update HybridFunction.hpp

* mark final

* feat: Add new `registerHybrids(...)` API

* fix: Remove logs

* perf: Make `registerHybrids` faster by using function pointer instead of `std::function<...>`

* fix: Turn off memory allocations debugger

* refactor

* Format

* fix: Fix cyclic includes for `JSIConverter+HybridObject`

* DO_NULL_CHECKS

* fix: Use `jsi::Value` directly to avoid down and up casting again

* Add `__type` to `HybridObject` declaration

* feat: Throw `jsi::JSError` again

* feat: Add prototype tests

* feat: Set `__type` on Prototypes as well

* Delete PointerHolder.hpp

* Delete `JSIPrototypeCache`

* fix: Use `jsi::Value` directly
2024-08-08 11:39:17 +02:00
Marc Rousavy 0b7e2b5561 fix: Fix JSICache<T> being recreated each time because of C++ template specialization 2024-08-06 01:37:08 +02:00
Marc Rousavy 49ed078d1e fix: Unify error catching in createMethod 2024-07-31 18:21:42 +02:00
Marc Rousavy 1c19ec8309 chore: Format 2024-07-31 18:11:57 +02:00
Marc Rousavy 1eda72abab feat: Provide object and method name when throwing errors 2024-07-31 18:11:29 +02:00
Marc Rousavy 9d69ba04ab chore: Run clang format 2024-07-31 17:39:56 +02:00
Marc Rousavy 3e0279a71f feat: Create JSICacheReference for safer cache access 2024-07-30 11:41:01 +02:00
Marc Rousavy 0c0de8cbd3 feat: Try to cache jsi::Objects for HybridObjects 2024-07-30 09:48:07 +02:00
Marc Rousavy 916dc5d4a4 fix logs 2024-07-23 01:48:22 +02:00
Marc Rousavy 168a456a32 Properly add Swift size 2024-07-23 01:37:44 +02:00
Marc Rousavy a0c7caa2a8 fix: Properly get memory size including own cache map size 2024-07-23 01:34:44 +02:00
Marc Rousavy 5e7ce5a33e Also log total objects 2024-07-18 00:34:26 +02:00
Marc Rousavy 5c50d02b72 feat: Also log total alive instances 2024-07-18 00:31:14 +02:00
Marc Rousavy 3fe9d784aa fix: Fix Logger 2024-07-18 00:05:15 +02:00
Marc Rousavy 82925dbb3a fix: Fix toString() space 2024-07-17 23:32:08 +02:00
Marc Rousavy 4262b7940e feat: Add name and equals methods to HybridObject 2024-07-17 23:24:10 +02:00
Marc Rousavy eb7282536a Revert "perf: Also cache getPropertyNames"
This reverts commit eddad79f8c.
2024-07-17 23:14:44 +02:00
Marc Rousavy eddad79f8c perf: Also cache getPropertyNames 2024-07-17 23:14:38 +02:00
Marc Rousavy 09b8dea251 FunctionCache -> JSICache 2024-07-17 23:14:25 +02:00
Marc Rousavy 7bc2767348 fix: Move to namespace margelo::nitro 2024-07-17 21:49:11 +02:00
Marc Rousavy 1b2ea4b1ac Move HybridContext into it's own file 2024-07-17 15:32:02 +02:00
Marc Rousavy 24b1fde801 Update HybridObject.cpp 2024-07-16 18:35:33 +02:00
Marc Rousavy 19d3e848d5 fix: Make _mutex a unique ptr so it can be accessed from Swift 2024-07-16 18:30:05 +02:00
Marc Rousavy 4d266e5837 Update HybridObject.cpp 2024-07-13 12:29:15 +02:00
Marc Rousavy a3988c7c08 Update HybridObject.cpp 2024-07-13 12:28:02 +02:00
Marc Rousavy 6b68537fd5 Create Borrowing/Owning reference types 2024-06-23 11:26:33 +02:00
Marc Rousavy 492ad57332 Update HybridObject.cpp 2024-06-20 16:42:49 +02:00
Marc Rousavy 198b894fe8 Make FunctionCache robust now 2024-06-20 16:40:06 +02:00
Marc Rousavy 166feb425f Create test object 2024-06-20 16:32:05 +02:00
Marc Rousavy caf953f552 fix imports 2024-06-20 10:47:50 +02:00
Marc Rousavy 84b995e4eb Rename to .hpp 2024-06-20 10:41:09 +02:00
Marc Rousavy ee1b3bd2cb Add core HybridObject infra 2024-06-19 19:57:47 +02:00