mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
592e92fc90
commit
e24b55ef4f
@@ -52,19 +52,19 @@ std::shared_ptr<Task> RuntimeScheduler::scheduleTask(
|
||||
return task;
|
||||
}
|
||||
|
||||
bool RuntimeScheduler::getShouldYield() const {
|
||||
bool RuntimeScheduler::getShouldYield() const noexcept {
|
||||
return shouldYield_;
|
||||
}
|
||||
|
||||
void RuntimeScheduler::cancelTask(const std::shared_ptr<Task> &task) {
|
||||
void RuntimeScheduler::cancelTask(const std::shared_ptr<Task> &task) noexcept {
|
||||
task->callback.reset();
|
||||
}
|
||||
|
||||
SchedulerPriority RuntimeScheduler::getCurrentPriorityLevel() const {
|
||||
SchedulerPriority RuntimeScheduler::getCurrentPriorityLevel() const noexcept {
|
||||
return currentPriority_;
|
||||
}
|
||||
|
||||
RuntimeSchedulerTimePoint RuntimeScheduler::now() const {
|
||||
RuntimeSchedulerTimePoint RuntimeScheduler::now() const noexcept {
|
||||
return now_();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,17 @@ class RuntimeScheduler final {
|
||||
RuntimeExecutor const &runtimeExecutor,
|
||||
std::function<RuntimeSchedulerTimePoint()> now =
|
||||
RuntimeSchedulerClock::now);
|
||||
/*
|
||||
* Not copyable.
|
||||
*/
|
||||
RuntimeScheduler(RuntimeScheduler const &) = delete;
|
||||
RuntimeScheduler &operator=(RuntimeScheduler const &) = delete;
|
||||
|
||||
/*
|
||||
* Not movable.
|
||||
*/
|
||||
RuntimeScheduler(RuntimeScheduler &&) = delete;
|
||||
RuntimeScheduler &operator=(RuntimeScheduler &&) = delete;
|
||||
|
||||
void scheduleWork(std::function<void(jsi::Runtime &)> callback) const;
|
||||
|
||||
@@ -39,13 +50,13 @@ class RuntimeScheduler final {
|
||||
SchedulerPriority priority,
|
||||
jsi::Function callback);
|
||||
|
||||
void cancelTask(std::shared_ptr<Task> const &task);
|
||||
void cancelTask(std::shared_ptr<Task> const &task) noexcept;
|
||||
|
||||
bool getShouldYield() const;
|
||||
bool getShouldYield() const noexcept;
|
||||
|
||||
SchedulerPriority getCurrentPriorityLevel() const;
|
||||
SchedulerPriority getCurrentPriorityLevel() const noexcept;
|
||||
|
||||
RuntimeSchedulerTimePoint now() const;
|
||||
RuntimeSchedulerTimePoint now() const noexcept;
|
||||
|
||||
void setEnableYielding(bool enableYielding);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user