@onekeyfe/react-native-perf-memory 3.0.81 → 3.0.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/nitrogen/generated/android/c++/JHybridReactNativePerfMemorySpec.cpp +21 -20
  2. package/nitrogen/generated/android/c++/JHybridReactNativePerfMemorySpec.hpp +20 -22
  3. package/nitrogen/generated/android/c++/JMemoryUsage.hpp +2 -2
  4. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeperfmemory/HybridReactNativePerfMemorySpec.kt +15 -18
  5. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeperfmemory/MemoryUsage.kt +2 -2
  6. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeperfmemory/reactnativeperfmemoryOnLoad.kt +1 -1
  7. package/nitrogen/generated/android/reactnativeperfmemory+autolinking.cmake +1 -1
  8. package/nitrogen/generated/android/reactnativeperfmemory+autolinking.gradle +1 -1
  9. package/nitrogen/generated/android/reactnativeperfmemoryOnLoad.cpp +27 -17
  10. package/nitrogen/generated/android/reactnativeperfmemoryOnLoad.hpp +14 -5
  11. package/nitrogen/generated/ios/ReactNativePerfMemory+autolinking.rb +2 -2
  12. package/nitrogen/generated/ios/ReactNativePerfMemory-Swift-Cxx-Bridge.cpp +1 -1
  13. package/nitrogen/generated/ios/ReactNativePerfMemory-Swift-Cxx-Bridge.hpp +1 -1
  14. package/nitrogen/generated/ios/ReactNativePerfMemory-Swift-Cxx-Umbrella.hpp +1 -1
  15. package/nitrogen/generated/ios/ReactNativePerfMemoryAutolinking.mm +1 -1
  16. package/nitrogen/generated/ios/ReactNativePerfMemoryAutolinking.swift +9 -8
  17. package/nitrogen/generated/ios/c++/HybridReactNativePerfMemorySpecSwift.cpp +1 -1
  18. package/nitrogen/generated/ios/c++/HybridReactNativePerfMemorySpecSwift.hpp +7 -1
  19. package/nitrogen/generated/ios/swift/Func_void_MemoryUsage.swift +1 -2
  20. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -2
  21. package/nitrogen/generated/ios/swift/HybridReactNativePerfMemorySpec.swift +3 -4
  22. package/nitrogen/generated/ios/swift/HybridReactNativePerfMemorySpec_cxx.swift +9 -2
  23. package/nitrogen/generated/ios/swift/MemoryUsage.swift +3 -10
  24. package/nitrogen/generated/shared/c++/HybridReactNativePerfMemorySpec.cpp +1 -1
  25. package/nitrogen/generated/shared/c++/HybridReactNativePerfMemorySpec.hpp +1 -1
  26. package/nitrogen/generated/shared/c++/MemoryUsage.hpp +13 -5
  27. package/package.json +4 -4
@@ -2,7 +2,7 @@
2
2
  /// JHybridReactNativePerfMemorySpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "JHybridReactNativePerfMemorySpec.hpp"
@@ -17,30 +17,31 @@ namespace margelo::nitro::reactnativeperfmemory { struct MemoryUsage; }
17
17
 
