Skip to content

Commit e91e295

Browse files
lavenzgfacebook-github-bot
authored andcommitted
Promote event loop control JSI interface (facebook#57005)
Summary: X-link: facebook/hermes#2037 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`. Other hermes branches do not implement `ISetEventLoopControl`, for now. Changelog: [Internal] Differential Revision: D106744174
1 parent 5b16cdf commit e91e295

10 files changed

Lines changed: 126 additions & 2 deletions

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/ReactAppleDebugCxx.api

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

3753+
struct facebook::hermes::IEventLoopControl {
3754+
protected ~IEventLoopControl() = default;
3755+
public virtual uint64_t registerTaskQueueSource() = 0;
3756+
public virtual void scheduleTask(const std::function<void()>& task) = 0;
3757+
public virtual void unregisterTaskQueueSource(uint64_t sourceId) = 0;
3758+
}
3759+
3760+
struct facebook::hermes::ISetEventLoopControl : public facebook::jsi::ICast {
3761+
protected ~ISetEventLoopControl() = default;
3762+
public static constexpr facebook::jsi::UUID uuid;
3763+
public virtual facebook::hermes::IEventLoopControl* getEventLoopControl() = 0;
3764+
public virtual void setEventLoopControl(facebook::hermes::IEventLoopControl* eventLoopControl) = 0;
3765+
}
3766+
37533767

37543768
const char facebook::react::AppleSwitchComponentName[];
37553769
const char facebook::react::ImageComponentName[];

scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api

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

3379+
struct facebook::hermes::IEventLoopControl {
3380+
protected ~IEventLoopControl() = default;
3381+
public virtual uint64_t registerTaskQueueSource() = 0;
3382+
public virtual void scheduleTask(const std::function<void()>& task) = 0;
3383+
public virtual void unregisterTaskQueueSource(uint64_t sourceId) = 0;
3384+
}
3385+
3386+
struct facebook::hermes::ISetEventLoopControl : public facebook::jsi::ICast {
3387+
protected ~ISetEventLoopControl() = default;
3388+
public static constexpr facebook::jsi::UUID uuid;
3389+
public virtual facebook::hermes::IEventLoopControl* getEventLoopControl() = 0;
3390+
public virtual void setEventLoopControl(facebook::hermes::IEventLoopControl* eventLoopControl) = 0;
3391+
}
3392+
33793393

33803394
const char facebook::react::AppleSwitchComponentName[];
33813395
const char facebook::react::ImageComponentName[];

scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api

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

3753+
struct facebook::hermes::IEventLoopControl {
3754+
protected ~IEventLoopControl() = default;
3755+
public virtual uint64_t registerTaskQueueSource() = 0;
3756+
public virtual void scheduleTask(const std::function<void()>& task) = 0;
3757+
public virtual void unregisterTaskQueueSource(uint64_t sourceId) = 0;
3758+
}
3759+
3760+
struct facebook::hermes::ISetEventLoopControl : public facebook::jsi::ICast {
3761+
protected ~ISetEventLoopControl() = default;
3762+
public static constexpr facebook::jsi::UUID uuid;
3763+
public virtual facebook::hermes::IEventLoopControl* getEventLoopControl() = 0;
3764+
public virtual void setEventLoopControl(facebook::hermes::IEventLoopControl* eventLoopControl) = 0;
3765+
}
3766+
37533767

37543768
const char facebook::react::AppleSwitchComponentName[];
37553769
const char facebook::react::ImageComponentName[];

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)