-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathWorkletsModuleProxy.h
More file actions
79 lines (65 loc) · 2.6 KB
/
Copy pathWorkletsModuleProxy.h
File metadata and controls
79 lines (65 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#include <cxxreact/MessageQueueThread.h>
#include <jsi/jsi.h>
#include <jsireact/JSIExecutor.h>
#include <worklets/AnimationFrameQueue/AnimationFrameBatchinator.h>
#include <worklets/NativeModules/JSIWorkletsModuleProxy.h>
#include <worklets/SharedItems/MemoryManager.h>
#include <worklets/Tools/Defs.h>
#include <worklets/Tools/JSLogger.h>
#include <worklets/Tools/JSScheduler.h>
#include <worklets/Tools/ScriptBuffer.h>
#include <worklets/Tools/SingleInstanceChecker.h>
#include <worklets/Tools/UIScheduler.h>
#include <worklets/WorkletRuntime/BundleModeConfig.h>
#include <worklets/WorkletRuntime/RuntimeManager.h>
#include <worklets/WorkletRuntime/WorkletRuntime.h>
#include <memory>
namespace worklets {
class WorkletsModuleProxy : public std::enable_shared_from_this<WorkletsModuleProxy> {
public:
explicit WorkletsModuleProxy(
jsi::Runtime &rnRuntime,
const std::shared_ptr<MessageQueueThread> &jsQueue,
const std::shared_ptr<CallInvoker> &jsCallInvoker,
const std::shared_ptr<UIScheduler> &uiScheduler,
std::function<bool()> &&isJavaScriptQueue,
const std::shared_ptr<RuntimeBindings> &runtimeBindings,
const BundleModeConfig &bundleModeConfig);
~WorkletsModuleProxy();
[[nodiscard]] inline std::shared_ptr<MessageQueueThread> getJSQueue() const {
return jsQueue_;
}
[[nodiscard]] inline std::shared_ptr<JSScheduler> getJSScheduler() const {
return jsScheduler_;
}
[[nodiscard]] inline std::shared_ptr<UIScheduler> getUIScheduler() const {
return uiScheduler_;
}
[[nodiscard]] inline std::shared_ptr<JSLogger> getJSLogger() const {
return jsLogger_;
}
[[nodiscard]] inline std::shared_ptr<WorkletRuntime> getUIWorkletRuntime() const {
return uiWorkletRuntime_;
}
[[nodiscard]] std::shared_ptr<JSIWorkletsModuleProxy> createJSIWorkletsModuleProxy() const;
[[nodiscard]] inline bool isDevBundle() const {
return isDevBundle_;
}
private:
const bool isDevBundle_;
const std::shared_ptr<MessageQueueThread> jsQueue_;
const std::shared_ptr<JSScheduler> jsScheduler_;
const std::shared_ptr<UIScheduler> uiScheduler_;
const std::shared_ptr<JSLogger> jsLogger_;
const std::shared_ptr<RuntimeBindings> runtimeBindings_;
const BundleModeConfig bundleModeConfig_;
const std::shared_ptr<MemoryManager> memoryManager_;
const std::shared_ptr<RuntimeManager> runtimeManager_;
std::shared_ptr<WorkletRuntime> uiWorkletRuntime_;
std::shared_ptr<AnimationFrameBatchinator> animationFrameBatchinator_;
#ifndef NDEBUG
SingleInstanceChecker<WorkletsModuleProxy> singleInstanceChecker_;
#endif // NDEBUG
};
} // namespace worklets