@onekeyfe/react-native-perf-stats 3.0.81 → 3.0.82

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 (38) hide show
  1. package/nitrogen/generated/android/c++/JFunc_void_MemoryWarningEvent.hpp +3 -3
  2. package/nitrogen/generated/android/c++/JHybridReactNativePerfStatsSpec.cpp +29 -28
  3. package/nitrogen/generated/android/c++/JHybridReactNativePerfStatsSpec.hpp +20 -22
  4. package/nitrogen/generated/android/c++/JMemoryWarningEvent.hpp +2 -2
  5. package/nitrogen/generated/android/c++/JMemoryWarningLevel.hpp +4 -5
  6. package/nitrogen/generated/android/c++/JPerfSample.hpp +2 -2
  7. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeperfstats/Func_void_MemoryWarningEvent.kt +1 -1
  8. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeperfstats/HybridReactNativePerfStatsSpec.kt +16 -19
  9. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeperfstats/MemoryWarningEvent.kt +2 -2
  10. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeperfstats/MemoryWarningLevel.kt +3 -1
  11. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeperfstats/PerfSample.kt +2 -2
  12. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeperfstats/reactnativeperfstatsOnLoad.kt +1 -1
  13. package/nitrogen/generated/android/reactnativeperfstats+autolinking.cmake +1 -1
  14. package/nitrogen/generated/android/reactnativeperfstats+autolinking.gradle +1 -1
  15. package/nitrogen/generated/android/reactnativeperfstatsOnLoad.cpp +28 -18
  16. package/nitrogen/generated/android/reactnativeperfstatsOnLoad.hpp +14 -5
  17. package/nitrogen/generated/ios/ReactNativePerfStats+autolinking.rb +2 -2
  18. package/nitrogen/generated/ios/ReactNativePerfStats-Swift-Cxx-Bridge.cpp +1 -1
  19. package/nitrogen/generated/ios/ReactNativePerfStats-Swift-Cxx-Bridge.hpp +1 -1
  20. package/nitrogen/generated/ios/ReactNativePerfStats-Swift-Cxx-Umbrella.hpp +1 -1
  21. package/nitrogen/generated/ios/ReactNativePerfStatsAutolinking.mm +1 -1
  22. package/nitrogen/generated/ios/ReactNativePerfStatsAutolinking.swift +9 -8
  23. package/nitrogen/generated/ios/c++/HybridReactNativePerfStatsSpecSwift.cpp +1 -1
  24. package/nitrogen/generated/ios/c++/HybridReactNativePerfStatsSpecSwift.hpp +7 -1
  25. package/nitrogen/generated/ios/swift/Func_void_MemoryWarningEvent.swift +1 -2
  26. package/nitrogen/generated/ios/swift/Func_void_PerfSample.swift +1 -2
  27. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -2
  28. package/nitrogen/generated/ios/swift/HybridReactNativePerfStatsSpec.swift +3 -4
  29. package/nitrogen/generated/ios/swift/HybridReactNativePerfStatsSpec_cxx.swift +9 -2
  30. package/nitrogen/generated/ios/swift/MemoryWarningEvent.swift +7 -26
  31. package/nitrogen/generated/ios/swift/MemoryWarningLevel.swift +1 -1
  32. package/nitrogen/generated/ios/swift/PerfSample.swift +11 -42
  33. package/nitrogen/generated/shared/c++/HybridReactNativePerfStatsSpec.cpp +1 -1
  34. package/nitrogen/generated/shared/c++/HybridReactNativePerfStatsSpec.hpp +1 -1
  35. package/nitrogen/generated/shared/c++/MemoryWarningEvent.hpp +19 -11
  36. package/nitrogen/generated/shared/c++/MemoryWarningLevel.hpp +1 -1
  37. package/nitrogen/generated/shared/c++/PerfSample.hpp +25 -17
  38. package/package.json +4 -4
@@ -2,7 +2,7 @@
2
2
  /// JFunc_void_MemoryWarningEvent.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
