Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Kudo committed May 10, 2024
1 parent 56b721f commit f67a9cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class JSI_EXPORT ObjCTurboModule : public TurboModule {
/**
* Implements this function if a TurboModule needs to install its own JSI bindings.
*/
- (RCTTurboModuleBindingsInstaller *)createBindingsInstaller;
- (nonnull RCTTurboModuleBindingsInstaller *)createBindingsInstaller;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ - (instancetype)initWithBridgeProxy:(RCTBridgeProxy *)bridgeProxy
* (for now).
*/

- (std::shared_ptr<TurboModule>)provideTurboModule:(const char *)moduleName
withRuntime:(facebook::jsi::Runtime *)runtime
- (std::shared_ptr<TurboModule>)provideTurboModule:(const char *)moduleName runtime:(facebook::jsi::Runtime *)runtime
{
auto turboModuleLookup = _turboModuleCache.find(moduleName);
if (turboModuleLookup != _turboModuleCache.end()) {
Expand Down Expand Up @@ -415,9 +414,7 @@ - (instancetype)initWithBridgeProxy:(RCTBridgeProxy *)bridgeProxy
if ([module respondsToSelector:@selector(createBindingsInstaller)]) {
RCTTurboModuleBindingsInstaller *installer =
(RCTTurboModuleBindingsInstaller *)[module performSelector:@selector(createBindingsInstaller)];
if (installer != nil) {
installer.get(*runtime);
}
[installer get](*runtime);
}
return turboModule;
}
Expand Down Expand Up @@ -781,7 +778,7 @@ - (BOOL)_shouldCreateObjCModule:(Class)moduleClass
* Attach method queue to id<RCTBridgeModule> object.
* This is necessary because the id<RCTBridgeModule> object can be eagerly created/initialized before the method
* queue is required. The method queue is required for an id<RCTBridgeModule> for JS -> Native calls. So, we need it
* before we create the id<RCTBridgeModule>'s TurboModule jsi::HostObject in provideTurboModule:.
* before we create the id<RCTBridgeModule>'s TurboModule jsi::HostObject in provideTurboModule:runtime:.
*/
objc_setAssociatedObject(module, &kAssociatedMethodQueueKey, methodQueue, OBJC_ASSOCIATION_RETAIN);

Expand Down Expand Up @@ -946,7 +943,7 @@ - (void)installJSBindings:(facebook::jsi::Runtime &)runtime
* Additionally, if a TurboModule with the name `name` isn't found, then we
* trigger an assertion failure.
*/
auto turboModule = [self provideTurboModule:moduleName withRuntime:runtime];
auto turboModule = [self provideTurboModule:moduleName runtime:runtime];

if (moduleWasNotInitialized && [self moduleIsInitialized:moduleName]) {
[self->_bridge.performanceLogger markStopForTag:RCTPLTurboModuleSetup];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
*/
@interface RCTSampleTurboModule : NSObject <NativeSampleTurboModuleSpec>

- (RCTTurboModuleBindingsInstaller *)createBindingsInstaller;
- (nonnull RCTTurboModuleBindingsInstaller *)createBindingsInstaller;

@end

0 comments on commit f67a9cf

Please sign in to comment.