10
10
#include < ReactCommon/RuntimeExecutor.h>
11
11
#include < react/performance/timeline/PerformanceEntryReporter.h>
12
12
#include < react/renderer/consistency/ShadowTreeRevisionConsistencyManager.h>
13
- #include < react/renderer/runtimescheduler/RuntimeSchedulerClock.h>
14
13
#include < react/renderer/runtimescheduler/SchedulerPriorityUtils.h>
15
14
#include < react/renderer/runtimescheduler/Task.h>
15
+ #include < react/timing/primitives.h>
16
16
#include " RuntimeSchedulerEventTimingDelegate.h"
17
17
18
18
namespace facebook ::react {
19
19
20
20
using RuntimeSchedulerRenderingUpdate = std::function<void ()>;
21
- using RuntimeSchedulerTimeout = std::chrono::milliseconds;
22
21
using SurfaceId = int32_t ;
23
22
24
23
using RuntimeSchedulerTaskErrorHandler =
@@ -41,16 +40,16 @@ class RuntimeSchedulerBase {
41
40
RawCallback&& callback) noexcept = 0;
42
41
virtual std::shared_ptr<Task> scheduleIdleTask (
43
42
jsi::Function&& callback,
44
- RuntimeSchedulerTimeout timeout = timeoutForSchedulerPriority(
43
+ HighResDuration timeout = timeoutForSchedulerPriority(
45
44
SchedulerPriority::IdlePriority)) noexcept = 0;
46
45
virtual std::shared_ptr<Task> scheduleIdleTask (
47
46
RawCallback&& callback,
48
- RuntimeSchedulerTimeout timeout = timeoutForSchedulerPriority(
47
+ HighResDuration timeout = timeoutForSchedulerPriority(
49
48
SchedulerPriority::IdlePriority)) noexcept = 0;
50
49
virtual void cancelTask (Task& task) noexcept = 0;
51
50
virtual bool getShouldYield () noexcept = 0;
52
51
virtual SchedulerPriority getCurrentPriorityLevel () const noexcept = 0;
53
- virtual RuntimeSchedulerTimePoint now () const noexcept = 0;
52
+ virtual HighResTimeStamp now () const noexcept = 0;
54
53
virtual void callExpiredTasks (jsi::Runtime& runtime) = 0;
55
54
virtual void scheduleRenderingUpdate (
56
55
SurfaceId surfaceId,
@@ -69,8 +68,7 @@ class RuntimeScheduler final : RuntimeSchedulerBase {
69
68
public:
70
69
explicit RuntimeScheduler (
71
70
RuntimeExecutor runtimeExecutor,
72
- std::function<RuntimeSchedulerTimePoint()> now =
73
- RuntimeSchedulerClock::now,
71
+ std::function<HighResTimeStamp()> now = HighResTimeStamp::now,
74
72
RuntimeSchedulerTaskErrorHandler onTaskError = handleTaskErrorDefault);
75
73
76
74
/*
@@ -112,12 +110,12 @@ class RuntimeScheduler final : RuntimeSchedulerBase {
112
110
113
111
std::shared_ptr<Task> scheduleIdleTask (
114
112
jsi::Function&& callback,
115
- RuntimeSchedulerTimeout timeout = timeoutForSchedulerPriority(
113
+ HighResDuration timeout = timeoutForSchedulerPriority(
116
114
SchedulerPriority::IdlePriority)) noexcept override ;
117
115
118
116
std::shared_ptr<Task> scheduleIdleTask (
119
117
RawCallback&& callback,
120
- RuntimeSchedulerTimeout timeout = timeoutForSchedulerPriority(
118
+ HighResDuration timeout = timeoutForSchedulerPriority(
121
119
SchedulerPriority::IdlePriority)) noexcept override ;
122
120
123
121
/*
@@ -149,7 +147,7 @@ class RuntimeScheduler final : RuntimeSchedulerBase {
149
147
*
150
148
* Thread synchronization must be enforced externally.
151
149
*/
152
- RuntimeSchedulerTimePoint now () const noexcept override ;
150
+ HighResTimeStamp now () const noexcept override ;
153
151
154
152
/*
155
153
* Expired task is a task that should have been already executed. Designed to
0 commit comments