@@ -27,7 +27,7 @@ namespace margelo::nitro::reactnativeperfstats {
27
27
  */
28
28
  struct JFunc_void_MemoryWarningEvent: public jni::JavaClass<JFunc_void_MemoryWarningEvent> {
29
29
  public:
30
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/Func_void_MemoryWarningEvent;";
30
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/Func_void_MemoryWarningEvent;";
31
31
 
32
32
  public:
33
33
  /**
@@ -63,7 +63,7 @@ namespace margelo::nitro::reactnativeperfstats {
63
63
  }
64
64
 
65
65
  public:
66
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/Func_void_MemoryWarningEvent_cxx;";
66
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/Func_void_MemoryWarningEvent_cxx;";
67
67
  static void registerNatives() {
68
68
  registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_MemoryWarningEvent_cxx::invoke_cxx)});
69
69
  }
@@ -2,7 +2,7 @@
2
2
  /// JHybridReactNativePerfStatsSpec.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 "JHybridReactNativePerfStatsSpec.hpp"
@@ -28,30 +28,31 @@ namespace margelo::nitro::reactnativeperfstats { enum class MemoryWarningLevel;
28
28
 
29
29
  namespace margelo::nitro::reactnativeperfstats {
30
30
 
31
- jni::local_ref<JHybridReactNativePerfStatsSpec::jhybriddata> JHybridReactNativePerfStatsSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
32
- return makeCxxInstance(jThis);
33
- }
34
-
35
- void JHybridReactNativePerfStatsSpec::registerNatives() {
36
- registerHybrid({
37
- makeNativeMethod("initHybrid", JHybridReactNativePerfStatsSpec::initHybrid),
38
- });
31
+ std::shared_ptr<JHybridReactNativePerfStatsSpec> JHybridReactNativePerfStatsSpec::JavaPart::getJHybridReactNativePerfStatsSpec() {
32
+ auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
33
+ auto castHybridObject = std::dynamic_pointer_cast<JHybridReactNativePerfStatsSpec>(hybridObject);
34
+ if (castHybridObject == nullptr) [[unlikely]] {
35
+ throw std::runtime_error("Failed to downcast JHybridObject to JHybridReactNativePerfStatsSpec!");
36
+ }
37
+ return castHybridObject;
39
38
  }
40
39
 
41
- size_t JHybridReactNativePerfStatsSpec::getExternalMemorySize() noexcept {
42
- static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
43
- return method(_javaPart);
40
+ jni::local_ref<JHybridReactNativePerfStatsSpec::CxxPart::jhybriddata> JHybridReactNativePerfStatsSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
41
+ return makeCxxInstance(jThis);
44
42
  }
45
43
 
46
- void JHybridReactNativePerfStatsSpec::dispose() noexcept {
47
- static const auto method = javaClassStatic()->getMethod<void()>("dispose");
48
- method(_javaPart);
44
+ std::shared_ptr<JHybridObject> JHybridReactNativePerfStatsSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
45
+ auto castJavaPart = jni::dynamic_ref_cast<JHybridReactNativePerfStatsSpec::JavaPart>(javaPart);
46
+ if (castJavaPart == nullptr) [[unlikely]] {
47
+ throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridReactNativePerfStatsSpec::JavaPart!");
48
+ }
49
+ return std::make_shared<JHybridReactNativePerfStatsSpec>(castJavaPart);
49
50
  }
50
51
 
51
- std::string JHybridReactNativePerfStatsSpec::toString() {
52
- static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
53
- auto javaString = method(_javaPart);
54
- return javaString->toStdString();
52
+ void JHybridReactNativePerfStatsSpec::CxxPart::registerNatives() {
53
+ registerHybrid({
54
+ makeNativeMethod("initHybrid", JHybridReactNativePerfStatsSpec::CxxPart::initHybrid),
55
+ });
55
56
  }
56
57
 
57
58
  // Properties
@@ -59,23 +60,23 @@ namespace margelo::nitro::reactnativeperfstats {
59
60
 
60
61
  // Methods
61
62
  void JHybridReactNativePerfStatsSpec::start(double intervalMs) {
62
- static const auto method = javaClassStatic()->getMethod<void(double /* intervalMs */)>("start");
63
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* intervalMs */)>("start");
63
64
  method(_javaPart, intervalMs);
64
65
  }
65
66
  void JHybridReactNativePerfStatsSpec::stop() {
66
- static const auto method = javaClassStatic()->getMethod<void()>("stop");
67
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("stop");
67
68
  method(_javaPart);
68
69
  }
69
70
  void JHybridReactNativePerfStatsSpec::showOverlay() {
70
- static const auto method = javaClassStatic()->getMethod<void()>("showOverlay");
71
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("showOverlay");
71
72
  method(_javaPart);
72
73
  }
73
74
  void JHybridReactNativePerfStatsSpec::hideOverlay() {
74
- static const auto method = javaClassStatic()->getMethod<void()>("hideOverlay");
75
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("hideOverlay");
75
76
  method(_javaPart);
76
77
  }
77
78
  std::shared_ptr<Promise<PerfSample>> JHybridReactNativePerfStatsSpec::sample() {
78
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("sample");
79
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("sample");
79
80
  auto __result = method(_javaPart);
80
81
  return [&]() {
81
82
  auto __promise = Promise<PerfSample>::create();
@@ -91,20 +92,20 @@ namespace margelo::nitro::reactnativeperfstats {
91
92
  }();
92
93
  }
93
94
  void JHybridReactNativePerfStatsSpec::setJsFpsHint(double fps) {
94
- static const auto method = javaClassStatic()->getMethod<void(double /* fps */)>("setJsFpsHint");
95
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* fps */)>("setJsFpsHint");
95
96
  method(_javaPart, fps);
96
97
  }
