mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Buffer async CallInvoker work with module calls (#58313)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/58313 In bridgeless, native reaches JS by two routes that end in the same `RuntimeScheduler` queue but get there differently. `callFunctionOnModule` goes through the instance's `BufferedRuntimeExecutor`; the `CallInvoker` goes straight to `scheduleTask`. The CallInvoker therefore skips the buffer entirely and can reach the runtime while a module call issued earlier is still parked, unflushed, because the bundle is mid-evaluation. Native code that issues both cannot rely on the order it issued them in, and `Task` is a min-heap on `now() + timeout(priority)` with no insertion tiebreak, so equal priorities do not settle it either. Gives the two channels the same buffering. `BufferedRuntimeExecutor` gains a priority-carrying `execute`, so work routed through it keeps the scheduler priority it was submitted with instead of collapsing to the executor default, and buffered work from both overloads stays in one submission-ordered stream. `BufferedCallInvoker` sits on that executor and becomes the bridgeless `jsCallInvoker` on Android, iOS and macOS. `invokeSync` deliberately keeps going straight to the scheduler: a synchronous call cannot wait for a flush that only happens once the bundle has run. Behind `enableBufferedCallInvoker`, default true. `ReactInstance` picks between the buffered invoker and the existing `RuntimeSchedulerCallInvoker` in one place, so the platform call sites are identical either way and the change is revertible at runtime — it moves when native-issued async work first reaches JS during startup, which is the intended contract but affects every native module. One lifetime hazard this surfaces, worth knowing about beyond this diff: `BufferedRuntimeExecutor` reaches the scheduler through a raw pointer captured at construction, which is safe only while the owning instance is alive. A CallInvoker is routinely held across instance teardown, so `BufferedCallInvoker` guards every async dispatch on a weak reference to the scheduler and drops the work when it has expired — the same contract `RuntimeSchedulerCallInvoker` has. Without that guard this reliably segfaults on a reload. Changelog: [General][Changed] - Async `CallInvoker` work is now buffered alongside callable module calls, so it no longer runs before the JS bundle has finished evaluating Reviewed By: rubennorte Differential Revision: D118456662 fbshipit-source-id: 7c6ccb595d69595721092eeb84b4724809140496
This commit is contained in:
1 parent
f072ddb17c
commit
3ca6ea3eca
41 files changed
+610
-130
No files matched your search
@@ -1902,15 +1902,18 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac
|
||||
}
|
||||
|
||||
class facebook::react::BufferedRuntimeExecutor {
|
||||
public BufferedRuntimeExecutor(facebook::react::RuntimeExecutor runtimeExecutor);
|
||||
public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor);
|
||||
public using Executor = std::function<void(facebook::react::SchedulerPriority, facebook::react::BufferedRuntimeExecutor::Work&&)>;
|
||||
public using Work = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void execute(facebook::react::SchedulerPriority priority, facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void flush();
|
||||
}
|
||||
|
||||
struct facebook::react::BufferedRuntimeExecutor::BufferedWork {
|
||||
public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const;
|
||||
public facebook::react::BufferedRuntimeExecutor::Work work_;
|
||||
public facebook::react::SchedulerPriority priority_;
|
||||
public uint64_t index_;
|
||||
}
|
||||
|
||||
@@ -1977,6 +1980,13 @@ class facebook::react::CallInvokerHolder : public jni::HybridClass<facebook::rea
|
||||
public std::shared_ptr<facebook::react::CallInvoker> getCallInvoker();
|
||||
}
|
||||
|
||||
class facebook::react::CallInvokerImpl : public facebook::react::CallInvoker {
|
||||
public CallInvokerImpl(std::shared_ptr<facebook::react::BufferedRuntimeExecutor> bufferedRuntimeExecutor, std::weak_ptr<facebook::react::RuntimeScheduler> runtimeScheduler);
|
||||
public virtual void invokeAsync(facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeAsync(facebook::react::SchedulerPriority priority, facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeSync(facebook::react::CallFunc&& func) override;
|
||||
}
|
||||
|
||||
class facebook::react::CallbackWrapper : public facebook::react::LongLivedObject {
|
||||
public facebook::jsi::Function& callback() noexcept;
|
||||
public facebook::jsi::Runtime& runtime() noexcept;
|
||||
@@ -4317,6 +4327,7 @@ class facebook::react::ReactInstance {
|
||||
public facebook::react::ReactInstance& operator=(facebook::react::ReactInstance&&) = delete;
|
||||
public facebook::react::RuntimeExecutor getBufferedRuntimeExecutor() noexcept;
|
||||
public facebook::react::RuntimeExecutor getUnbufferedRuntimeExecutor() noexcept;
|
||||
public std::shared_ptr<facebook::react::CallInvoker> createJSCallInvoker() noexcept;
|
||||
public std::shared_ptr<facebook::react::RuntimeScheduler> getRuntimeScheduler() noexcept;
|
||||
public using BindingsInstallFunc = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void callFunctionOnModule(const std::string& moduleName, const std::string& methodName, folly::dynamic&& args);
|
||||
|
||||
@@ -1896,15 +1896,18 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac
|
||||
}
|
||||
|
||||
class facebook::react::BufferedRuntimeExecutor {
|
||||
public BufferedRuntimeExecutor(facebook::react::RuntimeExecutor runtimeExecutor);
|
||||
public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor);
|
||||
public using Executor = std::function<void(facebook::react::SchedulerPriority, facebook::react::BufferedRuntimeExecutor::Work&&)>;
|
||||
public using Work = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void execute(facebook::react::SchedulerPriority priority, facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void flush();
|
||||
}
|
||||
|
||||
struct facebook::react::BufferedRuntimeExecutor::BufferedWork {
|
||||
public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const;
|
||||
public facebook::react::BufferedRuntimeExecutor::Work work_;
|
||||
public facebook::react::SchedulerPriority priority_;
|
||||
public uint64_t index_;
|
||||
}
|
||||
|
||||
@@ -1971,6 +1974,13 @@ class facebook::react::CallInvokerHolder : public jni::HybridClass<facebook::rea
|
||||
public std::shared_ptr<facebook::react::CallInvoker> getCallInvoker();
|
||||
}
|
||||
|
||||
class facebook::react::CallInvokerImpl : public facebook::react::CallInvoker {
|
||||
public CallInvokerImpl(std::shared_ptr<facebook::react::BufferedRuntimeExecutor> bufferedRuntimeExecutor, std::weak_ptr<facebook::react::RuntimeScheduler> runtimeScheduler);
|
||||
public virtual void invokeAsync(facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeAsync(facebook::react::SchedulerPriority priority, facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeSync(facebook::react::CallFunc&& func) override;
|
||||
}
|
||||
|
||||
class facebook::react::CallbackWrapper : public facebook::react::LongLivedObject {
|
||||
public facebook::jsi::Function& callback() noexcept;
|
||||
public facebook::jsi::Runtime& runtime() noexcept;
|
||||
@@ -4161,6 +4171,7 @@ class facebook::react::ReactInstance {
|
||||
public facebook::react::ReactInstance& operator=(facebook::react::ReactInstance&&) = delete;
|
||||
public facebook::react::RuntimeExecutor getBufferedRuntimeExecutor() noexcept;
|
||||
public facebook::react::RuntimeExecutor getUnbufferedRuntimeExecutor() noexcept;
|
||||
public std::shared_ptr<facebook::react::CallInvoker> createJSCallInvoker() noexcept;
|
||||
public std::shared_ptr<facebook::react::RuntimeScheduler> getRuntimeScheduler() noexcept;
|
||||
public using BindingsInstallFunc = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void callFunctionOnModule(const std::string& moduleName, const std::string& methodName, folly::dynamic&& args);
|
||||
|
||||
@@ -1900,15 +1900,18 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac
|
||||
}
|
||||
|
||||
class facebook::react::BufferedRuntimeExecutor {
|
||||
public BufferedRuntimeExecutor(facebook::react::RuntimeExecutor runtimeExecutor);
|
||||
public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor);
|
||||
public using Executor = std::function<void(facebook::react::SchedulerPriority, facebook::react::BufferedRuntimeExecutor::Work&&)>;
|
||||
public using Work = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void execute(facebook::react::SchedulerPriority priority, facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void flush();
|
||||
}
|
||||
|
||||
struct facebook::react::BufferedRuntimeExecutor::BufferedWork {
|
||||
public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const;
|
||||
public facebook::react::BufferedRuntimeExecutor::Work work_;
|
||||
public facebook::react::SchedulerPriority priority_;
|
||||
public uint64_t index_;
|
||||
}
|
||||
|
||||
@@ -1975,6 +1978,13 @@ class facebook::react::CallInvokerHolder : public jni::HybridClass<facebook::rea
|
||||
public std::shared_ptr<facebook::react::CallInvoker> getCallInvoker();
|
||||
}
|
||||
|
||||
class facebook::react::CallInvokerImpl : public facebook::react::CallInvoker {
|
||||
public CallInvokerImpl(std::shared_ptr<facebook::react::BufferedRuntimeExecutor> bufferedRuntimeExecutor, std::weak_ptr<facebook::react::RuntimeScheduler> runtimeScheduler);
|
||||
public virtual void invokeAsync(facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeAsync(facebook::react::SchedulerPriority priority, facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeSync(facebook::react::CallFunc&& func) override;
|
||||
}
|
||||
|
||||
class facebook::react::CallbackWrapper : public facebook::react::LongLivedObject {
|
||||
public facebook::jsi::Function& callback() noexcept;
|
||||
public facebook::jsi::Runtime& runtime() noexcept;
|
||||
@@ -4314,6 +4324,7 @@ class facebook::react::ReactInstance {
|
||||
public facebook::react::ReactInstance& operator=(facebook::react::ReactInstance&&) = delete;
|
||||
public facebook::react::RuntimeExecutor getBufferedRuntimeExecutor() noexcept;
|
||||
public facebook::react::RuntimeExecutor getUnbufferedRuntimeExecutor() noexcept;
|
||||
public std::shared_ptr<facebook::react::CallInvoker> createJSCallInvoker() noexcept;
|
||||
public std::shared_ptr<facebook::react::RuntimeScheduler> getRuntimeScheduler() noexcept;
|
||||
public using BindingsInstallFunc = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void callFunctionOnModule(const std::string& moduleName, const std::string& methodName, folly::dynamic&& args);
|
||||
|
||||
@@ -4485,15 +4485,18 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac
|
||||
}
|
||||
|
||||
class facebook::react::BufferedRuntimeExecutor {
|
||||
public BufferedRuntimeExecutor(facebook::react::RuntimeExecutor runtimeExecutor);
|
||||
public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor);
|
||||
public using Executor = std::function<void(facebook::react::SchedulerPriority, facebook::react::BufferedRuntimeExecutor::Work&&)>;
|
||||
public using Work = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void execute(facebook::react::SchedulerPriority priority, facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void flush();
|
||||
}
|
||||
|
||||
struct facebook::react::BufferedRuntimeExecutor::BufferedWork {
|
||||
public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const;
|
||||
public facebook::react::BufferedRuntimeExecutor::Work work_;
|
||||
public facebook::react::SchedulerPriority priority_;
|
||||
public uint64_t index_;
|
||||
}
|
||||
|
||||
@@ -4555,6 +4558,13 @@ class facebook::react::CallInvoker {
|
||||
public virtual ~CallInvoker() = default;
|
||||
}
|
||||
|
||||
class facebook::react::CallInvokerImpl : public facebook::react::CallInvoker {
|
||||
public CallInvokerImpl(std::shared_ptr<facebook::react::BufferedRuntimeExecutor> bufferedRuntimeExecutor, std::weak_ptr<facebook::react::RuntimeScheduler> runtimeScheduler);
|
||||
public virtual void invokeAsync(facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeAsync(facebook::react::SchedulerPriority priority, facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeSync(facebook::react::CallFunc&& func) override;
|
||||
}
|
||||
|
||||
class facebook::react::CallbackWrapper : public facebook::react::LongLivedObject {
|
||||
public facebook::jsi::Function& callback() noexcept;
|
||||
public facebook::jsi::Runtime& runtime() noexcept;
|
||||
@@ -6525,6 +6535,7 @@ class facebook::react::ReactInstance {
|
||||
public facebook::react::ReactInstance& operator=(facebook::react::ReactInstance&&) = delete;
|
||||
public facebook::react::RuntimeExecutor getBufferedRuntimeExecutor() noexcept;
|
||||
public facebook::react::RuntimeExecutor getUnbufferedRuntimeExecutor() noexcept;
|
||||
public std::shared_ptr<facebook::react::CallInvoker> createJSCallInvoker() noexcept;
|
||||
public std::shared_ptr<facebook::react::RuntimeScheduler> getRuntimeScheduler() noexcept;
|
||||
public using BindingsInstallFunc = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void callFunctionOnModule(const std::string& moduleName, const std::string& methodName, folly::dynamic&& args);
|
||||
|
||||
@@ -4472,15 +4472,18 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac
|
||||
}
|
||||
|
||||
class facebook::react::BufferedRuntimeExecutor {
|
||||
public BufferedRuntimeExecutor(facebook::react::RuntimeExecutor runtimeExecutor);
|
||||
public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor);
|
||||
public using Executor = std::function<void(facebook::react::SchedulerPriority, facebook::react::BufferedRuntimeExecutor::Work&&)>;
|
||||
public using Work = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void execute(facebook::react::SchedulerPriority priority, facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void flush();
|
||||
}
|
||||
|
||||
struct facebook::react::BufferedRuntimeExecutor::BufferedWork {
|
||||
public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const;
|
||||
public facebook::react::BufferedRuntimeExecutor::Work work_;
|
||||
public facebook::react::SchedulerPriority priority_;
|
||||
public uint64_t index_;
|
||||
}
|
||||
|
||||
@@ -4542,6 +4545,13 @@ class facebook::react::CallInvoker {
|
||||
public virtual ~CallInvoker() = default;
|
||||
}
|
||||
|
||||
class facebook::react::CallInvokerImpl : public facebook::react::CallInvoker {
|
||||
public CallInvokerImpl(std::shared_ptr<facebook::react::BufferedRuntimeExecutor> bufferedRuntimeExecutor, std::weak_ptr<facebook::react::RuntimeScheduler> runtimeScheduler);
|
||||
public virtual void invokeAsync(facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeAsync(facebook::react::SchedulerPriority priority, facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeSync(facebook::react::CallFunc&& func) override;
|
||||
}
|
||||
|
||||
class facebook::react::CallbackWrapper : public facebook::react::LongLivedObject {
|
||||
public facebook::jsi::Function& callback() noexcept;
|
||||
public facebook::jsi::Runtime& runtime() noexcept;
|
||||
@@ -6401,6 +6411,7 @@ class facebook::react::ReactInstance {
|
||||
public facebook::react::ReactInstance& operator=(facebook::react::ReactInstance&&) = delete;
|
||||
public facebook::react::RuntimeExecutor getBufferedRuntimeExecutor() noexcept;
|
||||
public facebook::react::RuntimeExecutor getUnbufferedRuntimeExecutor() noexcept;
|
||||
public std::shared_ptr<facebook::react::CallInvoker> createJSCallInvoker() noexcept;
|
||||
public std::shared_ptr<facebook::react::RuntimeScheduler> getRuntimeScheduler() noexcept;
|
||||
public using BindingsInstallFunc = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void callFunctionOnModule(const std::string& moduleName, const std::string& methodName, folly::dynamic&& args);
|
||||
|
||||
@@ -4483,15 +4483,18 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac
|
||||
}
|
||||
|
||||
class facebook::react::BufferedRuntimeExecutor {
|
||||
public BufferedRuntimeExecutor(facebook::react::RuntimeExecutor runtimeExecutor);
|
||||
public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor);
|
||||
public using Executor = std::function<void(facebook::react::SchedulerPriority, facebook::react::BufferedRuntimeExecutor::Work&&)>;
|
||||
public using Work = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void execute(facebook::react::SchedulerPriority priority, facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void flush();
|
||||
}
|
||||
|
||||
struct facebook::react::BufferedRuntimeExecutor::BufferedWork {
|
||||
public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const;
|
||||
public facebook::react::BufferedRuntimeExecutor::Work work_;
|
||||
public facebook::react::SchedulerPriority priority_;
|
||||
public uint64_t index_;
|
||||
}
|
||||
|
||||
@@ -4553,6 +4556,13 @@ class facebook::react::CallInvoker {
|
||||
public virtual ~CallInvoker() = default;
|
||||
}
|
||||
|
||||
class facebook::react::CallInvokerImpl : public facebook::react::CallInvoker {
|
||||
public CallInvokerImpl(std::shared_ptr<facebook::react::BufferedRuntimeExecutor> bufferedRuntimeExecutor, std::weak_ptr<facebook::react::RuntimeScheduler> runtimeScheduler);
|
||||
public virtual void invokeAsync(facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeAsync(facebook::react::SchedulerPriority priority, facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeSync(facebook::react::CallFunc&& func) override;
|
||||
}
|
||||
|
||||
class facebook::react::CallbackWrapper : public facebook::react::LongLivedObject {
|
||||
public facebook::jsi::Function& callback() noexcept;
|
||||
public facebook::jsi::Runtime& runtime() noexcept;
|
||||
@@ -6522,6 +6532,7 @@ class facebook::react::ReactInstance {
|
||||
public facebook::react::ReactInstance& operator=(facebook::react::ReactInstance&&) = delete;
|
||||
public facebook::react::RuntimeExecutor getBufferedRuntimeExecutor() noexcept;
|
||||
public facebook::react::RuntimeExecutor getUnbufferedRuntimeExecutor() noexcept;
|
||||
public std::shared_ptr<facebook::react::CallInvoker> createJSCallInvoker() noexcept;
|
||||
public std::shared_ptr<facebook::react::RuntimeScheduler> getRuntimeScheduler() noexcept;
|
||||
public using BindingsInstallFunc = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void callFunctionOnModule(const std::string& moduleName, const std::string& methodName, folly::dynamic&& args);
|
||||
|
||||
@@ -1208,15 +1208,18 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac
|
||||
}
|
||||
|
||||
class facebook::react::BufferedRuntimeExecutor {
|
||||
public BufferedRuntimeExecutor(facebook::react::RuntimeExecutor runtimeExecutor);
|
||||
public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor);
|
||||
public using Executor = std::function<void(facebook::react::SchedulerPriority, facebook::react::BufferedRuntimeExecutor::Work&&)>;
|
||||
public using Work = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void execute(facebook::react::SchedulerPriority priority, facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void flush();
|
||||
}
|
||||
|
||||
struct facebook::react::BufferedRuntimeExecutor::BufferedWork {
|
||||
public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const;
|
||||
public facebook::react::BufferedRuntimeExecutor::Work work_;
|
||||
public facebook::react::SchedulerPriority priority_;
|
||||
public uint64_t index_;
|
||||
}
|
||||
|
||||
@@ -1278,6 +1281,13 @@ class facebook::react::CallInvoker {
|
||||
public virtual ~CallInvoker() = default;
|
||||
}
|
||||
|
||||
class facebook::react::CallInvokerImpl : public facebook::react::CallInvoker {
|
||||
public CallInvokerImpl(std::shared_ptr<facebook::react::BufferedRuntimeExecutor> bufferedRuntimeExecutor, std::weak_ptr<facebook::react::RuntimeScheduler> runtimeScheduler);
|
||||
public virtual void invokeAsync(facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeAsync(facebook::react::SchedulerPriority priority, facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeSync(facebook::react::CallFunc&& func) override;
|
||||
}
|
||||
|
||||
class facebook::react::CallbackWrapper : public facebook::react::LongLivedObject {
|
||||
public facebook::jsi::Function& callback() noexcept;
|
||||
public facebook::jsi::Runtime& runtime() noexcept;
|
||||
@@ -2881,6 +2891,7 @@ class facebook::react::ReactInstance {
|
||||
public facebook::react::ReactInstance& operator=(facebook::react::ReactInstance&&) = delete;
|
||||
public facebook::react::RuntimeExecutor getBufferedRuntimeExecutor() noexcept;
|
||||
public facebook::react::RuntimeExecutor getUnbufferedRuntimeExecutor() noexcept;
|
||||
public std::shared_ptr<facebook::react::CallInvoker> createJSCallInvoker() noexcept;
|
||||
public std::shared_ptr<facebook::react::RuntimeScheduler> getRuntimeScheduler() noexcept;
|
||||
public using BindingsInstallFunc = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void callFunctionOnModule(const std::string& moduleName, const std::string& methodName, folly::dynamic&& args);
|
||||
|
||||
@@ -1203,15 +1203,18 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac
|
||||
}
|
||||
|
||||
class facebook::react::BufferedRuntimeExecutor {
|
||||
public BufferedRuntimeExecutor(facebook::react::RuntimeExecutor runtimeExecutor);
|
||||
public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor);
|
||||
public using Executor = std::function<void(facebook::react::SchedulerPriority, facebook::react::BufferedRuntimeExecutor::Work&&)>;
|
||||
public using Work = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void execute(facebook::react::SchedulerPriority priority, facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void flush();
|
||||
}
|
||||
|
||||
struct facebook::react::BufferedRuntimeExecutor::BufferedWork {
|
||||
public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const;
|
||||
public facebook::react::BufferedRuntimeExecutor::Work work_;
|
||||
public facebook::react::SchedulerPriority priority_;
|
||||
public uint64_t index_;
|
||||
}
|
||||
|
||||
@@ -1273,6 +1276,13 @@ class facebook::react::CallInvoker {
|
||||
public virtual ~CallInvoker() = default;
|
||||
}
|
||||
|
||||
class facebook::react::CallInvokerImpl : public facebook::react::CallInvoker {
|
||||
public CallInvokerImpl(std::shared_ptr<facebook::react::BufferedRuntimeExecutor> bufferedRuntimeExecutor, std::weak_ptr<facebook::react::RuntimeScheduler> runtimeScheduler);
|
||||
public virtual void invokeAsync(facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeAsync(facebook::react::SchedulerPriority priority, facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeSync(facebook::react::CallFunc&& func) override;
|
||||
}
|
||||
|
||||
class facebook::react::CallbackWrapper : public facebook::react::LongLivedObject {
|
||||
public facebook::jsi::Function& callback() noexcept;
|
||||
public facebook::jsi::Runtime& runtime() noexcept;
|
||||
@@ -2765,6 +2775,7 @@ class facebook::react::ReactInstance {
|
||||
public facebook::react::ReactInstance& operator=(facebook::react::ReactInstance&&) = delete;
|
||||
public facebook::react::RuntimeExecutor getBufferedRuntimeExecutor() noexcept;
|
||||
public facebook::react::RuntimeExecutor getUnbufferedRuntimeExecutor() noexcept;
|
||||
public std::shared_ptr<facebook::react::CallInvoker> createJSCallInvoker() noexcept;
|
||||
public std::shared_ptr<facebook::react::RuntimeScheduler> getRuntimeScheduler() noexcept;
|
||||
public using BindingsInstallFunc = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void callFunctionOnModule(const std::string& moduleName, const std::string& methodName, folly::dynamic&& args);
|
||||
|
||||
@@ -1206,15 +1206,18 @@ class facebook::react::BridgelessNativeMethodCallInvoker : public facebook::reac
|
||||
}
|
||||
|
||||
class facebook::react::BufferedRuntimeExecutor {
|
||||
public BufferedRuntimeExecutor(facebook::react::RuntimeExecutor runtimeExecutor);
|
||||
public BufferedRuntimeExecutor(facebook::react::BufferedRuntimeExecutor::Executor executor);
|
||||
public using Executor = std::function<void(facebook::react::SchedulerPriority, facebook::react::BufferedRuntimeExecutor::Work&&)>;
|
||||
public using Work = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void execute(facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void execute(facebook::react::SchedulerPriority priority, facebook::react::BufferedRuntimeExecutor::Work&& callback);
|
||||
public void flush();
|
||||
}
|
||||
|
||||
struct facebook::react::BufferedRuntimeExecutor::BufferedWork {
|
||||
public bool operator<(const facebook::react::BufferedRuntimeExecutor::BufferedWork& rhs) const;
|
||||
public facebook::react::BufferedRuntimeExecutor::Work work_;
|
||||
public facebook::react::SchedulerPriority priority_;
|
||||
public uint64_t index_;
|
||||
}
|
||||
|
||||
@@ -1276,6 +1279,13 @@ class facebook::react::CallInvoker {
|
||||
public virtual ~CallInvoker() = default;
|
||||
}
|
||||
|
||||
class facebook::react::CallInvokerImpl : public facebook::react::CallInvoker {
|
||||
public CallInvokerImpl(std::shared_ptr<facebook::react::BufferedRuntimeExecutor> bufferedRuntimeExecutor, std::weak_ptr<facebook::react::RuntimeScheduler> runtimeScheduler);
|
||||
public virtual void invokeAsync(facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeAsync(facebook::react::SchedulerPriority priority, facebook::react::CallFunc&& func) noexcept override;
|
||||
public virtual void invokeSync(facebook::react::CallFunc&& func) override;
|
||||
}
|
||||
|
||||
class facebook::react::CallbackWrapper : public facebook::react::LongLivedObject {
|
||||
public facebook::jsi::Function& callback() noexcept;
|
||||
public facebook::jsi::Runtime& runtime() noexcept;
|
||||
@@ -2878,6 +2888,7 @@ class facebook::react::ReactInstance {
|
||||
public facebook::react::ReactInstance& operator=(facebook::react::ReactInstance&&) = delete;
|
||||
public facebook::react::RuntimeExecutor getBufferedRuntimeExecutor() noexcept;
|
||||
public facebook::react::RuntimeExecutor getUnbufferedRuntimeExecutor() noexcept;
|
||||
public std::shared_ptr<facebook::react::CallInvoker> createJSCallInvoker() noexcept;
|
||||
public std::shared_ptr<facebook::react::RuntimeScheduler> getRuntimeScheduler() noexcept;
|
||||
public using BindingsInstallFunc = std::function<void(facebook::jsi::Runtime& runtime)>;
|
||||
public void callFunctionOnModule(const std::string& moduleName, const std::string& methodName, folly::dynamic&& args);
|
||||
|
||||
Reference in new issue
Block a user