mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
9b3c12dc87
Summary: Changelog: [internal] This diff moves all calls to RuntimeExecutor to RuntimeScheduler. The calls are still immediately dispatched. Timing of events will not change. The goal of this diff is to prepare infrastructure for Concurrent Mode. Reviewed By: JoshuaGross Differential Revision: D27937665 fbshipit-source-id: 434d78c95ccf23d8da41186d0dae91bff4eda384
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <jsi/jsi.h>
|
|
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
|
|
|
namespace facebook::react {
|
|
|
|
/*
|
|
* Exposes RuntimeScheduler to JavaScript realm.
|
|
*/
|
|
class RuntimeSchedulerBinding : public jsi::HostObject {
|
|
public:
|
|
RuntimeSchedulerBinding(
|
|
std::shared_ptr<RuntimeScheduler> const &runtimeScheduler);
|
|
|
|
/*
|
|
* Installs RuntimeSchedulerBinding into JavaScript runtime if needed.
|
|
* Creates and sets `RuntimeSchedulerBinding` into the global namespace.
|
|
* In case if the global namespace already has a `RuntimeSchedulerBinding`
|
|
* installed, returns that.
|
|
*/
|
|
static std::shared_ptr<RuntimeSchedulerBinding> createAndInstallIfNeeded(
|
|
jsi::Runtime &runtime,
|
|
std::shared_ptr<RuntimeScheduler> const &runtimeScheduler);
|
|
|
|
/*
|
|
* `jsi::HostObject` specific overloads.
|
|
*/
|
|
jsi::Value get(jsi::Runtime &runtime, jsi::PropNameID const &name) override;
|
|
|
|
private:
|
|
std::shared_ptr<RuntimeScheduler> runtimeScheduler_;
|
|
};
|
|
|
|
} // namespace facebook::react
|