@depup/react-native-worklets 0.12.1-depup.0 → 0.13.0-depup.0
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.
- package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.cpp +1 -2
- package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.h +1 -1
- package/Common/cpp/worklets/Compat/StableApi.cpp +24 -8
- package/Common/cpp/worklets/Compat/StableApi.h +1 -1
- package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp +113 -50
- package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.h +10 -1
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +95 -37
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +57 -7
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxyInitializer.cpp +94 -0
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxyInitializer.h +58 -0
- package/Common/cpp/worklets/Networking/Networking.cpp +283 -0
- package/Common/cpp/worklets/Networking/Networking.h +51 -0
- package/Common/cpp/worklets/Networking/NetworkingBackend.h +47 -0
- package/Common/cpp/worklets/Networking/NetworkingInstaller.cpp +127 -0
- package/Common/cpp/worklets/Networking/NetworkingInstaller.h +19 -0
- package/Common/cpp/worklets/Networking/NetworkingTypes.h +33 -0
- package/Common/cpp/worklets/Networking/TextDecoding.cpp +189 -0
- package/Common/cpp/worklets/Networking/TextDecoding.h +29 -0
- package/Common/cpp/worklets/RunLoop/AsyncQueue.h +28 -0
- package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.cpp +9 -0
- package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.h +6 -0
- package/Common/cpp/worklets/RunLoop/EventLoop.cpp +19 -4
- package/Common/cpp/worklets/RunLoop/EventLoop.h +3 -0
- package/Common/cpp/worklets/SharedItems/MemoryManager.cpp +1 -1
- package/Common/cpp/worklets/SharedItems/MemoryManager.h +2 -1
- package/Common/cpp/worklets/SharedItems/Serializable/CustomSerializable.cpp +37 -0
- package/Common/cpp/worklets/SharedItems/Serializable/CustomSerializable.h +33 -0
- package/Common/cpp/worklets/SharedItems/Serializable/RetainingSerializable.h +112 -0
- package/Common/cpp/worklets/SharedItems/Serializable/Serializable.cpp +129 -0
- package/Common/cpp/worklets/SharedItems/Serializable/Serializable.h +121 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableArray.cpp +38 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableArray.h +39 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableArrayBuffer.cpp +35 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableArrayBuffer.h +43 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableBigInt.cpp +23 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableBigInt.h +35 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableError.cpp +38 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableError.h +30 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableHostFunction.cpp +24 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableHostFunction.h +32 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableHostObject.cpp +19 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableHostObject.h +25 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableImport.cpp +29 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableImport.h +25 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableMap.cpp +44 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableMap.h +25 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableObject.cpp +80 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableObject.h +35 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableRegExp.cpp +22 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableRegExp.h +25 -0
- package/Common/cpp/worklets/SharedItems/{SerializableRemoteFunction.cpp → Serializable/SerializableRemoteFunction.cpp} +30 -2
- package/Common/cpp/worklets/SharedItems/{SerializableRemoteFunction.h → Serializable/SerializableRemoteFunction.h} +24 -10
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableScalar.cpp +46 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableScalar.h +41 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableSet.cpp +36 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableSet.h +23 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableString.cpp +19 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableString.h +22 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableTurboModuleLike.cpp +26 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableTurboModuleLike.h +33 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableWorklet.cpp +31 -0
- package/Common/cpp/worklets/SharedItems/Serializable/SerializableWorklet.h +23 -0
- package/Common/cpp/worklets/SharedItems/Serializable.h +21 -409
- package/Common/cpp/worklets/SharedItems/Shareable.cpp +1 -1
- package/Common/cpp/worklets/SharedItems/Shareable.h +1 -1
- package/Common/cpp/worklets/SharedItems/Synchronizable.h +43 -20
- package/Common/cpp/worklets/SharedItems/SynchronizableAccess.cpp +24 -26
- package/Common/cpp/worklets/SharedItems/SynchronizableAccess.h +5 -7
- package/Common/cpp/worklets/SharedItems/SynchronizableDynamic.cpp +36 -0
- package/Common/cpp/worklets/SharedItems/SynchronizableDynamic.h +27 -0
- package/Common/cpp/worklets/SharedItems/SynchronizableFixed.cpp +76 -0
- package/Common/cpp/worklets/SharedItems/SynchronizableFixed.h +48 -0
- package/Common/cpp/worklets/Tools/ScriptBuffer.h +0 -5
- package/Common/cpp/worklets/Tools/WorkletsJSIUtils.h +16 -30
- package/Common/cpp/worklets/WorkletRuntime/RuntimeBindings.h +27 -30
- package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.cpp +4 -3
- package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.h +2 -1
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +79 -29
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +34 -19
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +13 -86
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +1 -7
- package/Package.swift +147 -0
- package/README.md +7 -7
- package/RNWorklets.podspec +1 -2
- package/android/CMakeLists.txt +7 -26
- package/android/build.gradle.kts +5 -31
- package/android/src/main/cpp/worklets/android/WorkletsModule.cpp +46 -129
- package/android/src/main/cpp/worklets/android/WorkletsModule.h +21 -11
- package/android/src/main/cpp/worklets/android/WorkletsOnLoad.cpp +2 -4
- package/android/src/main/cpp/worklets/android/networking/AndroidNetworkingBackend.cpp +82 -0
- package/android/src/main/cpp/worklets/android/networking/AndroidNetworkingBackend.h +32 -0
- package/android/src/main/cpp/worklets/android/networking/JNetworkRequestListener.cpp +73 -0
- package/android/src/main/cpp/worklets/android/networking/JNetworkRequestListener.h +38 -0
- package/android/src/{no-networking → main/java}/com/swmansion/worklets/WorkletsModule.kt +40 -28
- package/android/src/main/java/com/swmansion/worklets/networking/NetworkRequestListener.kt +37 -0
- package/android/src/main/java/com/swmansion/worklets/networking/Networking.kt +244 -0
- package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameQueue.kt +40 -5
- package/apple/worklets/apple/AnimationFrameQueue.mm +9 -1
- package/apple/worklets/apple/AssertJavaScriptQueue.h +3 -2
- package/apple/worklets/apple/AssertTurboModuleManagerQueue.h +4 -0
- package/apple/worklets/apple/IOSUIScheduler.mm +3 -0
- package/apple/worklets/apple/Networking/AppleNetworkingBackend.h +29 -0
- package/apple/worklets/apple/Networking/AppleNetworkingBackend.mm +93 -0
- package/apple/worklets/apple/Networking/WorkletsURLSessionDelegate.h +37 -0
- package/apple/worklets/apple/Networking/WorkletsURLSessionDelegate.mm +447 -0
- package/apple/worklets/apple/WorkletsModule.h +3 -2
- package/apple/worklets/apple/WorkletsModule.mm +82 -74
- package/bundleMode/index.js +10 -47
- package/bundleMode/polyfills/prepareBundleMode.js +16 -0
- package/changes.json +6 -6
- package/compatibility.json +4 -1
- package/lib/module/WorkletsModule/NativeWorklets.native.js +12 -9
- package/lib/module/WorkletsModule/NativeWorklets.native.js.map +1 -1
- package/lib/module/debug/jsVersion.js +1 -1
- package/lib/module/featureFlags/staticFlags.json +0 -1
- package/lib/module/featureFlags/types.js +0 -1
- package/lib/module/featureFlags/types.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/initializers/initializers.native.js +5 -12
- package/lib/module/initializers/initializers.native.js.map +1 -1
- package/lib/module/memory/bundleUnpacker.native.js +2 -10
- package/lib/module/memory/bundleUnpacker.native.js.map +1 -1
- package/lib/module/memory/serializable.native.js +3 -31
- package/lib/module/memory/serializable.native.js.map +1 -1
- package/lib/module/memory/synchronizable.js +1 -1
- package/lib/module/memory/synchronizable.js.map +1 -1
- package/lib/module/memory/synchronizable.native.js +7 -3
- package/lib/module/memory/synchronizable.native.js.map +1 -1
- package/lib/module/memory/synchronizableUnpacker.native.js +22 -9
- package/lib/module/memory/synchronizableUnpacker.native.js.map +1 -1
- package/lib/module/memory/valueUnpacker.native.js +0 -8
- package/lib/module/memory/valueUnpacker.native.js.map +1 -1
- package/lib/module/mock.js +22 -1
- package/lib/module/mock.js.map +1 -1
- package/lib/module/networking/AbortController.js +43 -0
- package/lib/module/networking/AbortController.js.map +1 -0
- package/lib/module/networking/Blob.js +60 -0
- package/lib/module/networking/Blob.js.map +1 -0
- package/lib/module/networking/DOMException.js +35 -0
- package/lib/module/networking/DOMException.js.map +1 -0
- package/lib/module/networking/FileReader.js +83 -0
- package/lib/module/networking/FileReader.js.map +1 -0
- package/lib/module/networking/FormData.js +105 -0
- package/lib/module/networking/FormData.js.map +1 -0
- package/lib/module/networking/XMLHttpRequest.js +450 -0
- package/lib/module/networking/XMLHttpRequest.js.map +1 -0
- package/lib/module/networking/bytes.js +6 -0
- package/lib/module/networking/bytes.js.map +1 -0
- package/lib/module/networking/events.js +44 -0
- package/lib/module/networking/events.js.map +1 -0
- package/lib/module/networking/http.js +100 -0
- package/lib/module/networking/http.js.map +1 -0
- package/lib/module/networking/install.js +37 -0
- package/lib/module/networking/install.js.map +1 -0
- package/lib/module/networking/utf8.js +99 -0
- package/lib/module/networking/utf8.js.map +1 -0
- package/lib/module/privateGlobals.d.js +0 -1
- package/lib/module/privateGlobals.d.js.map +1 -1
- package/lib/module/runLoop/common/queueMicrotaskPolyfill.js +9 -0
- package/lib/module/runLoop/common/queueMicrotaskPolyfill.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js +7 -3
- package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js.map +1 -1
- package/lib/module/runLoop/workletRuntime/index.js +1 -1
- package/lib/module/runLoop/workletRuntime/index.js.map +1 -1
- package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js +1 -1
- package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js.map +1 -1
- package/lib/module/runLoop/workletRuntime/taskQueue.js +0 -13
- package/lib/module/runLoop/workletRuntime/taskQueue.js.map +1 -1
- package/lib/module/runtimes.native.js +8 -1
- package/lib/module/runtimes.native.js.map +1 -1
- package/lib/module/specs/NativeWorkletsModule.js.map +1 -1
- package/lib/module/threads.js +11 -0
- package/lib/module/threads.js.map +1 -1
- package/lib/module/threads.native.js +35 -42
- package/lib/module/threads.native.js.map +1 -1
- package/lib/typescript/WorkletsModule/NativeWorklets.native.d.ts.map +1 -1
- package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts +6 -5
- package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts.map +1 -1
- package/lib/typescript/debug/jsVersion.d.ts +1 -1
- package/lib/typescript/featureFlags/types.d.ts +0 -1
- package/lib/typescript/featureFlags/types.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/memory/bundleUnpacker.native.d.ts.map +1 -1
- package/lib/typescript/memory/serializable.native.d.ts.map +1 -1
- package/lib/typescript/memory/synchronizable.d.ts +6 -2
- package/lib/typescript/memory/synchronizable.d.ts.map +1 -1
- package/lib/typescript/memory/synchronizable.native.d.ts +6 -2
- package/lib/typescript/memory/synchronizable.native.d.ts.map +1 -1
- package/lib/typescript/memory/synchronizableUnpacker.native.d.ts +1 -1
- package/lib/typescript/memory/synchronizableUnpacker.native.d.ts.map +1 -1
- package/lib/typescript/memory/types.d.ts +6 -0
- package/lib/typescript/memory/types.d.ts.map +1 -1
- package/lib/typescript/memory/valueUnpacker.native.d.ts.map +1 -1
- package/lib/typescript/networking/AbortController.d.ts +16 -0
- package/lib/typescript/networking/AbortController.d.ts.map +1 -0
- package/lib/typescript/networking/Blob.d.ts +16 -0
- package/lib/typescript/networking/Blob.d.ts.map +1 -0
- package/lib/typescript/networking/DOMException.d.ts +5 -0
- package/lib/typescript/networking/DOMException.d.ts.map +1 -0
- package/lib/typescript/networking/FileReader.d.ts +19 -0
- package/lib/typescript/networking/FileReader.d.ts.map +1 -0
- package/lib/typescript/networking/FormData.d.ts +30 -0
- package/lib/typescript/networking/FormData.d.ts.map +1 -0
- package/lib/typescript/networking/XMLHttpRequest.d.ts +77 -0
- package/lib/typescript/networking/XMLHttpRequest.d.ts.map +1 -0
- package/lib/typescript/networking/bytes.d.ts +2 -0
- package/lib/typescript/networking/bytes.d.ts.map +1 -0
- package/lib/typescript/networking/events.d.ts +18 -0
- package/lib/typescript/networking/events.d.ts.map +1 -0
- package/lib/typescript/networking/http.d.ts +14 -0
- package/lib/typescript/networking/http.d.ts.map +1 -0
- package/lib/typescript/networking/install.d.ts +2 -0
- package/lib/typescript/networking/install.d.ts.map +1 -0
- package/lib/typescript/networking/utf8.d.ts +4 -0
- package/lib/typescript/networking/utf8.d.ts.map +1 -0
- package/lib/typescript/runLoop/{workletRuntime/queueMicrotask.d.ts → common/queueMicrotaskPolyfill.d.ts} +1 -1
- package/lib/typescript/runLoop/common/queueMicrotaskPolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts.map +1 -1
- package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts +0 -2
- package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts.map +1 -1
- package/lib/typescript/runtimes.native.d.ts.map +1 -1
- package/lib/typescript/specs/NativeWorkletsModule.d.ts +1 -0
- package/lib/typescript/specs/NativeWorkletsModule.d.ts.map +1 -1
- package/lib/typescript/threads.d.ts +8 -0
- package/lib/typescript/threads.d.ts.map +1 -1
- package/lib/typescript/threads.native.d.ts +8 -1
- package/lib/typescript/threads.native.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +9 -5
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +36 -22
- package/plugin/index.js +63 -93
- package/plugin-oxc/babel.d.ts +7 -0
- package/plugin-oxc/babel.js +200 -0
- package/plugin-oxc/index.d.ts +33 -0
- package/plugin-oxc/index.js +36 -0
- package/plugin-oxc/worklets-oxc-plugin.darwin-arm64.node +0 -0
- package/plugin-oxc/worklets-oxc-plugin.darwin-x64.node +0 -0
- package/plugin-oxc/worklets-oxc-plugin.linux-arm64.node +0 -0
- package/plugin-oxc/worklets-oxc-plugin.linux-x64.node +0 -0
- package/plugin-oxc/worklets-oxc-plugin.win32-arm64.node +0 -0
- package/plugin-oxc/worklets-oxc-plugin.win32-x64.node +0 -0
- package/react-native.config.js +5 -0
- package/scripts/worklets_utils.rb +0 -10
- package/src/WorkletsModule/NativeWorklets.native.ts +26 -9
- package/src/WorkletsModule/workletsModuleProxy.ts +15 -5
- package/src/debug/jsVersion.ts +1 -1
- package/src/featureFlags/staticFlags.json +0 -1
- package/src/featureFlags/types.ts +0 -1
- package/src/index.ts +3 -0
- package/src/initializers/initializers.native.ts +5 -13
- package/src/memory/bundleUnpacker.native.ts +6 -13
- package/src/memory/serializable.native.ts +6 -46
- package/src/memory/synchronizable.native.ts +38 -4
- package/src/memory/synchronizable.ts +22 -2
- package/src/memory/synchronizableUnpacker.native.ts +38 -13
- package/src/memory/types.ts +9 -0
- package/src/memory/valueUnpacker.native.ts +0 -8
- package/src/mock.ts +28 -1
- package/src/networking/AbortController.ts +57 -0
- package/src/networking/Blob.ts +74 -0
- package/src/networking/DOMException.ts +37 -0
- package/src/networking/FileReader.ts +99 -0
- package/src/networking/FormData.ts +135 -0
- package/src/networking/XMLHttpRequest.ts +557 -0
- package/src/networking/bytes.ts +8 -0
- package/src/networking/events.ts +61 -0
- package/src/networking/http.ts +173 -0
- package/src/networking/install.ts +38 -0
- package/src/networking/utf8.ts +122 -0
- package/src/privateGlobals.d.ts +20 -13
- package/src/runLoop/common/queueMicrotaskPolyfill.ts +12 -0
- package/src/runLoop/uiRuntime/requestAnimationFrame.ts +7 -4
- package/src/runLoop/workletRuntime/index.ts +1 -1
- package/src/runLoop/workletRuntime/requestAnimationFramePolyfill.ts +1 -1
- package/src/runLoop/workletRuntime/taskQueue.ts +0 -15
- package/src/runtimes.native.ts +10 -1
- package/src/specs/NativeWorkletsModule.ts +1 -0
- package/src/threads.native.ts +49 -54
- package/src/threads.ts +11 -0
- package/src/types.ts +9 -5
- package/Common/cpp/worklets/SharedItems/Serializable.cpp +0 -373
- package/Common/cpp/worklets/SharedItems/SerializableFactory.cpp +0 -172
- package/Common/cpp/worklets/SharedItems/SerializableFactory.h +0 -85
- package/Common/cpp/worklets/SharedItems/Synchronizable.cpp +0 -59
- package/android/src/main/cpp/worklets/android/JWorkletRuntimeWrapper.cpp +0 -51
- package/android/src/main/cpp/worklets/android/JWorkletRuntimeWrapper.h +0 -43
- package/android/src/networking/com/swmansion/worklets/WorkletRuntimeWrapper.kt +0 -27
- package/android/src/networking/com/swmansion/worklets/WorkletsHeaderUtil.kt +0 -30
- package/android/src/networking/com/swmansion/worklets/WorkletsModule.kt +0 -203
- package/android/src/networking/com/swmansion/worklets/WorkletsNetworkEventUtil.kt +0 -272
- package/android/src/networking/com/swmansion/worklets/WorkletsNetworking.kt +0 -1124
- package/android/src/networking/com/swmansion/worklets/WorkletsOkHttpCallUtil.kt +0 -40
- package/android/src/networking/com/swmansion/worklets/WorkletsProgressListener.kt +0 -13
- package/android/src/networking/com/swmansion/worklets/WorkletsProgressRequestBody.kt +0 -98
- package/android/src/networking/com/swmansion/worklets/WorkletsProgressResponseBody.kt +0 -60
- package/android/src/networking/com/swmansion/worklets/WorkletsProgressiveStringDecoder.kt +0 -87
- package/android/src/networking/com/swmansion/worklets/WorkletsRequestBodyUtil.kt +0 -181
- package/apple/worklets/apple/Networking/WorkletsNetworking.h +0 -25
- package/apple/worklets/apple/Networking/WorkletsNetworking.mm +0 -707
- package/bundleMode/shims/turboModuleRegistryShim.js +0 -47
- package/lib/module/bundleMode/network.native.js +0 -44
- package/lib/module/bundleMode/network.native.js.map +0 -1
- package/lib/module/runLoop/workletRuntime/queueMicrotask.js +0 -11
- package/lib/module/runLoop/workletRuntime/queueMicrotask.js.map +0 -1
- package/lib/typescript/bundleMode/network.native.d.ts +0 -7
- package/lib/typescript/bundleMode/network.native.d.ts.map +0 -1
- package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts.map +0 -1
- package/src/bundleMode/network.native.ts +0 -63
- package/src/runLoop/workletRuntime/queueMicrotask.ts +0 -13
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#include <worklets/SharedItems/SynchronizableAccess.h>
|
|
2
2
|
|
|
3
3
|
#include <mutex>
|
|
4
|
+
#include <thread>
|
|
4
5
|
|
|
5
6
|
namespace worklets {
|
|
6
7
|
void SynchronizableAccess::getBlockingBefore() {
|
|
7
8
|
std::unique_lock<std::mutex> lock(accessLock_);
|
|
8
9
|
queue_.wait(lock, [this]() {
|
|
9
|
-
return !blockingWriter_
|
|
10
|
+
return !blockingWriter_ && dirtyWriters_ == 0 &&
|
|
11
|
+
(!imperativelyLocked_ || imperativeOwner_ == std::this_thread::get_id());
|
|
10
12
|
});
|
|
11
13
|
blockingReaders_++;
|
|
12
14
|
}
|
|
@@ -19,32 +21,28 @@ void SynchronizableAccess::getBlockingAfter() {
|
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// dirtyWriters_++;
|
|
31
|
-
// }
|
|
24
|
+
void SynchronizableAccess::setDirtyBefore() {
|
|
25
|
+
std::unique_lock<std::mutex> lock(accessLock_);
|
|
26
|
+
queue_.wait(lock, [this]() {
|
|
27
|
+
return !blockingWriter_ && blockingReaders_ == 0 &&
|
|
28
|
+
(!imperativelyLocked_ || imperativeOwner_ == std::this_thread::get_id());
|
|
29
|
+
});
|
|
30
|
+
dirtyWriters_++;
|
|
31
|
+
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// }
|
|
41
|
-
// }
|
|
33
|
+
void SynchronizableAccess::setDirtyAfter() {
|
|
34
|
+
std::unique_lock<std::mutex> lock(accessLock_);
|
|
35
|
+
dirtyWriters_--;
|
|
36
|
+
if (dirtyWriters_ == 0) {
|
|
37
|
+
queue_.notify_all();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
42
40
|
|
|
43
41
|
void SynchronizableAccess::setBlockingBefore() {
|
|
44
42
|
std::unique_lock<std::mutex> lock(accessLock_);
|
|
45
43
|
queue_.wait(lock, [this]() {
|
|
46
|
-
return !blockingWriter_ && blockingReaders_ == 0
|
|
47
|
-
(!imperativelyLocked_ || imperativeOwner_ ==
|
|
44
|
+
return !blockingWriter_ && blockingReaders_ == 0 && dirtyWriters_ == 0 &&
|
|
45
|
+
(!imperativelyLocked_ || imperativeOwner_ == std::this_thread::get_id());
|
|
48
46
|
});
|
|
49
47
|
blockingWriter_ = true;
|
|
50
48
|
}
|
|
@@ -58,16 +56,16 @@ void SynchronizableAccess::setBlockingAfter() {
|
|
|
58
56
|
void SynchronizableAccess::lock() {
|
|
59
57
|
std::unique_lock<std::mutex> lock(accessLock_);
|
|
60
58
|
queue_.wait(lock, [this]() {
|
|
61
|
-
return !blockingWriter_ && blockingReaders_ == 0
|
|
62
|
-
(!imperativelyLocked_ || imperativeOwner_ ==
|
|
59
|
+
return !blockingWriter_ && blockingReaders_ == 0 && dirtyWriters_ == 0 &&
|
|
60
|
+
(!imperativelyLocked_ || imperativeOwner_ == std::this_thread::get_id());
|
|
63
61
|
});
|
|
64
62
|
imperativelyLocked_ = true;
|
|
65
|
-
imperativeOwner_ =
|
|
63
|
+
imperativeOwner_ = std::this_thread::get_id();
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
void SynchronizableAccess::unlock() {
|
|
69
67
|
std::unique_lock<std::mutex> lock(accessLock_);
|
|
70
|
-
if (imperativeOwner_ !=
|
|
68
|
+
if (imperativeOwner_ != std::this_thread::get_id()) {
|
|
71
69
|
return;
|
|
72
70
|
}
|
|
73
71
|
imperativelyLocked_ = false;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
#include <condition_variable>
|
|
4
4
|
#include <mutex>
|
|
5
|
+
#include <thread>
|
|
5
6
|
|
|
6
7
|
namespace worklets {
|
|
7
8
|
|
|
@@ -23,22 +24,19 @@ class SynchronizableAccess {
|
|
|
23
24
|
void getBlockingBefore();
|
|
24
25
|
void getBlockingAfter();
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// void setDirtyBefore();
|
|
29
|
-
// void setDirtyAfter();
|
|
27
|
+
void setDirtyBefore();
|
|
28
|
+
void setDirtyAfter();
|
|
30
29
|
|
|
31
30
|
void setBlockingBefore();
|
|
32
31
|
void setBlockingAfter();
|
|
33
32
|
|
|
34
33
|
private:
|
|
35
34
|
int blockingReaders_{0};
|
|
36
|
-
|
|
35
|
+
int dirtyWriters_{0};
|
|
37
36
|
bool blockingWriter_{false};
|
|
38
37
|
bool imperativelyLocked_{false};
|
|
39
|
-
|
|
38
|
+
std::thread::id imperativeOwner_{};
|
|
40
39
|
std::mutex accessLock_;
|
|
41
|
-
std::recursive_mutex imperativeLock_;
|
|
42
40
|
std::condition_variable queue_;
|
|
43
41
|
};
|
|
44
42
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#include <worklets/SharedItems/SynchronizableDynamic.h>
|
|
2
|
+
|
|
3
|
+
#include <atomic>
|
|
4
|
+
#include <memory>
|
|
5
|
+
#include <stdexcept>
|
|
6
|
+
|
|
7
|
+
namespace worklets {
|
|
8
|
+
|
|
9
|
+
SynchronizableValue SynchronizableDynamic::getDirty() {
|
|
10
|
+
return std::atomic_load(&value_);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
SynchronizableValue SynchronizableDynamic::getBlocking() {
|
|
14
|
+
getBlockingBefore();
|
|
15
|
+
auto value = std::atomic_load(&value_);
|
|
16
|
+
getBlockingAfter();
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
void SynchronizableDynamic::setDirty(const SynchronizableFixedValue &) {
|
|
21
|
+
throw std::runtime_error(
|
|
22
|
+
"[Worklets] Cannot invoke setDirty on a dynamic-type Synchronizable. "
|
|
23
|
+
"Use setBlocking with a Serializable value instead.");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
void SynchronizableDynamic::setBlocking(const std::shared_ptr<Serializable> &value) {
|
|
27
|
+
setBlockingBefore();
|
|
28
|
+
std::atomic_store(&value_, value);
|
|
29
|
+
setBlockingAfter();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
void SynchronizableDynamic::setBlocking(const SynchronizableFixedValue &) {
|
|
33
|
+
throw std::runtime_error("[Worklets] Dynamic-type Synchronizable operates on Serializables, not plain values.");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
} // namespace worklets
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <worklets/SharedItems/Synchronizable.h>
|
|
4
|
+
|
|
5
|
+
#include <memory>
|
|
6
|
+
|
|
7
|
+
namespace worklets {
|
|
8
|
+
|
|
9
|
+
class SynchronizableDynamic final : public Synchronizable {
|
|
10
|
+
public:
|
|
11
|
+
explicit SynchronizableDynamic(const std::shared_ptr<Serializable> &value) : Synchronizable(false), value_(value) {}
|
|
12
|
+
|
|
13
|
+
SynchronizableValue getDirty() override;
|
|
14
|
+
|
|
15
|
+
SynchronizableValue getBlocking() override;
|
|
16
|
+
|
|
17
|
+
void setDirty(const SynchronizableFixedValue &value) override;
|
|
18
|
+
|
|
19
|
+
void setBlocking(const std::shared_ptr<Serializable> &value) override;
|
|
20
|
+
|
|
21
|
+
void setBlocking(const SynchronizableFixedValue &value) override;
|
|
22
|
+
|
|
23
|
+
private:
|
|
24
|
+
std::shared_ptr<Serializable> value_;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
} // namespace worklets
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#include <worklets/SharedItems/SynchronizableFixed.h>
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <stdexcept>
|
|
5
|
+
#include <type_traits>
|
|
6
|
+
#include <variant>
|
|
7
|
+
|
|
8
|
+
namespace worklets {
|
|
9
|
+
|
|
10
|
+
std::shared_ptr<SynchronizableFixed> SynchronizableFixed::make(const SynchronizableFixedValue &initialValue) {
|
|
11
|
+
return std::visit(
|
|
12
|
+
[](const auto &alternative) { return std::make_shared<SynchronizableFixed>(alternative); }, initialValue);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
SynchronizableValue SynchronizableFixed::getDirty() {
|
|
16
|
+
return load();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
SynchronizableValue SynchronizableFixed::getBlocking() {
|
|
20
|
+
getBlockingBefore();
|
|
21
|
+
auto value = load();
|
|
22
|
+
getBlockingAfter();
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
void SynchronizableFixed::setDirty(const SynchronizableFixedValue &value) {
|
|
27
|
+
setDirtyBefore();
|
|
28
|
+
const auto stored = store(value);
|
|
29
|
+
setDirtyAfter();
|
|
30
|
+
if (!stored) {
|
|
31
|
+
throwTypeMismatch();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
void SynchronizableFixed::setBlocking(const std::shared_ptr<Serializable> &) {
|
|
36
|
+
throw std::runtime_error("[Worklets] Fixed-type Synchronizable operates on plain values, not Serializables.");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void SynchronizableFixed::setBlocking(const SynchronizableFixedValue &value) {
|
|
40
|
+
setBlockingBefore();
|
|
41
|
+
const auto stored = store(value);
|
|
42
|
+
setBlockingAfter();
|
|
43
|
+
if (!stored) {
|
|
44
|
+
throwTypeMismatch();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
bool SynchronizableFixed::store(const SynchronizableFixedValue &value) {
|
|
49
|
+
return std::visit(
|
|
50
|
+
[](auto &atomic, const auto &alternative) {
|
|
51
|
+
using TAtomic = std::decay_t<decltype(atomic)>;
|
|
52
|
+
using TAlternative = std::decay_t<decltype(alternative)>;
|
|
53
|
+
if constexpr (std::is_same_v<TAtomic, std::atomic<TAlternative>>) {
|
|
54
|
+
atomic.store(alternative, std::memory_order_relaxed);
|
|
55
|
+
return true;
|
|
56
|
+
} else {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
value_,
|
|
61
|
+
value);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
SynchronizableValue SynchronizableFixed::load() const {
|
|
65
|
+
return std::visit(
|
|
66
|
+
[](const auto &atomic) { return SynchronizableValue(atomic.load(std::memory_order_relaxed)); }, value_);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
void SynchronizableFixed::throwTypeMismatch() const {
|
|
70
|
+
throw std::runtime_error(
|
|
71
|
+
std::holds_alternative<std::atomic<double>>(value_)
|
|
72
|
+
? "[Worklets] Expected a number for a fixed-type Synchronizable."
|
|
73
|
+
: "[Worklets] Expected a boolean for a fixed-type Synchronizable.");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
} // namespace worklets
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <worklets/SharedItems/Synchronizable.h>
|
|
4
|
+
|
|
5
|
+
#include <atomic>
|
|
6
|
+
#include <memory>
|
|
7
|
+
#include <type_traits>
|
|
8
|
+
#include <variant>
|
|
9
|
+
|
|
10
|
+
namespace worklets {
|
|
11
|
+
|
|
12
|
+
class SynchronizableFixed final : public Synchronizable {
|
|
13
|
+
public:
|
|
14
|
+
explicit SynchronizableFixed(double value)
|
|
15
|
+
: Synchronizable(true), value_(std::in_place_type<std::atomic<double>>, value) {}
|
|
16
|
+
|
|
17
|
+
explicit SynchronizableFixed(bool value)
|
|
18
|
+
: Synchronizable(true), value_(std::in_place_type<std::atomic<bool>>, value) {}
|
|
19
|
+
|
|
20
|
+
template <
|
|
21
|
+
typename TInteger,
|
|
22
|
+
typename = std::enable_if_t<std::is_integral_v<TInteger> && !std::is_same_v<TInteger, bool>>>
|
|
23
|
+
explicit SynchronizableFixed(TInteger value) = delete;
|
|
24
|
+
|
|
25
|
+
static std::shared_ptr<SynchronizableFixed> make(const SynchronizableFixedValue &initialValue);
|
|
26
|
+
|
|
27
|
+
SynchronizableValue getDirty() override;
|
|
28
|
+
|
|
29
|
+
SynchronizableValue getBlocking() override;
|
|
30
|
+
|
|
31
|
+
void setDirty(const SynchronizableFixedValue &value) override;
|
|
32
|
+
|
|
33
|
+
void setBlocking(const std::shared_ptr<Serializable> &value) override;
|
|
34
|
+
|
|
35
|
+
void setBlocking(const SynchronizableFixedValue &value) override;
|
|
36
|
+
|
|
37
|
+
private:
|
|
38
|
+
bool store(const SynchronizableFixedValue &value);
|
|
39
|
+
SynchronizableValue load() const;
|
|
40
|
+
[[noreturn]] void throwTypeMismatch() const;
|
|
41
|
+
|
|
42
|
+
std::variant<std::atomic<double>, std::atomic<bool>> value_;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
static_assert(std::atomic<double>::is_always_lock_free);
|
|
46
|
+
static_assert(std::atomic<bool>::is_always_lock_free);
|
|
47
|
+
|
|
48
|
+
} // namespace worklets
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <cxxreact/ReactNativeVersion.h>
|
|
4
3
|
#include <jsi/jsi.h>
|
|
5
4
|
|
|
6
|
-
#if REACT_NATIVE_VERSION_MINOR >= 84
|
|
7
5
|
#include <cxxreact/JSBigString.h>
|
|
8
|
-
#else
|
|
9
|
-
#include <jsireact/JSIExecutor.h>
|
|
10
|
-
#endif
|
|
11
6
|
|
|
12
7
|
#include <memory>
|
|
13
8
|
#include <utility>
|
|
@@ -11,29 +11,6 @@ using namespace facebook;
|
|
|
11
11
|
|
|
12
12
|
namespace worklets::jsi_utils {
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Drains Hermes microtasks - we don't use these, but Hermes WeakRefs are
|
|
16
|
-
* cleaned during Hermes microtask checkpoint.
|
|
17
|
-
*/
|
|
18
|
-
inline void triggerWeakRefCleanup(jsi::Runtime &rt) {
|
|
19
|
-
rt.drainMicrotasks();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Drains both Worklets and Hermes microtasks.
|
|
24
|
-
*/
|
|
25
|
-
inline void drainMicrotasks(jsi::Runtime &rt) {
|
|
26
|
-
auto callMicrotasks = rt.global().getProperty(rt, "__callMicrotasks");
|
|
27
|
-
if (callMicrotasks.isObject()) {
|
|
28
|
-
auto callMicrotasksObject = callMicrotasks.getObject(rt);
|
|
29
|
-
if (callMicrotasksObject.isFunction(rt)) {
|
|
30
|
-
callMicrotasksObject.getFunction(rt).call(rt);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
triggerWeakRefCleanup(rt);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
14
|
// `get` functions take a pointer to `jsi::Value` and
|
|
38
15
|
// call an appropriate method to cast to the native type
|
|
39
16
|
template <typename T>
|
|
@@ -207,16 +184,25 @@ void addMethod(jsi::Runtime &rt, jsi::Object &obj, const char *name, TFun &&func
|
|
|
207
184
|
jsi::PropNameID::forAscii(rt, name),
|
|
208
185
|
TLength,
|
|
209
186
|
[func = std::forward<TFun>(func)](
|
|
210
|
-
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t) mutable -> jsi::Value {
|
|
187
|
+
jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) mutable -> jsi::Value {
|
|
211
188
|
using TReturn =
|
|
212
189
|
std::invoke_result_t<TFun &, jsi::Runtime &, const jsi::Value &, const jsi::Value(&)[TLength]>;
|
|
213
|
-
auto
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
190
|
+
auto invoke = [&](const jsi::Value(&typed)[TLength]) -> jsi::Value {
|
|
191
|
+
if constexpr (std::is_void_v<TReturn>) {
|
|
192
|
+
func(rt, thisVal, typed);
|
|
193
|
+
return jsi::Value::undefined();
|
|
194
|
+
} else {
|
|
195
|
+
return func(rt, thisVal, typed);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
if (count < TLength) {
|
|
199
|
+
jsi::Value padded[TLength];
|
|
200
|
+
for (size_t i = 0; i < count; ++i) {
|
|
201
|
+
padded[i] = jsi::Value(rt, args[i]);
|
|
202
|
+
}
|
|
203
|
+
return invoke(padded);
|
|
219
204
|
}
|
|
205
|
+
return invoke(*reinterpret_cast<const jsi::Value(*)[TLength]>(args));
|
|
220
206
|
}));
|
|
221
207
|
}
|
|
222
208
|
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <jsi/jsi.h>
|
|
4
|
+
#include <worklets/Networking/NetworkingBackend.h>
|
|
4
5
|
|
|
5
6
|
#include <functional>
|
|
7
|
+
#include <memory>
|
|
6
8
|
#include <stdexcept>
|
|
9
|
+
#include <string>
|
|
10
|
+
|
|
11
|
+
#if defined(__APPLE__) && defined(__OBJC__)
|
|
12
|
+
#import <React/RCTLog.h>
|
|
13
|
+
#elif defined(ANDROID)
|
|
14
|
+
#include <android/log.h>
|
|
15
|
+
#endif
|
|
7
16
|
|
|
8
17
|
using namespace facebook;
|
|
9
18
|
|
|
@@ -22,38 +31,26 @@ struct RuntimeBindings {
|
|
|
22
31
|
|
|
23
32
|
const RequestAnimationFrame requestAnimationFrame;
|
|
24
33
|
const NativeLoggingHook nativeLoggingHook;
|
|
25
|
-
|
|
26
|
-
#ifdef WORKLETS_FETCH_PREVIEW_ENABLED
|
|
27
|
-
using AbortRequest = std::function<void(jsi::Runtime &rt, double requestId)>;
|
|
28
|
-
using ClearCookies = std::function<void(jsi::Runtime &rt, jsi::Function &&responseSender)>;
|
|
29
|
-
#ifdef ANDROID
|
|
30
|
-
using SendRequest = std::function<void(
|
|
31
|
-
jsi::Runtime &rt,
|
|
32
|
-
jsi::String &method,
|
|
33
|
-
jsi::String &url,
|
|
34
|
-
double requestId,
|
|
35
|
-
jsi::Array &headers,
|
|
36
|
-
jsi::Object &data,
|
|
37
|
-
jsi::String &responseType,
|
|
38
|
-
bool incrementalUpdates,
|
|
39
|
-
double timeout,
|
|
40
|
-
bool withCredentials)>;
|
|
41
|
-
#else
|
|
42
|
-
using SendRequest = std::function<void(jsi::Runtime &rt, const jsi::Value &query, jsi::Function &&responseSender)>;
|
|
43
|
-
#endif // ANDROID
|
|
44
|
-
|
|
45
|
-
const AbortRequest abortRequest;
|
|
46
|
-
const ClearCookies clearCookies;
|
|
47
|
-
const SendRequest sendRequest;
|
|
48
|
-
#endif // WORKLETS_FETCH_PREVIEW_ENABLED
|
|
34
|
+
const std::shared_ptr<NetworkingBackend> networkingBackend;
|
|
49
35
|
};
|
|
50
36
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
37
|
+
#if defined(ANDROID) || (defined(__APPLE__) && defined(__OBJC__))
|
|
38
|
+
inline RuntimeBindings::NativeLoggingHook makeNativeLoggingHook() {
|
|
39
|
+
return [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
40
|
+
if (count != 2) {
|
|
41
|
+
throw std::invalid_argument("nativeLoggingHook takes 2 arguments");
|
|
42
|
+
}
|
|
43
|
+
const auto message = args[0].asString(rt).utf8(rt);
|
|
44
|
+
const auto logLevel = static_cast<unsigned int>(args[1].asNumber());
|
|
45
|
+
#if defined(__APPLE__)
|
|
46
|
+
_RCTLogJavaScriptInternal(static_cast<RCTLogLevel>(logLevel), [NSString stringWithUTF8String:message.c_str()]);
|
|
47
|
+
#else
|
|
48
|
+
__android_log_write(
|
|
49
|
+
static_cast<android_LogPriority>(logLevel + ANDROID_LOG_DEBUG), "ReactNativeJS", message.c_str());
|
|
50
|
+
#endif
|
|
51
|
+
return jsi::Value::undefined();
|
|
52
|
+
};
|
|
57
53
|
}
|
|
54
|
+
#endif // defined(ANDROID) || (defined(__APPLE__) && defined(__OBJC__))
|
|
58
55
|
|
|
59
56
|
} // namespace worklets
|
|
@@ -56,11 +56,12 @@ std::shared_ptr<WorkletRuntime> RuntimeManager::createWorkletRuntime(
|
|
|
56
56
|
const std::shared_ptr<SerializableWorklet> &initializer,
|
|
57
57
|
const std::shared_ptr<AsyncQueue> &queue,
|
|
58
58
|
bool enableEventLoop,
|
|
59
|
-
bool enableLocking
|
|
59
|
+
bool enableLocking,
|
|
60
|
+
bool enableNetworking) {
|
|
60
61
|
const auto runtimeId = getNextRuntimeId();
|
|
61
62
|
|
|
62
63
|
const auto workletRuntime = std::make_shared<WorkletRuntime>(
|
|
63
|
-
runtimeId, RuntimeData::RuntimeKind::Worker, name, queue, enableEventLoop, enableLocking);
|
|
64
|
+
runtimeId, RuntimeData::RuntimeKind::Worker, name, queue, enableEventLoop, enableLocking, enableNetworking);
|
|
64
65
|
const auto targetProxy = JSIWorkletsModuleProxy::createForNewRuntime(sourceProxy, runtimeId);
|
|
65
66
|
|
|
66
67
|
workletRuntime->init(targetProxy);
|
|
@@ -70,7 +71,7 @@ std::shared_ptr<WorkletRuntime> RuntimeManager::createWorkletRuntime(
|
|
|
70
71
|
#endif // NDEBUG
|
|
71
72
|
|
|
72
73
|
if (initializer) {
|
|
73
|
-
workletRuntime->
|
|
74
|
+
workletRuntime->runSyncAndDiscard(initializer);
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
registerRuntime(runtimeId, workletRuntime);
|
|
@@ -36,7 +36,8 @@ class RuntimeManager {
|
|
|
36
36
|
const std::shared_ptr<SerializableWorklet> &initializer = nullptr,
|
|
37
37
|
const std::shared_ptr<AsyncQueue> &queue = nullptr,
|
|
38
38
|
bool enableEventLoop = true,
|
|
39
|
-
bool enableLocking = true
|
|
39
|
+
bool enableLocking = true,
|
|
40
|
+
bool enableNetworking = true);
|
|
40
41
|
|
|
41
42
|
std::shared_ptr<WorkletRuntime> createUninitializedUIRuntime(const std::shared_ptr<AsyncQueue> &uiAsyncQueue);
|
|
42
43
|
|