Skip to content

Commit f4a9785

Browse files
lavenzgfacebook-github-bot
authored andcommitted
Promote event loop control JSI interface
Summary: Promote `IEventLoopControl` and `ISetEventLoopControl` out of `JSI_UNSTABLE` and make `HermesRuntimeImpl` always implement the setter interface. Keep unrelated unstable APIs such as serialization, tracing helpers, and Worker installation behind `JSI_UNSTABLE`. Differential Revision: D106744174
1 parent 6720760 commit f4a9785

7 files changed

Lines changed: 84 additions & 2 deletions

File tree

packages/react-native/ReactCommon/jsi/jsi/hermes-interfaces.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ namespace debugger {
2626
class Debugger;
2727
}
2828

29-
#ifdef JSI_UNSTABLE
3029
/// IEventLoopControl is defined by the integrator to allow the Runtime to
3130
/// schedule some task to be run when convenient, and to keep track of "Task
3231
/// sources". After it is set to a Runtime, the integrator must ensure that the
@@ -79,7 +78,6 @@ struct JSI_EXPORT ISetEventLoopControl : public jsi::ICast {
7978
protected:
8079
~ISetEventLoopControl() = default;
8180
};
82-
#endif
8381

8482
/// Interface for Hermes-specific runtime methods.The actual implementations of
8583
/// the pure virtual methods are provided by Hermes API.

scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,20 @@ class facebook::hermes::IHermesSHUnit : public facebook::jsi::ICast {
438438
public virtual SHUnitCreator getSHUnitCreator() const = 0;
439439
}
440440

441+
struct facebook::hermes::IEventLoopControl {
442+
protected ~IEventLoopControl() = default;
443+
public virtual uint64_t registerTaskQueueSource() = 0;
444+
public virtual void scheduleTask(const std::function<void()>& task) = 0;
445+
public virtual void unregisterTaskQueueSource(uint64_t sourceId) = 0;
446+
}
447+
448+
struct facebook::hermes::ISetEventLoopControl : public facebook::jsi::ICast {
449+
protected ~ISetEventLoopControl() = default;
450+
public static constexpr facebook::jsi::UUID uuid;
451+
public virtual facebook::hermes::IEventLoopControl* getEventLoopControl() = 0;
452+
public virtual void setEventLoopControl(facebook::hermes::IEventLoopControl* eventLoopControl) = 0;
453+
}
454+
441455

442456
const char facebook::react::AndroidHorizontalScrollContentViewShadowNodeComponentName[];
443457
const char facebook::react::AndroidProgressBarComponentName[];

scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,20 @@ class facebook::hermes::IHermesSHUnit : public facebook::jsi::ICast {
438438
public virtual SHUnitCreator getSHUnitCreator() const = 0;
439439
}
440440

441+
struct facebook::hermes::IEventLoopControl {
442+
protected ~IEventLoopControl() = default;
443+
public virtual uint64_t registerTaskQueueSource() = 0;
444+
public virtual void scheduleTask(const std::function<void()>& task) = 0;
445+
public virtual void unregisterTaskQueueSource(uint64_t sourceId) = 0;
446+
}
447+
448+
struct facebook::hermes::ISetEventLoopControl : public facebook::jsi::ICast {
449+
protected ~ISetEventLoopControl() = default;
450+
public static constexpr facebook::jsi::UUID uuid;
451+
public virtual facebook::hermes::IEventLoopControl* getEventLoopControl() = 0;
452+
public virtual void setEventLoopControl(facebook::hermes::IEventLoopControl* eventLoopControl) = 0;
453+
}
454+
441455

442456
const char facebook::react::AndroidHorizontalScrollContentViewShadowNodeComponentName[];
443457
const char facebook::react::AndroidProgressBarComponentName[];

scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,20 @@ class facebook::hermes::IHermesSHUnit : public facebook::jsi::ICast {
438438
public virtual SHUnitCreator getSHUnitCreator() const = 0;
439439
}
440440