97
98
  double JHybridReactNativePerfStatsSpec::addMemoryWarningListener(const std::function<void(const MemoryWarningEvent& /* event */)>& callback) {
98
- static const auto method = javaClassStatic()->getMethod<double(jni::alias_ref<JFunc_void_MemoryWarningEvent::javaobject> /* callback */)>("addMemoryWarningListener_cxx");
99
+ static const auto method = _javaPart->javaClassStatic()->getMethod<double(jni::alias_ref<JFunc_void_MemoryWarningEvent::javaobject> /* callback */)>("addMemoryWarningListener_cxx");
99
100
  auto __result = method(_javaPart, JFunc_void_MemoryWarningEvent_cxx::fromCpp(callback));
100
101
  return __result;
101
102
  }
102
103
  void JHybridReactNativePerfStatsSpec::removeMemoryWarningListener(double id) {
103
- static const auto method = javaClassStatic()->getMethod<void(double /* id */)>("removeMemoryWarningListener");
104
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* id */)>("removeMemoryWarningListener");
104
105
  method(_javaPart, id);
105
106
  }
106
107
  void JHybridReactNativePerfStatsSpec::cleanupNativeCaches() {
107
- static const auto method = javaClassStatic()->getMethod<void()>("cleanupNativeCaches");
108
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("cleanupNativeCaches");
108
109
  method(_javaPart);
109
110
  }
