From 244fe286a0bb3a1874fe778fbc65ecc9f1184534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Tue, 5 Mar 2024 04:10:44 -0800 Subject: [PATCH] Make queueMicrotask pure virtual (#43311) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43311 X-link: https://github.com/facebook/hermes/pull/1337 Changelog: [internal] We've done this in a separate diff because the changes in Hermes don't propagate immediately to the React Native repository. We need to land the changes in JSI and Hermes first (in a backwards-compatible way) and then land this in a separate commit to make the method mandatory. Reviewed By: neildhar Differential Revision: D54413830 fbshipit-source-id: 3b89fe0e6697b0019544b73daa89d932db97b63a --- packages/react-native/ReactCommon/jsi/jsi/jsi.cpp | 4 ---- packages/react-native/ReactCommon/jsi/jsi/jsi.h | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/react-native/ReactCommon/jsi/jsi/jsi.cpp b/packages/react-native/ReactCommon/jsi/jsi/jsi.cpp index bc953a55957..2d1003f1f83 100644 --- a/packages/react-native/ReactCommon/jsi/jsi/jsi.cpp +++ b/packages/react-native/ReactCommon/jsi/jsi/jsi.cpp @@ -87,10 +87,6 @@ NativeState::~NativeState() {} Runtime::~Runtime() {} -void Runtime::queueMicrotask(const jsi::Function& /*callback*/) { - throw JSINativeException("queueMicrotask is not implemented in this runtime"); -} - Instrumentation& Runtime::instrumentation() { class NoInstrumentation : public Instrumentation { std::string getRecordedGCStats() override { diff --git a/packages/react-native/ReactCommon/jsi/jsi/jsi.h b/packages/react-native/ReactCommon/jsi/jsi/jsi.h index d86005e4e37..d77255f61a8 100644 --- a/packages/react-native/ReactCommon/jsi/jsi/jsi.h +++ b/packages/react-native/ReactCommon/jsi/jsi/jsi.h @@ -214,7 +214,7 @@ class JSI_EXPORT Runtime { /// its event loop implementation. /// /// \param callback a function to be executed as a microtask. - virtual void queueMicrotask(const jsi::Function& callback); + virtual void queueMicrotask(const jsi::Function& callback) = 0; /// Drain the JavaScript VM internal Microtask (a.k.a. Job in ECMA262) queue. ///