441+
struct facebook::hermes::IEventLoopControl {
442+
protected ~IEventLoopControl() = default;
443+
public virtual uint64_t registerTaskQueueSource() = 0;
444+
public virtual void scheduleTask(const std::function<void()>& task) = 0;
445+
public virtual void unregisterTaskQueueSource(uint64_t sourceId) = 0;
446+
}
447+
448+
struct facebook::hermes::ISetEventLoopControl : public facebook::jsi::ICast {
449+
protected ~ISetEventLoopControl() = default;
450+
public static constexpr facebook::jsi::UUID uuid;
451+
public virtual facebook::hermes::IEventLoopControl* getEventLoopControl() = 0;
452+
public virtual void setEventLoopControl(facebook::hermes::IEventLoopControl* eventLoopControl) = 0;
453+
}
454+
441455

442456
const char facebook::react::AndroidHorizontalScrollContentViewShadowNodeComponentName[];
443457
const char facebook::react::AndroidProgressBarComponentName[];

scripts/cxx-api/api-snapshots/ReactCommonDebugCxx.api

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,20 @@ class facebook::hermes::IHermesSHUnit : public facebook::jsi::ICast {
136136
public virtual SHUnitCreator getSHUnitCreator() const = 0;
137137
}
138138

139+
struct facebook::hermes::IEventLoopControl {
140+
protected ~IEventLoopControl() = default;
141+
public virtual uint64_t registerTaskQueueSource() = 0;
142+
public virtual void scheduleTask(const std::function<void()>& task) = 0;
143+
public virtual void unregisterTaskQueueSource(uint64_t sourceId) = 0;
144+
}
145+
146+
struct facebook::hermes::ISetEventLoopControl : public facebook::jsi::ICast {
147+
protected ~ISetEventLoopControl() = default;
148+
public static constexpr facebook::jsi::UUID uuid;
149+
public virtual facebook::hermes::IEventLoopControl* getEventLoopControl() = 0;
150+
public virtual void setEventLoopControl(facebook::hermes::IEventLoopControl* eventLoopControl) = 0;
151+
}
152+
139153

140154
const char facebook::react::AndroidProgressBarComponentName[];
141155
const char facebook::react::AndroidSwitchComponentName[];

scripts/cxx-api/api-snapshots/ReactCommonNewarchCxx.api

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,20 @@ class facebook::hermes::IHermesSHUnit : public facebook::jsi::ICast {
136136
public virtual SHUnitCreator getSHUnitCreator() const = 0;
137137
}
138138

139+
struct facebook::hermes::IEventLoopControl {
140+
protected ~IEventLoopControl() = default;
141+
public virtual uint64_t registerTaskQueueSource() = 0;
142+
public virtual void scheduleTask(const std::function<void()>& task) = 0;
143+
public virtual void unregisterTaskQueueSource(uint64_t sourceId) = 0;
144+
}
145+
146+
struct facebook::hermes::ISetEventLoopControl : public facebook::jsi::ICast {
147+
protected ~ISetEventLoopControl() = default;
148+
public static constexpr facebook::jsi::UUID uuid;
149+
public virtual facebook::hermes::IEventLoopControl* getEventLoopControl() = 0;
150+
public virtual void setEventLoopControl(facebook::hermes::IEventLoopControl* eventLoopControl) = 0;
151+
}
152+
139153

140154
const char facebook::react::AndroidProgressBarComponentName[];
141155
const char facebook::react::AndroidSwitchComponentName[];

scripts/cxx-api/api-snapshots/ReactCommonReleaseCxx.api

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,20 @@ class facebook::hermes::IHermesSHUnit : public facebook::jsi::ICast {
136136
public virtual SHUnitCreator getSHUnitCreator() const = 0;
137137
}
138138

139+
struct facebook::hermes::IEventLoopControl {
140+
protected ~IEventLoopControl() = default;
141+
public virtual uint64_t registerTaskQueueSource() = 0;
142+
public virtual void scheduleTask(const std::function<void()>& task) = 0;
143+
public virtual void unregisterTaskQueueSource(uint64_t sourceId) = 0;
144+
}
145+
146+
struct facebook::hermes::ISetEventLoopControl : public facebook::jsi::ICast {
147+
protected ~ISetEventLoopControl() = default;
148+
public static constexpr facebook::jsi::UUID uuid;
149+
public virtual facebook::hermes::IEventLoopControl* getEventLoopControl() = 0;
150+
public virtual void setEventLoopControl(facebook::hermes::IEventLoopControl* eventLoopControl) = 0;
151+
}
152+
139153

140154
const char facebook::react::AndroidProgressBarComponentName[];
141155
const char facebook::react::AndroidSwitchComponentName[];

0 commit comments

Comments
 (0)