110
111
 
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativePerfStatsSpec.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::reactnativeperfstats {
18
18
 
19
19
  using namespace facebook;
20
20
 
21
- class JHybridReactNativePerfStatsSpec: public jni::HybridClass<JHybridReactNativePerfStatsSpec, JHybridObject>,
22
- public virtual HybridReactNativePerfStatsSpec {
21
+ class JHybridReactNativePerfStatsSpec: public virtual HybridReactNativePerfStatsSpec, public virtual JHybridObject {
23
22
  public:
24
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/HybridReactNativePerfStatsSpec;";
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 JHybridReactNativePerfStatsSpec(jni::alias_ref<jhybridobject> jThis) :
31
- HybridObject(HybridReactNativePerfStatsSpec::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/reactnativeperfstats/HybridReactNativePerfStatsSpec;";
25
+ std::shared_ptr<JHybridReactNativePerfStatsSpec> getJHybridReactNativePerfStatsSpec();
26
+ };
27
+ struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
28
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/HybridReactNativePerfStatsSpec$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 JHybridReactNativePerfStatsSpec(const jni::local_ref<JHybridReactNativePerfStatsSpec::JavaPart>& javaPart):
38
+ HybridObject(HybridReactNativePerfStatsSpec::TAG),
39
+ JHybridObject(javaPart),
40
+ _javaPart(jni::make_global(javaPart)) {}
36
41
  ~JHybridReactNativePerfStatsSpec() 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<JHybridReactNativePerfStatsSpec::javaobject>& getJavaPart() const noexcept {
47
+ inline const jni::global_ref<JHybridReactNativePerfStatsSpec::JavaPart>& getJavaPart() const noexcept {
48
48
  return _javaPart;
49
49
  }
50
50
 
@@ -65,9 +65,7 @@ namespace margelo::nitro::reactnativeperfstats {
65
65
  void cleanupNativeCaches() override;
66
66
 
67
67
  private:
68
- friend HybridBase;
69
- using HybridBase::HybridBase;
70
- jni::global_ref<JHybridReactNativePerfStatsSpec::javaobject> _javaPart;
68
+ jni::global_ref<JHybridReactNativePerfStatsSpec::JavaPart> _javaPart;
71
69
  };
72
70
 
73
71
  } // namespace margelo::nitro::reactnativeperfstats
@@ -2,7 +2,7 @@
2
2
  /// JMemoryWarningEvent.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,7 +22,7 @@ namespace margelo::nitro::reactnativeperfstats {
22
22
  */
23
23
  struct JMemoryWarningEvent final: public jni::JavaClass<JMemoryWarningEvent> {
24
24
  public:
25
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/MemoryWarningEvent;";
25
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/MemoryWarningEvent;";
26
26
 
27
27
  public:
28
28
  /**
@@ -2,7 +2,7 @@
2
2
  /// JMemoryWarningLevel.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
@@ -19,7 +19,7 @@ namespace margelo::nitro::reactnativeperfstats {
19
19
  */
20
20
  struct JMemoryWarningLevel final: public jni::JavaClass<JMemoryWarningLevel> {
21
21
  public:
22
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/MemoryWarningLevel;";
22
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/MemoryWarningLevel;";
23
23
 
24
24
  public:
25
25
  /**
@@ -41,13 +41,12 @@ namespace margelo::nitro::reactnativeperfstats {
41
41
  [[maybe_unused]]
42
42
  static jni::alias_ref<JMemoryWarningLevel> fromCpp(MemoryWarningLevel value) {
43
43
  static const auto clazz = javaClassStatic();
44
- static const auto fieldLOW = clazz->getStaticField<JMemoryWarningLevel>("LOW");
45
- static const auto fieldCRITICAL = clazz->getStaticField<JMemoryWarningLevel>("CRITICAL");
46
-
47
44
  switch (value) {
48
45
  case MemoryWarningLevel::LOW:
46
+ static const auto fieldLOW = clazz->getStaticField<JMemoryWarningLevel>("LOW");
49
47
  return clazz->getStaticFieldValue(fieldLOW);
50
48
  case MemoryWarningLevel::CRITICAL:
49
+ static const auto fieldCRITICAL = clazz->getStaticField<JMemoryWarningLevel>("CRITICAL");
51
50
  return clazz->getStaticFieldValue(fieldCRITICAL);
52
51
  default:
53
52
  std::string stringValue = std::to_string(static_cast<int>(value));
@@ -2,7 +2,7 @@
2
2
  /// JPerfSample.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::reactnativeperfstats {
21
21
  */
22
22
  struct JPerfSample final: public jni::JavaClass<JPerfSample> {
23
23
  public:
24
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/PerfSample;";
24
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/PerfSample;";
25
25
 
26
26
  public:
27
27
  /**
@@ -2,7 +2,7 @@
2
2
  /// Func_void_MemoryWarningEvent.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.reactnativeperfstats
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativePerfStatsSpec.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.reactnativeperfstats
@@ -25,23 +25,6 @@ import com.margelo.nitro.core.HybridObject
25
25
  "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
26
26
  )
27
27
  abstract class HybridReactNativePerfStatsSpec: HybridObject() {
28
- @DoNotStrip
29
- private var mHybridData: HybridData = initHybrid()
30
-
31
- init {
32
- super.updateNative(mHybridData)
33
- }
34
-
35
- override fun updateNative(hybridData: HybridData) {
36
- mHybridData = hybridData
37
- super.updateNative(hybridData)
38
- }
39
-
40
- // Default implementation of `HybridObject.toString()`
41
- override fun toString(): String {
42
- return "[HybridObject ReactNativePerfStats]"
43
- }
44
-
45
28
  // Properties
46
29
 
47
30
 
@@ -87,7 +70,21 @@ abstract class HybridReactNativePerfStatsSpec: HybridObject() {
87
70
  @Keep
88
71
  abstract fun cleanupNativeCaches(): Unit
89
72
 
90
- private external fun initHybrid(): HybridData
73
+ // Default implementation of `HybridObject.toString()`
74
+ override fun toString(): String {
75
+ return "[HybridObject ReactNativePerfStats]"
76
+ }
77
+
78
+ // C++ backing class
79
+ @DoNotStrip
80
+ @Keep
81
+ protected open class CxxPart(javaPart: HybridReactNativePerfStatsSpec): HybridObject.CxxPart(javaPart) {
82
+ // C++ JHybridReactNativePerfStatsSpec::CxxPart::initHybrid(...)
83
+ external override fun initHybrid(): HybridData
84
+ }
85
+ override fun createCxxPart(): CxxPart {
86
+ return CxxPart(this)
87
+ }
91
88
 
92
89
  companion object {
93
90
  protected const val TAG = "HybridReactNativePerfStatsSpec"
@@ -2,7 +2,7 @@
2
2
  /// MemoryWarningEvent.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.reactnativeperfstats
@@ -29,7 +29,7 @@ data class MemoryWarningEvent(
29
29
  ) {
30
30
  /* primary constructor */
31
31
 
32
- private companion object {
32
+ companion object {
33
33
  /**
34
34
  * Constructor called from C++
35
35
  */
@@ -2,7 +2,7 @@
2
2
  /// MemoryWarningLevel.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.reactnativeperfstats
@@ -18,4 +18,6 @@ import com.facebook.proguard.annotations.DoNotStrip
18
18
  enum class MemoryWarningLevel(@DoNotStrip @Keep val value: Int) {
19
19
  LOW(0),
20
20
  CRITICAL(1);
21
+
22
+ companion object
21
23
  }
@@ -2,7 +2,7 @@
2
2
  /// PerfSample.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.reactnativeperfstats
@@ -35,7 +35,7 @@ data class PerfSample(
35
35
  ) {
36
36
  /* primary constructor */
37
37
 
38
- private companion object {
38
+ companion object {
39
39
  /**
40
40
  * Constructor called from C++
41
41
  */
@@ -2,7 +2,7 @@
2
2
  /// reactnativeperfstatsOnLoad.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.reactnativeperfstats
@@ -2,7 +2,7 @@
2
2
  # reactnativeperfstats+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
  /// reactnativeperfstats+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
  /// reactnativeperfstatsOnLoad.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_REACTNATIVEPERFSTATS_WITH_GENERATED_CMAKE_PROJECT
@@ -22,25 +22,35 @@
22
22
  namespace margelo::nitro::reactnativeperfstats {
23
23
 
24
24
  int initialize(JavaVM* vm) {
25
+ return facebook::jni::initialize(vm, []() {
26
+ ::margelo::nitro::reactnativeperfstats::registerAllNatives();
27
+ });
28
+ }
29
+
30
+ struct JHybridReactNativePerfStatsSpecImpl: public jni::JavaClass<JHybridReactNativePerfStatsSpecImpl, JHybridReactNativePerfStatsSpec::JavaPart> {
31
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeperfstats/ReactNativePerfStats;";
32
+ static std::shared_ptr<JHybridReactNativePerfStatsSpec> create() {
33
+ static const auto constructorFn = javaClassStatic()->getConstructor<JHybridReactNativePerfStatsSpecImpl::javaobject()>();
34
+ jni::local_ref<JHybridReactNativePerfStatsSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
35
+ return javaPart->getJHybridReactNativePerfStatsSpec();
36
+ }
37
+ };
38
+
39
+ void registerAllNatives() {
25
40
  using namespace margelo::nitro;
26
41
  using namespace margelo::nitro::reactnativeperfstats;
27
- using namespace facebook;
28
-
29
- return facebook::jni::initialize(vm, [] {
30
- // Register native JNI methods
31
- margelo::nitro::reactnativeperfstats::JHybridReactNativePerfStatsSpec::registerNatives();
32
- margelo::nitro::reactnativeperfstats::JFunc_void_MemoryWarningEvent_cxx::registerNatives();
33
-
34
- // Register Nitro Hybrid Objects
35
- HybridObjectRegistry::registerHybridObjectConstructor(
36
- "ReactNativePerfStats",
37
- []() -> std::shared_ptr<HybridObject> {
38
- static DefaultConstructableObject<JHybridReactNativePerfStatsSpec::javaobject> object("com/margelo/nitro/reactnativeperfstats/ReactNativePerfStats");
39
- auto instance = object.create();
40
- return instance->cthis()->shared();
41
- }
42
- );
43
- });
42
+
43
+ // Register native JNI methods
44
+ margelo::nitro::reactnativeperfstats::JHybridReactNativePerfStatsSpec::CxxPart::registerNatives();
45
+ margelo::nitro::reactnativeperfstats::JFunc_void_MemoryWarningEvent_cxx::registerNatives();
46
+
47
+ // Register Nitro Hybrid Objects
48
+ HybridObjectRegistry::registerHybridObjectConstructor(
49
+ "ReactNativePerfStats",
50
+ []() -> std::shared_ptr<HybridObject> {
51
+ return JHybridReactNativePerfStatsSpecImpl::create();
52
+ }
53
+ );
44
54
  }
45
55
 
46
56
  } // namespace margelo::nitro::reactnativeperfstats
@@ -2,24 +2,33 @@
2
2
  /// reactnativeperfstatsOnLoad.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::reactnativeperfstats {
12
13
 
14
+ [[deprecated("Use registerNatives() instead.")]]
15
+ int initialize(JavaVM* vm);
16
+
13
17
  /**
14
- * Initializes the native (C++) part of reactnativeperfstats, 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 reactnativeperfstats, 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::reactnativeperfstats::initialize(vm);
24
+ * return facebook::jni::initialize(vm, []() {
25
+ * // register all reactnativeperfstats HybridObjects
26
+ * margelo::nitro::reactnativeperfstats::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::reactnativeperfstats
@@ -2,7 +2,7 @@
2
2
  # ReactNativePerfStats+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
  /// ReactNativePerfStats-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 "ReactNativePerfStats-Swift-Cxx-Bridge.hpp"
@@ -2,7 +2,7 @@
2
2
  /// ReactNativePerfStats-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
  /// ReactNativePerfStats-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
  /// ReactNativePerfStatsAutolinking.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
  /// ReactNativePerfStatsAutolinking.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 ReactNativePerfStatsAutolinking {
9
13
  public typealias bridge = margelo.nitro.reactnativeperfstats.bridge.swift
10
14
 
11
- /**
12
- * Creates an instance of a Swift class that implements `HybridReactNativePerfStatsSpec`,
13
- * and wraps it in a Swift class that can directly interop with C++ (`HybridReactNativePerfStatsSpec_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, `ReactNativePerfStats`).
17
- */
18
15
  public static func createReactNativePerfStats() -> bridge.std__shared_ptr_HybridReactNativePerfStatsSpec_ {
19
16
  let hybridObject = ReactNativePerfStats()
20
17
  return { () -> bridge.std__shared_ptr_HybridReactNativePerfStatsSpec_ in
@@ -22,4 +19,8 @@ public final class ReactNativePerfStatsAutolinking {
22
19
  return __cxxWrapped.getCxxPart()
23
20
  }()
24
21
  }
22
+
23
+ public static func isReactNativePerfStatsRecyclable() -> Bool {
24
+ return ReactNativePerfStats.self is any RecyclableView.Type
25
+ }
25
26
  }
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativePerfStatsSpecSwift.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 "HybridReactNativePerfStatsSpecSwift.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativePerfStatsSpecSwift.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
@@ -56,6 +56,12 @@ namespace margelo::nitro::reactnativeperfstats {
56
56
  inline size_t getExternalMemorySize() noexcept override {
57
57
  return _swiftPart.getMemorySize();
58
58
  }
59
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
60
+ if (auto otherCast = std::dynamic_pointer_cast<HybridReactNativePerfStatsSpecSwift>(other)) {
61
+ return _swiftPart.equals(otherCast->_swiftPart);
62
+ }
63
+ return false;
64
+ }
59
65
  void dispose() noexcept override {
60
66
  _swiftPart.dispose();
61
67
  }
@@ -2,10 +2,9 @@
2
2
  /// Func_void_MemoryWarningEvent.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_PerfSample.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
  /// HybridReactNativePerfStatsSpec.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 ``HybridReactNativePerfStatsSpec``
@@ -38,14 +37,14 @@ open class HybridReactNativePerfStatsSpec_base {
38
37
  public init() { }
39
38
  public func getCxxWrapper() -> HybridReactNativePerfStatsSpec_cxx {
40
39
  #if DEBUG
41
- guard self is HybridReactNativePerfStatsSpec else {
40
+ guard self is any HybridReactNativePerfStatsSpec else {
42
41
  fatalError("`self` is not a `HybridReactNativePerfStatsSpec`! Did you accidentally inherit from `HybridReactNativePerfStatsSpec_base` instead of `HybridReactNativePerfStatsSpec`?")
43
42
  }
44
43
  #endif
45
44
  if let cxxWrapper = self.cxxWrapper {
46
45
  return cxxWrapper
47
46
  } else {
48
- let cxxWrapper = HybridReactNativePerfStatsSpec_cxx(self as! HybridReactNativePerfStatsSpec)
47
+ let cxxWrapper = HybridReactNativePerfStatsSpec_cxx(self as! any HybridReactNativePerfStatsSpec)
49
48
  self.cxxWrapper = cxxWrapper
50
49
  return cxxWrapper
51
50
  }
@@ -2,10 +2,9 @@
2
2
  /// HybridReactNativePerfStatsSpec_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 HybridReactNativePerfStatsSpec_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: HybridReactNativePerfStatsSpec_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
  /// MemoryWarningEvent.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,36 +22,18 @@ public extension MemoryWarningEvent {
23
22
  self.init(level, rss, timestamp)
24
23
  }
25
24
 
25
+ @inline(__always)
26
26
  var level: MemoryWarningLevel {
27
- @inline(__always)
28
- get {
29
- return self.__level
30
- }
31
- @inline(__always)
32
- set {
33
- self.__level = newValue
34
- }
27
+ return self.__level
35
28
  }
36
29
 
30
+ @inline(__always)
37
31
  var rss: Double {
38
- @inline(__always)
39
- get {
40
- return self.__rss
41
- }
42
- @inline(__always)
43
- set {
44
- self.__rss = newValue
45
- }
32
+ return self.__rss
46
33
  }
47
34
 
35
+ @inline(__always)
48
36
  var timestamp: Double {
49
- @inline(__always)
50
- get {
51
- return self.__timestamp
52
- }
53
- @inline(__always)
54
- set {
55
- self.__timestamp = newValue
56
- }
37
+ return self.__timestamp
57
38
  }
58
39
  }
@@ -2,7 +2,7 @@
2
2
  /// MemoryWarningLevel.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
8
  /**
@@ -2,10 +2,9 @@
2
2
  /// PerfSample.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,58 +22,28 @@ public extension PerfSample {
23
22
  self.init(cpu, rss, uiFps, jsFps, timestamp)
24
23
  }
25
24
 
25
+ @inline(__always)
26
26
  var cpu: Double {
27
- @inline(__always)
28
- get {
29
- return self.__cpu
30
- }
31
- @inline(__always)
32
- set {
33
- self.__cpu = newValue
34
- }
27
+ return self.__cpu
35
28
  }
36
29
 
30
+ @inline(__always)
37
31
  var rss: Double {
38
- @inline(__always)
39
- get {
40
- return self.__rss
41
- }
42
- @inline(__always)
43
- set {
44
- self.__rss = newValue
45
- }
32
+ return self.__rss
46
33
  }
47
34
 
35
+ @inline(__always)
48
36
  var uiFps: Double {
49
- @inline(__always)
50
- get {
51
- return self.__uiFps
52
- }
53
- @inline(__always)
54
- set {
55
- self.__uiFps = newValue
56
- }
37
+ return self.__uiFps
57
38
  }
58
39
 
40
+ @inline(__always)
59
41
  var jsFps: Double {
60
- @inline(__always)
61
- get {
62
- return self.__jsFps
63
- }
64
- @inline(__always)
65
- set {
66
- self.__jsFps = newValue
67
- }
42
+ return self.__jsFps
68
43
  }
69
44
 
45
+ @inline(__always)
70
46
  var timestamp: Double {
71
- @inline(__always)
72
- get {
73
- return self.__timestamp
74
- }
75
- @inline(__always)
76
- set {
77
- self.__timestamp = newValue
78
- }
47
+ return self.__timestamp
79
48
  }
80
49
  }
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativePerfStatsSpec.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 "HybridReactNativePerfStatsSpec.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridReactNativePerfStatsSpec.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
  /// MemoryWarningEvent.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
  // Forward declaration of `MemoryWarningLevel` to properly resolve imports.
27
32
  namespace margelo::nitro::reactnativeperfstats { enum class MemoryWarningLevel; }
@@ -33,7 +38,7 @@ namespace margelo::nitro::reactnativeperfstats {
33
38
  /**
34
39
  * A struct which can be represented as a JavaScript object (MemoryWarningEvent).
35
40
  */
36
- struct MemoryWarningEvent {
41
+ struct MemoryWarningEvent final {
37
42
  public:
38
43
  MemoryWarningLevel level SWIFT_PRIVATE;
39
44
  double rss SWIFT_PRIVATE;
@@ -42,6 +47,9 @@ namespace margelo::nitro::reactnativeperfstats {
42
47
  public:
43
48
  MemoryWarningEvent() = default;
44
49
  explicit MemoryWarningEvent(MemoryWarningLevel level, double rss, double timestamp): level(level), rss(rss), timestamp(timestamp) {}
50
+
51
+ public:
52
+ friend bool operator==(const MemoryWarningEvent& lhs, const MemoryWarningEvent& rhs) = default;
45
53
  };
46
54
 
47
55
  } // namespace margelo::nitro::reactnativeperfstats
@@ -54,16 +62,16 @@ namespace margelo::nitro {
54
62
  static inline margelo::nitro::reactnativeperfstats::MemoryWarningEvent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
55
63
  jsi::Object obj = arg.asObject(runtime);
56
64
  return margelo::nitro::reactnativeperfstats::MemoryWarningEvent(
57
- JSIConverter<margelo::nitro::reactnativeperfstats::MemoryWarningLevel>::fromJSI(runtime, obj.getProperty(runtime, "level")),
58
- JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "rss")),
59
- JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "timestamp"))
65
+ JSIConverter<margelo::nitro::reactnativeperfstats::MemoryWarningLevel>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "level"))),
66
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rss"))),
67
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))
60
68
  );
61
69
  }
62
70
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativeperfstats::MemoryWarningEvent& arg) {
63
71
  jsi::Object obj(runtime);
64
- obj.setProperty(runtime, "level", JSIConverter<margelo::nitro::reactnativeperfstats::MemoryWarningLevel>::toJSI(runtime, arg.level));
65
- obj.setProperty(runtime, "rss", JSIConverter<double>::toJSI(runtime, arg.rss));
66
- obj.setProperty(runtime, "timestamp", JSIConverter<double>::toJSI(runtime, arg.timestamp));
72
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "level"), JSIConverter<margelo::nitro::reactnativeperfstats::MemoryWarningLevel>::toJSI(runtime, arg.level));
73
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "rss"), JSIConverter<double>::toJSI(runtime, arg.rss));
74
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestamp"), JSIConverter<double>::toJSI(runtime, arg.timestamp));
67
75
  return obj;
