mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: changelog: [internal] Reviewed By: RSNara Differential Revision: D31145372 fbshipit-source-id: b1d9473d5006d055d1116f71f65899293fb85c56
37 lines
1002 B
C++
37 lines
1002 B
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 <ReactCommon/CallInvoker.h>
|
|
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
/*
|
|
* Exposes RuntimeScheduler to native modules. All calls invonked on JavaScript
|
|
* queue from native modules will be funneled through RuntimeScheduler.
|
|
*/
|
|
class RuntimeSchedulerCallInvoker : public CallInvoker {
|
|
public:
|
|
RuntimeSchedulerCallInvoker(std::weak_ptr<RuntimeScheduler> runtimeScheduler);
|
|
|
|
void invokeAsync(std::function<void()> &&func) override;
|
|
void invokeSync(std::function<void()> &&func) override;
|
|
|
|
private:
|
|
/*
|
|
* RuntimeScheduler is retained by the runtime. It must not be
|
|
* retained by anything beyond the runtime.
|
|
*/
|
|
std::weak_ptr<RuntimeScheduler> runtimeScheduler_;
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|