@amazon-devices/react-native-worklets 1.0.0-rn-83 → 1.0.0-rn-83.1

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.
@@ -1,7 +1,5 @@
1
1
  #pragma once
2
2
 
3
- #include <keplerui-083/keplerscript-export.h>
4
-
5
3
  #include <worklets/WorkletRuntime/WorkletRuntime.h>
6
4
 
7
5
  #include <jsi/jsi.h>
@@ -13,13 +11,17 @@
13
11
  #include <unordered_map>
14
12
  #include <utility>
15
13
 
14
+ // amznmod_react - export symbols for reanimated
15
+ #include "react-native-worklets-4_export.h"
16
+
16
17
  using namespace facebook;
17
18
 
18
19
  namespace worklets {
19
20
 
20
21
  class WorkletEventHandler;
21
22
 
22
- class KEPLERSCRIPT_EXPORT EventHandlerRegistry {
23
+ // amznmod_react - export symbols for reanimated
24
+ class REACT_NATIVE_WORKLETS_4_EXPORT EventHandlerRegistry {
23
25
  std::map<
24
26
  std::pair<int, std::string>,
25
27
  std::unordered_map<uint64_t, std::shared_ptr<WorkletEventHandler>>>
@@ -8,10 +8,9 @@ namespace worklets {
8
8
  AsyncQueueImpl::AsyncQueueImpl(std::string name)
9
9
  : state_(std::make_shared<AsyncQueueState>()) {
10
10
  auto thread = std::thread([name, state = state_] {
11
- // amzn_mod - include check for VOLTA_DARWIN
12
- #if __APPLE__ || defined(VOLTA_DARWIN)
11
+ #if __APPLE__
13
12
  pthread_setname_np(name.c_str());
14
- #endif // __APPLE__ || VOLTA_DARWIN
13
+ #endif // __APPLE__
15
14
  while (state->running) {
16
15
  std::unique_lock<std::mutex> lock(state->mutex);
17
16
  state->cv.wait(
@@ -28,10 +27,10 @@ AsyncQueueImpl::AsyncQueueImpl(std::string name)
28
27
  job();
29
28
  }
30
29
  });
31
- // amzn_mod - exclude VOLTA_DARWIN
32
- #if defined(ANDROID) && not defined(VOLTA_DARWIN)
30
+ // amzn_mod - exclude __APPLE__
31
+ #if defined(ANDROID) && not defined(__APPLE__)
33
32
  pthread_setname_np(thread.native_handle(), name.c_str());
34
- #endif // ANDROID && !VOLTA_DARWIN
33
+ #endif // ANDROID && !__APPLE__
35
34
  thread.detach();
36
35
  }
37
36
 
@@ -28,10 +28,10 @@ void EventLoop::run() {
28
28
  const auto threadName = name_ + "(timeout)";
29
29
  auto thread = std::thread(
30
30
  [threadName, state = timeoutsQueueState_, weakThis = weak_from_this()] {
31
- // amzn_mod - include check for VOLTA_DARWIN
32
- #if __APPLE__ || defined(VOLTA_DARWIN)
31
+ // amzn_mod - include check for Vega aarch64
32
+ #if __APPLE__
33
33
  pthread_setname_np(threadName.c_str());
34
- #endif // __APPLE__ || VOLTA_DARWIN
34
+ #endif // __APPLE__
35
35
  while (state->running) {
36
36
  std::unique_lock<std::mutex> lock(state->mutex);
37
37
 
@@ -73,10 +73,10 @@ void EventLoop::run() {
73
73
  }
74
74
  }
75
75
  });
76
- // amzn_mod - exclude VOLTA_DARWIN
77
- #if defined(ANDROID) && not defined(VOLTA_DARWIN)
76
+ // amzn_mod - exclude __APPLE__
77
+ #if defined(ANDROID) && not defined(__APPLE__)
78
78
  pthread_setname_np(thread.native_handle(), threadName.c_str());
79
- #endif // ANDROID && !VOLTA_DARWIN
79
+ #endif // ANDROID && !__APPLE__
80
80
  thread.detach();
81
81
  }
82
82
 
@@ -1,8 +1,5 @@
1
1
  #pragma once
2
2
 
3
- // amznmod_react - export symbols for reanimated
4
- #include <keplerui-083/keplerscript-export.h>
5
-
6
3
  #include <worklets/Registries/WorkletRuntimeRegistry.h>
7
4
 
8
5
  #include <jsi/jsi.h>
@@ -12,6 +9,9 @@
12
9
  #include <utility>
13
10
  #include <vector>
14
11
 
12
+ // amznmod_react - export symbols for reanimated
13
+ #include "react-native-worklets-4_export.h"
14
+
15
15
  using namespace facebook;
16
16
 
17
17
  namespace worklets {
@@ -20,7 +20,7 @@ jsi::Function getValueUnpacker(jsi::Runtime &rt);
20
20
 
21
21
  #ifndef NDEBUG
22
22
  // amznmod_react - export symbols for reanimated
23
- jsi::Function KEPLERSCRIPT_EXPORT getCallGuard(jsi::Runtime &rt);
23
+ jsi::Function REACT_NATIVE_WORKLETS_4_EXPORT getCallGuard(jsi::Runtime &rt);
24
24
  #endif // NDEBUG
25
25
 
26
26
  // If possible, please use `WorkletRuntime::runGuarded` instead.
@@ -67,7 +67,7 @@ inline void cleanupIfRuntimeExists(
67
67
  }
68
68
 
69
69
  // amznmod_react - export symbols for reanimated
70
- class KEPLERSCRIPT_EXPORT Serializable {
70
+ class REACT_NATIVE_WORKLETS_4_EXPORT Serializable {
71
71
  public:
72
72
  virtual jsi::Value toJSValue(jsi::Runtime &rt) = 0;
73
73
 
@@ -213,7 +213,7 @@ jsi::Value makeSerializableWorklet(
213
213
  const bool &shouldRetainRemote);
214
214
 
215
215
  // amznmod_react - export symbols for reanimated
216
- std::shared_ptr<Serializable> KEPLERSCRIPT_EXPORT extractSerializableOrThrow(
216
+ std::shared_ptr<Serializable> REACT_NATIVE_WORKLETS_4_EXPORT extractSerializableOrThrow(
217
217
  jsi::Runtime &rt,
218
218
  const jsi::Value &maybeSerializableValue,
219
219
  const std::string &errorMessage =
@@ -244,7 +244,7 @@ class SerializableArray : public Serializable {
244
244
  };
245
245
 
246
246
  // amznmod_react - export symbols for reanimated
247
- class KEPLERSCRIPT_EXPORT SerializableObject : public Serializable {
247
+ class REACT_NATIVE_WORKLETS_4_EXPORT SerializableObject : public Serializable {
248
248
  public:
249
249
  SerializableObject(jsi::Runtime &rt, const jsi::Object &object);
250
250
 
@@ -328,7 +328,8 @@ class SerializableArrayBuffer : public Serializable {
328
328
  const std::vector<uint8_t> data_;
329
329
  };
330
330
 
331
- class KEPLERSCRIPT_EXPORT SerializableWorklet : public SerializableObject {
331
+ // amznmod_react - export symbols for reanimated
332
+ class REACT_NATIVE_WORKLETS_4_EXPORT SerializableWorklet : public SerializableObject {
332
333
  public:
333
334
  SerializableWorklet(jsi::Runtime &rt, const jsi::Object &worklet)
334
335
  : SerializableObject(rt, worklet) {
@@ -1,12 +1,12 @@
1
1
  #pragma once
2
2
 
3
- // amznmod_react - export symbols for reanimated
4
- #include <keplerui-083/keplerscript-export.h>
5
-
6
3
  #include <jsi/jsi.h>
7
4
  #include <string>
8
5
  #include <vector>
9
6
 
7
+ // amznmod_react - export symbols for reanimated
8
+ #include "react-native-worklets-4_export.h"
9
+
10
10
  using namespace facebook;
11
11
 
12
12
  namespace worklets {
@@ -46,6 +46,6 @@ class JSISerializer {
46
46
  };
47
47
 
48
48
  // amznmod_react - export symbols for reanimated
49
- std::string KEPLERSCRIPT_EXPORT stringifyJSIValue(jsi::Runtime &rt, const jsi::Value &value);
49
+ std::string REACT_NATIVE_WORKLETS_4_EXPORT stringifyJSIValue(jsi::Runtime &rt, const jsi::Value &value);
50
50
 
51
51
  } // namespace worklets
@@ -1,18 +1,20 @@
1
1
  #pragma once
2
2
 
3
- #include <keplerui-083/keplerscript-export.h>
4
-
5
3
  #include <ReactCommon/CallInvoker.h>
6
4
  #include <jsi/jsi.h>
7
5
 
8
6
  #include <memory>
9
7
 
8
+ // amznmod_react - export symbols for reanimated
9
+ #include "react-native-worklets-4_export.h"
10
+
10
11
  using namespace facebook;
11
12
  using namespace react;
12
13
 
13
14
  namespace worklets {
14
15
 
15
- class KEPLERSCRIPT_EXPORT JSScheduler {
16
+ // amznmod_react - export symbols for reanimated
17
+ class REACT_NATIVE_WORKLETS_4_EXPORT JSScheduler {
16
18
  using Job = std::function<void(jsi::Runtime &rt)>;
17
19
 
18
20
  public:
@@ -17,7 +17,8 @@
17
17
 
18
18
  // amzn_mod - use KPLog for logging on Kepler
19
19
  #ifdef KEPLER
20
- #include <KeplerScript/logger/KPLog.h>
20
+ #include <Kepler/turbomodule/TMLog.h>
21
+ #include <fmt/format.h>
21
22
  #endif // KEPLER
22
23
 
23
24
  namespace worklets {
@@ -40,7 +41,7 @@ class SingleInstanceChecker {
40
41
  __android_log_print(ANDROID_LOG_WARN, "Worklets", "%s", message.c_str());
41
42
  // amzn_mod - add logging on Kepler
42
43
  #elif defined(KEPLER)
43
- volta::react::KPLog.warn("[Worklets] {}", message);
44
+ TMWARN(fmt::format("[Worklets] {}", message));
44
45
  #else
45
46
  std::cerr << "[Worklets] " << message << std::endl;
46
47
  #endif
@@ -1,18 +1,18 @@
1
1
  #pragma once
2
2
 
3
- // amznmod_react - export symbols for reanimated
4
- #include <keplerui-083/keplerscript-export.h>
5
-
6
3
  #include <worklets/Tools/ThreadSafeQueue.h>
7
4
 
8
5
  #include <ReactCommon/CallInvoker.h>
9
6
 
10
7
  #include <atomic>
11
8
 
9
+ // amznmod_react - export symbols for reanimated
10
+ #include "react-native-worklets-4_export.h"
11
+
12
12
  namespace worklets {
13
13
 
14
14
  // amznmod_react - export symbols for reanimated
15
- class KEPLERSCRIPT_EXPORT UIScheduler {
15
+ class REACT_NATIVE_WORKLETS_4_EXPORT UIScheduler {
16
16
  public:
17
17
  virtual void scheduleOnUI(std::function<void()> job);
18
18
  virtual void triggerUI();
@@ -1,8 +1,5 @@
1
1
  #pragma once
2
2
 
3
- // amznmod_react - export symbols for reanimated
4
- #include <keplerui-083/keplerscript-export.h>
5
-
6
3
  #include <worklets/Tools/JSLogger.h>
7
4
 
8
5
  #include <jsi/jsi.h>
@@ -17,7 +14,7 @@ namespace worklets {
17
14
  bool matchVersion(const std::string &version1, const std::string &version2);
18
15
 
19
16
  // amznmod_react - export symbols for reanimated
20
- void KEPLERSCRIPT_EXPORT checkJSVersion(
17
+ void __attribute__((visibility("default"))) checkJSVersion(
21
18
  jsi::Runtime &runtime,
22
19
  jsi::Value &jsVersionValue,
23
20
  const std::shared_ptr<worklets::JSLogger> &jsLogger,
@@ -13,11 +13,6 @@
13
13
  #include <sstream>
14
14
  #endif // OS_LOG_TARGET_HAS_10_15_FEATURES
15
15
 
16
- // amznmod_react - add support for tracing on Vega
17
- #elif defined(KEPLER)
18
-
19
- #include <Volta/trace/Tracing.h>
20
-
21
16
  #elif defined(ANDROID)
22
17
 
23
18
  #include <android/trace.h>
@@ -125,26 +120,6 @@ struct WorkletsSystraceSection {
125
120
  std::string_view name_;
126
121
  };
127
122
 
128
- // amznmod_react - add support for tracing on Vega
129
- #elif defined(KEPLER) and defined(WORKLETS_PROFILING) && not defined(VOLTA_DARWIN)
130
-
131
- struct WorkletsSystraceSection {
132
- public:
133
- template <typename... ConvertsToStringPiece>
134
- explicit WorkletsSystraceSection(
135
- const char *name,
136
- ConvertsToStringPiece &&...args) {
137
- name_ = name;
138
- VOLTA_TRACE_BEGIN_STR(name_.data());
139
- }
140
-
141
- ~WorkletsSystraceSection() {
142
- VOLTA_TRACE_END_STR(name_.data());
143
- }
144
- private:
145
- std::string_view name_;
146
- };
147
-
148
123
  #else
149
124
 
150
125
  struct WorkletsSystraceSection {