68
76
  }
69
77
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -74,9 +82,9 @@ namespace margelo::nitro {
74
82
  if (!nitro::isPlainObject(runtime, obj)) {
75
83
  return false;
76
84
  }
77
- if (!JSIConverter<margelo::nitro::reactnativeperfstats::MemoryWarningLevel>::canConvert(runtime, obj.getProperty(runtime, "level"))) return false;
78
- if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "rss"))) return false;
79
- if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "timestamp"))) return false;
85
+ if (!JSIConverter<margelo::nitro::reactnativeperfstats::MemoryWarningLevel>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "level")))) return false;
86
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rss")))) return false;
87
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))) return false;
80
88
  return true;
81
89
  }
82
90
  };
@@ -2,7 +2,7 @@
2
2
  /// MemoryWarningLevel.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
  /// PerfSample.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,7 +37,7 @@ namespace margelo::nitro::reactnativeperfstats {
32
37
  /**
33
38
  * A struct which can be represented as a JavaScript object (PerfSample).
34
39
  */
35
- struct PerfSample {
40
+ struct PerfSample final {
36
41
  public:
37
42
  double cpu SWIFT_PRIVATE;
38
43
  double rss SWIFT_PRIVATE;
@@ -43,6 +48,9 @@ namespace margelo::nitro::reactnativeperfstats {
43
48
  public:
44
49
  PerfSample() = default;
45
50
  explicit PerfSample(double cpu, double rss, double uiFps, double jsFps, double timestamp): cpu(cpu), rss(rss), uiFps(uiFps), jsFps(jsFps), timestamp(timestamp) {}
51
+
52
+ public:
53
+ friend bool operator==(const PerfSample& lhs, const PerfSample& rhs) = default;
46
54
  };
47
55
 
48
56
  } // namespace margelo::nitro::reactnativeperfstats
@@ -55,20 +63,20 @@ namespace margelo::nitro {
55
63
  static inline margelo::nitro::reactnativeperfstats::PerfSample fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
56
64
  jsi::Object obj = arg.asObject(runtime);
57
65
  return margelo::nitro::reactnativeperfstats::PerfSample(
58
- JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "cpu")),
59
- JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "rss")),
60
- JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "uiFps")),
61
- JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "jsFps")),
62
- JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "timestamp"))
66
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cpu"))),
67
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rss"))),
68
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uiFps"))),
69
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "jsFps"))),
70
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))
63
71
  );
