Skip to content

Commit e24b55e

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
Clean up RuntimeScheduler's API
Summary: Changelog: [internal] Mark methods as noexcept and explicitly delete unwanted constructors. Reviewed By: fkgozali Differential Revision: D29085827 fbshipit-source-id: 872009113e2bd519ab3ae11879a15d15f780198f
1 parent 592e92f commit e24b55e

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@ std::shared_ptr<Task> RuntimeScheduler::scheduleTask(
5252
return task;
5353
}
5454

55-
bool RuntimeScheduler::getShouldYield() const {
55+
bool RuntimeScheduler::getShouldYield() const noexcept {
5656
return shouldYield_;
5757
}
5858

59-
void RuntimeScheduler::cancelTask(const std::shared_ptr<Task> &task) {
59+
void RuntimeScheduler::cancelTask(const std::shared_ptr<Task> &task) noexcept {
6060
task->callback.reset();
6161
}
6262

63-
SchedulerPriority RuntimeScheduler::getCurrentPriorityLevel() const {
63+
SchedulerPriority RuntimeScheduler::getCurrentPriorityLevel() const noexcept {
6464
return currentPriority_;
6565
}
6666

67-
RuntimeSchedulerTimePoint RuntimeScheduler::now() const {
67+
RuntimeSchedulerTimePoint RuntimeScheduler::now() const noexcept {
6868
return now_();
6969
}
7070

ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ class RuntimeScheduler final {
2222
RuntimeExecutor const &runtimeExecutor,
2323
std::function<RuntimeSchedulerTimePoint()> now =
2424
RuntimeSchedulerClock::now);
25+
/*
26+
* Not copyable.
27+
*/
28+
RuntimeScheduler(RuntimeScheduler const &) = delete;
29+
RuntimeScheduler &operator=(RuntimeScheduler const &) = delete;
30+
31+
/*
32+
* Not movable.
33+
*/
34+
RuntimeScheduler(RuntimeScheduler &&) = delete;
35+
RuntimeScheduler &operator=(RuntimeScheduler &&) = delete;
2536

2637
void scheduleWork(std::function<void(jsi::Runtime &)> callback) const;
2738

@@ -39,13 +50,13 @@ class RuntimeScheduler final {
3950
SchedulerPriority priority,
4051
jsi::Function callback);
4152

42-
void cancelTask(std::shared_ptr<Task> const &task);
53+
void cancelTask(std::shared_ptr<Task> const &task) noexcept;
4354

44-
bool getShouldYield() const;
55+
bool getShouldYield() const noexcept;
4556

46-
SchedulerPriority getCurrentPriorityLevel() const;
57+
SchedulerPriority getCurrentPriorityLevel() const noexcept;
4758

48-
RuntimeSchedulerTimePoint now() const;
59+
RuntimeSchedulerTimePoint now() const noexcept;
4960

5061
void setEnableYielding(bool enableYielding);
5162

0 commit comments

Comments
 (0)