18
18
  namespace margelo::nitro::reactnativeperfmemory {
19
19
 
20
- jni::local_ref<JHybridReactNativePerfMemorySpec::jhybriddata> JHybridReactNativePerfMemorySpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
21
- return makeCxxInstance(jThis);
22
- }
23
-
24
- void JHybridReactNativePerfMemorySpec::registerNatives() {
25
- registerHybrid({
26
- makeNativeMethod("initHybrid", JHybridReactNativePerfMemorySpec::initHybrid),
27
- });
20
+ std::shared_ptr<JHybridReactNativePerfMemorySpec> JHybridReactNativePerfMemorySpec::JavaPart::getJHybridReactNativePerfMemorySpec() {
21
+ auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
22
+ auto castHybridObject = std::dynamic_pointer_cast<JHybridReactNativePerfMemorySpec>(hybridObject);
23
+ if (castHybridObject == nullptr) [[unlikely]] {
24
+ throw std::runtime_error("Failed to downcast JHybridObject to JHybridReactNativePerfMemorySpec!");
25
+ }
26
+ return castHybridObject;
28
27
  }
29
28
 
30
- size_t JHybridReactNativePerfMemorySpec::getExternalMemorySize() noexcept {
31
- static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
32
- return method(_javaPart);
29
+ jni::local_ref<JHybridReactNativePerfMemorySpec::CxxPart::jhybriddata> JHybridReactNativePerfMemorySpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
30
+ return makeCxxInstance(jThis);
33
31
  }
34
32
 
35
- void JHybridReactNativePerfMemorySpec::dispose() noexcept {
36
- static const auto method = javaClassStatic()->getMethod<void()>("dispose");
37
- method(_javaPart);
33
+ std::shared_ptr<JHybridObject> JHybridReactNativePerfMemorySpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
34
+ auto castJavaPart = jni::dynamic_ref_cast<JHybridReactNativePerfMemorySpec::JavaPart>(javaPart);
35
+ if (castJavaPart == nullptr) [[unlikely]] {
36
+ throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridReactNativePerfMemorySpec::JavaPart!");
37
+ }
38
+ return std::make_shared<JHybridReactNativePerfMemorySpec>(castJavaPart);
38
39
  }
39
40
 
40
- std::string JHybridReactNativePerfMemorySpec::toString() {
41
- static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
42
- auto javaString = method(_javaPart);
43
- return javaString->toStdString();
41
+ void JHybridReactNativePerfMemorySpec::CxxPart::registerNatives() {
42
+ registerHybrid({
43
+ makeNativeMethod("initHybrid", JHybridReactNativePerfMemorySpec::CxxPart::initHybrid),
44
+ });
44
45
  }
45
46
 
46
47
  // Properties
@@ -48,7 +49,7 @@ namespace margelo::nitro::reactnativeperfmemory {
48
49
 
49
50
  // Methods
50
51
  std::shared_ptr<Promise<MemoryUsage>> JHybridReactNativePerfMemorySpec::getMemoryUsage() {
51
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getMemoryUsage");
52
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getMemoryUsage");
52
53
  auto __result = method(_javaPart);
53
54
  return [&]() {
54
55
  auto __promise = Promise<MemoryUsage>::create();
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativePerfMemorySpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -18,33 +18,33 @@ namespace margelo::nitro::reactnativeperfmemory {
18
18
 
19
19
  using namespace facebook;
20
20
 
21
- class JHybridReactNativePerfMemorySpec: public jni::HybridClass<JHybridReactNativePerfMemorySpec, JHybridObject>,
22
- public virtual HybridReactNativePerfMemorySpec {
21
+ class JHybridReactNativePerfMemorySpec: public virtual HybridReactNativePerfMemorySpec, public virtual JHybridObject {
23
22
  public:
24
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfmemory/HybridReactNativePerfMemorySpec;";
25
- static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
26
- static void registerNatives();
27
-
28
- protected:
29
- // C++ constructor (called from Java via `initHybrid()`)
30
- explicit JHybridReactNativePerfMemorySpec(jni::alias_ref<jhybridobject> jThis) :
31
- HybridObject(HybridReactNativePerfMemorySpec::TAG),
32
- HybridBase(jThis),
33
- _javaPart(jni::make_global(jThis)) {}
23
+ struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfmemory/HybridReactNativePerfMemorySpec;";
25
+ std::shared_ptr<JHybridReactNativePerfMemorySpec> getJHybridReactNativePerfMemorySpec();
26
+ };
27
+ struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
28
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfmemory/HybridReactNativePerfMemorySpec$CxxPart;";
29
+ static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
30
+ static void registerNatives();
31
+ using HybridBase::HybridBase;
32
+ protected:
33
+ std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
34
+ };
34
35
 
35
36
  public:
37
+ explicit JHybridReactNativePerfMemorySpec(const jni::local_ref<JHybridReactNativePerfMemorySpec::JavaPart>& javaPart):
38
+ HybridObject(HybridReactNativePerfMemorySpec::TAG),
39
+ JHybridObject(javaPart),
40
+ _javaPart(jni::make_global(javaPart)) {}
36
41
  ~JHybridReactNativePerfMemorySpec() override {
37
42
  // Hermes GC can destroy JS objects on a non-JNI Thread.
38
43
  jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
39
44
  }
40
45
 
41
46
  public:
42
- size_t getExternalMemorySize() noexcept override;
43
- void dispose() noexcept override;
44
- std::string toString() override;
45
-
46
- public:
47
- inline const jni::global_ref<JHybridReactNativePerfMemorySpec::javaobject>& getJavaPart() const noexcept {
47
+ inline const jni::global_ref<JHybridReactNativePerfMemorySpec::JavaPart>& getJavaPart() const noexcept {
48
48
  return _javaPart;
49
49
  }
50
50
 
@@ -57,9 +57,7 @@ namespace margelo::nitro::reactnativeperfmemory {
57
57
  std::shared_ptr<Promise<MemoryUsage>> getMemoryUsage() override;
58
58
 
59
59
  private:
60
- friend HybridBase;
61
- using HybridBase::HybridBase;
62
- jni::global_ref<JHybridReactNativePerfMemorySpec::javaobject> _javaPart;
60
+ jni::global_ref<JHybridReactNativePerfMemorySpec::JavaPart> _javaPart;
63
61
  };
64
62
 
65
63
  } // namespace margelo::nitro::reactnativeperfmemory
@@ -2,7 +2,7 @@
2
2
  /// JMemoryUsage.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -21,7 +21,7 @@ namespace margelo::nitro::reactnativeperfmemory {
21
21
  */
22
22
  struct JMemoryUsage final: public jni::JavaClass<JMemoryUsage> {
23
23
  public:
24
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfmemory/MemoryUsage;";
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfmemory/MemoryUsage;";
25
25
 
26
26
  public:
27
27
  /**
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativePerfMemorySpec.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativeperfmemory
@@ -25,32 +25,29 @@ import com.margelo.nitro.core.HybridObject
25
25
  "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
26
26
  )
27
27
  abstract class HybridReactNativePerfMemorySpec: HybridObject() {
28
- @DoNotStrip
29
- private var mHybridData: HybridData = initHybrid()
30
-
31
- init {
32
- super.updateNative(mHybridData)
33
- }
28
+ // Properties
29
+
34
30
 
35
- override fun updateNative(hybridData: HybridData) {
36
- mHybridData = hybridData
37
- super.updateNative(hybridData)
38
- }
31
+ // Methods
32
+ @DoNotStrip
33
+ @Keep
34
+ abstract fun getMemoryUsage(): Promise<MemoryUsage>
39
35
 
40
36
  // Default implementation of `HybridObject.toString()`
41
37
  override fun toString(): String {
42
38
  return "[HybridObject ReactNativePerfMemory]"
43
39
  }
44
40
 
45
- // Properties
46
-
47
-
48
- // Methods
41
+ // C++ backing class
49
42
  @DoNotStrip
50
43
  @Keep
51
- abstract fun getMemoryUsage(): Promise<MemoryUsage>
52
-
53
- private external fun initHybrid(): HybridData
44
+ protected open class CxxPart(javaPart: HybridReactNativePerfMemorySpec): HybridObject.CxxPart(javaPart) {
45
+ // C++ JHybridReactNativePerfMemorySpec::CxxPart::initHybrid(...)
46
+ external override fun initHybrid(): HybridData
47
+ }
48
+ override fun createCxxPart(): CxxPart {
49
+ return CxxPart(this)
50
+ }
54
51
 
55
52
  companion object {
56
53
  protected const val TAG = "HybridReactNativePerfMemorySpec"
@@ -2,7 +2,7 @@
2
2
  /// MemoryUsage.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativeperfmemory
@@ -23,7 +23,7 @@ data class MemoryUsage(
23
23
  ) {
24
24
  /* primary constructor */
25
25
 
26
- private companion object {
26
+ companion object {
27
27
  /**
28
28
  * Constructor called from C++
29
29
  */
@@ -2,7 +2,7 @@
2
2
  /// reactnativeperfmemoryOnLoad.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.reactnativeperfmemory
@@ -2,7 +2,7 @@
2
2
  # reactnativeperfmemory+autolinking.cmake
3
3
  # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  # https://github.com/mrousavy/nitro
5
- # Copyright © 2026 Marc Rousavy @ Margelo
5
+ # Copyright © Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a CMake file that adds all files generated by Nitrogen
@@ -2,7 +2,7 @@
2
2
  /// reactnativeperfmemory+autolinking.gradle
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  /// This is a Gradle file that adds all files generated by Nitrogen
@@ -2,7 +2,7 @@
2
2
  /// reactnativeperfmemoryOnLoad.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #ifndef BUILDING_REACTNATIVEPERFMEMORY_WITH_GENERATED_CMAKE_PROJECT
@@ -21,24 +21,34 @@
21
21
  namespace margelo::nitro::reactnativeperfmemory {
22
22
 
23
23
  int initialize(JavaVM* vm) {
24
+ return facebook::jni::initialize(vm, []() {
25
+ ::margelo::nitro::reactnativeperfmemory::registerAllNatives();
26
+ });
27
+ }
28
+
29
+ struct JHybridReactNativePerfMemorySpecImpl: public jni::JavaClass<JHybridReactNativePerfMemorySpecImpl, JHybridReactNativePerfMemorySpec::JavaPart> {
30
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfmemory/ReactNativePerfMemory;";
31
+ static std::shared_ptr<JHybridReactNativePerfMemorySpec> create() {
32
+ static const auto constructorFn = javaClassStatic()->getConstructor<JHybridReactNativePerfMemorySpecImpl::javaobject()>();
33
+ jni::local_ref<JHybridReactNativePerfMemorySpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
34
+ return javaPart->getJHybridReactNativePerfMemorySpec();
35
+ }
36
+ };
37
+
38
+ void registerAllNatives() {
24
39
  using namespace margelo::nitro;
25
40
  using namespace margelo::nitro::reactnativeperfmemory;
26
- using namespace facebook;
27
-
28
- return facebook::jni::initialize(vm, [] {
29
- // Register native JNI methods
30
- margelo::nitro::reactnativeperfmemory::JHybridReactNativePerfMemorySpec::registerNatives();
31
-
32
- // Register Nitro Hybrid Objects
33
- HybridObjectRegistry::registerHybridObjectConstructor(
34
- "ReactNativePerfMemory",
35
- []() -> std::shared_ptr<HybridObject> {
36
- static DefaultConstructableObject<JHybridReactNativePerfMemorySpec::javaobject> object("com/margelo/nitro/reactnativeperfmemory/ReactNativePerfMemory");
37
- auto instance = object.create();
38
- return instance->cthis()->shared();
39
- }
40
- );
41
- });
41
+
42
+ // Register native JNI methods
43
+ margelo::nitro::reactnativeperfmemory::JHybridReactNativePerfMemorySpec::CxxPart::registerNatives();
44
+
45
+ // Register Nitro Hybrid Objects
46
+ HybridObjectRegistry::registerHybridObjectConstructor(
47
+ "ReactNativePerfMemory",
48
+ []() -> std::shared_ptr<HybridObject> {
49
+ return JHybridReactNativePerfMemorySpecImpl::create();
50
+ }
51
+ );
42
52
  }
43
53
 
44
54
  } // namespace margelo::nitro::reactnativeperfmemory
@@ -2,24 +2,33 @@
2
2
  /// reactnativeperfmemoryOnLoad.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include <jni.h>
9
+ #include <functional>
9
10
  #include <NitroModules/NitroDefines.hpp>
10
11
 
11
12
  namespace margelo::nitro::reactnativeperfmemory {
12
13
 
14
+ [[deprecated("Use registerNatives() instead.")]]
15
+ int initialize(JavaVM* vm);
16
+
13
17
  /**
14
- * Initializes the native (C++) part of reactnativeperfmemory, and autolinks all Hybrid Objects.
15
- * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
18
+ * Register the native (C++) part of reactnativeperfmemory, and autolinks all Hybrid Objects.
19
+ * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
20
+ * inside a `facebook::jni::initialize(vm, ...)` call.
16
21
  * Example:
17
22
  * ```cpp (cpp-adapter.cpp)
18
23
  * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
19
- * return margelo::nitro::reactnativeperfmemory::initialize(vm);
24
+ * return facebook::jni::initialize(vm, []() {
25
+ * // register all reactnativeperfmemory HybridObjects
26
+ * margelo::nitro::reactnativeperfmemory::registerNatives();
27
+ * // any other custom registrations go here.
28
+ * });
20
29
  * }
21
30
  * ```
22
31
  */
23
- int initialize(JavaVM* vm);
32
+ void registerAllNatives();
24
33
 
25
34
  } // namespace margelo::nitro::reactnativeperfmemory
@@ -2,7 +2,7 @@
2
2
  # ReactNativePerfMemory+autolinking.rb
3
3
  # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  # https://github.com/mrousavy/nitro
5
- # Copyright © 2026 Marc Rousavy @ Margelo
5
+ # Copyright © Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a Ruby script that adds all files generated by Nitrogen
@@ -52,7 +52,7 @@ def add_nitrogen_files(spec)
52
52
  spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
53
53
  # Use C++ 20
54
54
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
55
- # Enables C++ <-> Swift interop (by default it's only C)
55
+ # Enables C++ <-> Swift interop (by default it's only ObjC)
56
56
  "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
57
  # Enables stricter modular headers
58
58
  "DEFINES_MODULE" => "YES",
@@ -2,7 +2,7 @@
2
2
  /// ReactNativePerfMemory-Swift-Cxx-Bridge.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "ReactNativePerfMemory-Swift-Cxx-Bridge.hpp"
@@ -2,7 +2,7 @@
2
2
  /// ReactNativePerfMemory-Swift-Cxx-Bridge.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// ReactNativePerfMemory-Swift-Cxx-Umbrella.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// ReactNativePerfMemoryAutolinking.mm
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #import <Foundation/Foundation.h>
@@ -2,19 +2,16 @@
2
2
  /// ReactNativePerfMemoryAutolinking.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
+ import NitroModules
9
+
10
+ // TODO: Use empty enums once Swift supports exporting them as namespaces
11
+ // See: https://github.com/swiftlang/swift/pull/83616
8
12
  public final class ReactNativePerfMemoryAutolinking {
9
13
  public typealias bridge = margelo.nitro.reactnativeperfmemory.bridge.swift
10
14
 
11
- /**
12
- * Creates an instance of a Swift class that implements `HybridReactNativePerfMemorySpec`,
13
- * and wraps it in a Swift class that can directly interop with C++ (`HybridReactNativePerfMemorySpec_cxx`)
14
- *
15
- * This is generated by Nitrogen and will initialize the class specified
16
- * in the `"autolinking"` property of `nitro.json` (in this case, `ReactNativePerfMemory`).
17
- */
18
15
  public static func createReactNativePerfMemory() -> bridge.std__shared_ptr_HybridReactNativePerfMemorySpec_ {
19
16
  let hybridObject = ReactNativePerfMemory()
20
17
  return { () -> bridge.std__shared_ptr_HybridReactNativePerfMemorySpec_ in
@@ -22,4 +19,8 @@ public final class ReactNativePerfMemoryAutolinking {
22
19
  return __cxxWrapped.getCxxPart()
23
20
  }()
24
21
  }
22
+
23
+ public static func isReactNativePerfMemoryRecyclable() -> Bool {
24
+ return ReactNativePerfMemory.self is any RecyclableView.Type
25
+ }
25
26
  }
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativePerfMemorySpecSwift.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridReactNativePerfMemorySpecSwift.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativePerfMemorySpecSwift.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -49,6 +49,12 @@ namespace margelo::nitro::reactnativeperfmemory {
49
49
  inline size_t getExternalMemorySize() noexcept override {
50
50
  return _swiftPart.getMemorySize();
51
51
  }
52
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
53
+ if (auto otherCast = std::dynamic_pointer_cast<HybridReactNativePerfMemorySpecSwift>(other)) {
54
+ return _swiftPart.equals(otherCast->_swiftPart);
55
+ }
56
+ return false;
57
+ }
52
58
  void dispose() noexcept override {
53
59
  _swiftPart.dispose();
54
60
  }
@@ -2,10 +2,9 @@
2
2
  /// Func_void_MemoryUsage.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
- import Foundation
9
8
  import NitroModules
10
9
 
11
10
  /**
@@ -2,10 +2,9 @@
2
2
  /// Func_void_std__exception_ptr.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
- import Foundation
9
8
  import NitroModules
10
9
 
11
10
  /**
@@ -2,10 +2,9 @@
2
2
  /// HybridReactNativePerfMemorySpec.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
- import Foundation
9
8
  import NitroModules
10
9
 
11
10
  /// See ``HybridReactNativePerfMemorySpec``
@@ -30,14 +29,14 @@ open class HybridReactNativePerfMemorySpec_base {
30
29
  public init() { }
31
30
  public func getCxxWrapper() -> HybridReactNativePerfMemorySpec_cxx {
32
31
  #if DEBUG
33
- guard self is HybridReactNativePerfMemorySpec else {
32
+ guard self is any HybridReactNativePerfMemorySpec else {
34
33
  fatalError("`self` is not a `HybridReactNativePerfMemorySpec`! Did you accidentally inherit from `HybridReactNativePerfMemorySpec_base` instead of `HybridReactNativePerfMemorySpec`?")
35
34
  }
36
35
  #endif
37
36
  if let cxxWrapper = self.cxxWrapper {
38
37
  return cxxWrapper
39
38
  } else {
40
- let cxxWrapper = HybridReactNativePerfMemorySpec_cxx(self as! HybridReactNativePerfMemorySpec)
39
+ let cxxWrapper = HybridReactNativePerfMemorySpec_cxx(self as! any HybridReactNativePerfMemorySpec)
41
40
  self.cxxWrapper = cxxWrapper
42
41
  return cxxWrapper
43
42
  }
@@ -2,10 +2,9 @@
2
2
  /// HybridReactNativePerfMemorySpec_cxx.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
- import Foundation
9
8
  import NitroModules
10
9
 
11
10
  /**
@@ -96,6 +95,14 @@ open class HybridReactNativePerfMemorySpec_cxx {
96
95
  return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
97
96
  }
98
97
 
98
+ /**
99
+ * Compares this object with the given [other] object for reference equality.
100
+ */
101
+ @inline(__always)
102
+ public func equals(other: HybridReactNativePerfMemorySpec_cxx) -> Bool {
103
+ return self.__implementation === other.__implementation
104
+ }
105
+
99
106
  /**
100
107
  * Call dispose() on the Swift class.
101
108
  * This _may_ be called manually from JS.
@@ -2,10 +2,9 @@
2
2
  /// MemoryUsage.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
- import Foundation
9
8
  import NitroModules
10
9
 
11
10
  /**
@@ -23,14 +22,8 @@ public extension MemoryUsage {
23
22
  self.init(rss)
24
23
  }
25
24
 
25
+ @inline(__always)
26
26
  var rss: Double {
27
- @inline(__always)
28
- get {
29
- return self.__rss
30
- }
31
- @inline(__always)
32
- set {
33
- self.__rss = newValue
34
- }
27
+ return self.__rss
35
28
  }
36
29
  }
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativePerfMemorySpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridReactNativePerfMemorySpec.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativePerfMemorySpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// MemoryUsage.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -22,6 +22,11 @@
22
22
  #else
23
23
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
24
  #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
25
30
 
26
31
 
27
32
 
@@ -32,13 +37,16 @@ namespace margelo::nitro::reactnativeperfmemory {
32
37
  /**
33
38
  * A struct which can be represented as a JavaScript object (MemoryUsage).
34
39
  */
35
- struct MemoryUsage {
40
+ struct MemoryUsage final {
36
41
  public:
37
42
  double rss SWIFT_PRIVATE;
38
43
 
39
44
  public:
40
45
  MemoryUsage() = default;
41
46
  explicit MemoryUsage(double rss): rss(rss) {}
47
+
48
+ public:
49
+ friend bool operator==(const MemoryUsage& lhs, const MemoryUsage& rhs) = default;
42
50
  };
43
51
 
44
52
  } // namespace margelo::nitro::reactnativeperfmemory
@@ -51,12 +59,12 @@ namespace margelo::nitro {
51
59
  static inline margelo::nitro::reactnativeperfmemory::MemoryUsage fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
52
60
  jsi::Object obj = arg.asObject(runtime);
53
61
  return margelo::nitro::reactnativeperfmemory::MemoryUsage(
54
- JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "rss"))
62
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rss")))
55
63
  );
56
64
  }
57
65
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativeperfmemory::MemoryUsage& arg) {
58
66
  jsi::Object obj(runtime);
59
- obj.setProperty(runtime, "rss", JSIConverter<double>::toJSI(runtime, arg.rss));
67
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "rss"), JSIConverter<double>::toJSI(runtime, arg.rss));
60
68
  return obj;
61
69
  }
62
70
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -67,7 +75,7 @@ namespace margelo::nitro {
67
75
  if (!nitro::isPlainObject(runtime, obj)) {
68
76
  return false;
69
77
  }
70
- if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "rss"))) return false;
78
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rss")))) return false;
71
79
  return true;
72
80
  }
73
81
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-perf-memory",
3
- "version": "3.0.81",
3
+ "version": "3.0.85",
4
4
  "description": "react-native-perf-memory",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -78,12 +78,12 @@
78
78
  "eslint-plugin-prettier": "^5.5.4",
79
79
  "jest": "^29.7.0",
80
80
  "lefthook": "^2.0.3",
81
- "nitrogen": "0.31.10",
81
+ "nitrogen": "0.35.2",
82
82
  "prettier": "^2.8.8",
83
83
  "react": "19.2.0",
84
84
  "react-native": "patch:react-native@npm%3A0.83.0#~/.yarn/patches/react-native-npm-0.83.0-577d0f2d83.patch",
85
85
  "react-native-builder-bob": "^0.40.13",
86
- "react-native-nitro-modules": "0.33.2",
86
+ "react-native-nitro-modules": "0.35.2",
87
87
  "release-it": "^19.0.4",
88
88
  "turbo": "^2.5.6",
89
89
  "typescript": "^5.9.2"
@@ -91,7 +91,7 @@
91
91
  "peerDependencies": {
92
92
  "react": "*",
93
93
  "react-native": "*",
94
- "react-native-nitro-modules": "0.33.2"
94
+ "react-native-nitro-modules": "0.35.2"
95
95
  },
96
96
  "react-native-builder-bob": {
97
97
  "source": "src",