Export Instance::getDecoratedNativeCallInvoker from RCTCxxBridge

Summary:
`RCTTurboModuleManager` will create a native `CallInvoker` for each ObjC NativeModule. This `CallInvoker` will be used to dispatch calls from JS to native. Before passing the native `CallInvoker` to the `ObjCTurboModule`, it'll first use `RCTCxxBridge decorateNativeCallInvoker` to get a bridge-aware decorated native `CallInvoker`. That way, the bridge remains informed about async TurboModule method calls that took place since the last time it was flushed. This ensures that we don't end up dispatching `onBatchComplete` any less with TurboModules on than we do with TurboModules off.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D20831546

fbshipit-source-id: b2eb4e0097e0dabf8c4bd8fdc4c850a0858af699
This commit is contained in:
Ramanpreet Nara
2020-04-03 09:47:42 -07:00
committed by Facebook GitHub Bot
parent de56649430
commit aef0ef4b31
2 changed files with 15 additions and 6 deletions
+12 -5
View File
@@ -210,11 +210,6 @@ struct RCTInstanceCallback : public InstanceCallback {
return _jsMessageThread;
}
- (std::shared_ptr<CallInvoker>)jsCallInvoker
{
return _reactInstance ? _reactInstance->getJSCallInvoker() : nullptr;
}
- (BOOL)isInspectable
{
return _reactInstance ? _reactInstance->isInspectable() : NO;
@@ -1450,4 +1445,16 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithBundleURL
}];
}
#pragma mark - RCTBridge (RCTTurboModule)
- (std::shared_ptr<CallInvoker>)jsCallInvoker
{
return _reactInstance ? _reactInstance->getJSCallInvoker() : nullptr;
}
- (std::shared_ptr<CallInvoker>)decorateNativeCallInvoker:(std::shared_ptr<CallInvoker>)nativeInvoker
{
return _reactInstance ? _reactInstance->getDecoratedNativeCallInvoker(nativeInvoker) : nullptr;
}
@end
@@ -221,6 +221,8 @@ class JSI_EXPORT ObjCTurboModule : public TurboModule {
*
* TODO: Consolidate this extension with the one in RCTSurfacePresenter.
*/
@interface RCTBridge ()
@interface RCTBridge (RCTTurboModule)
- (std::shared_ptr<facebook::react::CallInvoker>)jsCallInvoker;
- (std::shared_ptr<facebook::react::CallInvoker>)decorateNativeCallInvoker:
(std::shared_ptr<facebook::react::CallInvoker>)nativeInvoker;
@end