64
72
  }
65
73
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativeperfstats::PerfSample& arg) {
66
74
  jsi::Object obj(runtime);
67
- obj.setProperty(runtime, "cpu", JSIConverter<double>::toJSI(runtime, arg.cpu));
68
- obj.setProperty(runtime, "rss", JSIConverter<double>::toJSI(runtime, arg.rss));
69
- obj.setProperty(runtime, "uiFps", JSIConverter<double>::toJSI(runtime, arg.uiFps));
70
- obj.setProperty(runtime, "jsFps", JSIConverter<double>::toJSI(runtime, arg.jsFps));
71
- obj.setProperty(runtime, "timestamp", JSIConverter<double>::toJSI(runtime, arg.timestamp));
75
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "cpu"), JSIConverter<double>::toJSI(runtime, arg.cpu));
76
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "rss"), JSIConverter<double>::toJSI(runtime, arg.rss));
77
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "uiFps"), JSIConverter<double>::toJSI(runtime, arg.uiFps));
78
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "jsFps"), JSIConverter<double>::toJSI(runtime, arg.jsFps));
79
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestamp"), JSIConverter<double>::toJSI(runtime, arg.timestamp));
72
80
  return obj;
73
81
  }
74
82
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -79,11 +87,11 @@ namespace margelo::nitro {
79
87
  if (!nitro::isPlainObject(runtime, obj)) {
80
88
  return false;
81
89
  }
82
- if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "cpu"))) return false;
83
- if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "rss"))) return false;
84
- if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "uiFps"))) return false;
85
- if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "jsFps"))) return false;
86
- if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "timestamp"))) return false;
90
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cpu")))) return false;
91
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rss")))) return false;
92
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uiFps")))) return false;
93
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "jsFps")))) return false;
94
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))) return false;
87
95
  return true;
88
96
  }
89
97
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-perf-stats",
3
- "version": "3.0.81",
3
+ "version": "3.0.82",
4
4
  "description": "react-native-perf-stats",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -77,12 +77,12 @@
77
77
  "eslint-plugin-prettier": "^5.5.4",
78
78
  "jest": "^29.7.0",
79
79
  "lefthook": "^2.0.3",
80
- "nitrogen": "0.31.10",
80
+ "nitrogen": "0.35.2",
81
81
  "prettier": "^2.8.8",
82
82
  "react": "19.2.0",
83
83
  "react-native": "0.83.0",
84
84
  "react-native-builder-bob": "^0.40.13",
85
- "react-native-nitro-modules": "0.33.2",
85
+ "react-native-nitro-modules": "0.35.2",
86
86
  "release-it": "^19.0.4",
87
87
  "turbo": "^2.5.6",
88
88
  "typescript": "^5.9.2"
@@ -90,7 +90,7 @@
90
90
  "peerDependencies": {
91
91
  "react": "*",
92
92
  "react-native": "*",
93
- "react-native-nitro-modules": "0.33.2"
93
+ "react-native-nitro-modules": "0.35.2"
94
94
  },
95
95
  "react-native-builder-bob": {
96
96
  "source": "src",