Skip to content

Commit

Permalink
cleanup RCTDidSetupModuleNotification (#38543)
Browse files Browse the repository at this point in the history
Summary:
Changelog: [iOS][Breaking]

no one is observing this, delete

Pull Request resolved: #38543

Reviewed By: cipolleschi

Differential Revision: D47620724

Pulled By: philIip

fbshipit-source-id: 9e8932b6bee25497770d8a7600940178b746857e
  • Loading branch information
philIip authored and facebook-github-bot committed Jul 23, 2023
1 parent 659ecd4 commit 2b93491
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 57 deletions.
19 changes: 0 additions & 19 deletions packages/react-native/React/Base/RCTConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,6 @@ RCT_EXTERN NSString *const RCTJavaScriptDidFailToLoadNotification;
*/
RCT_EXTERN NSString *const RCTDidInitializeModuleNotification;

/**
* This notification fires each time a module is setup after it is initialized. The
* `RCTDidSetupModuleNotificationModuleNameKey` key will contain a reference to the module name and
* `RCTDidSetupModuleNotificationSetupTimeKey` will contain the setup time in ms.
*/
RCT_EXTERN NSString *const RCTDidSetupModuleNotification;

/**
* Key for the module name (NSString) in the
* RCTDidSetupModuleNotification userInfo dictionary.
*/
RCT_EXTERN NSString *const RCTDidSetupModuleNotificationModuleNameKey;

/**
* Key for the setup time (NSNumber) in the
* RCTDidSetupModuleNotification userInfo dictionary.
*/
RCT_EXTERN NSString *const RCTDidSetupModuleNotificationSetupTimeKey;

/*
* W3C Pointer Events
*/
Expand Down
3 changes: 0 additions & 3 deletions packages/react-native/React/Base/RCTConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
NSString *const RCTJavaScriptWillStartLoadingNotification = @"RCTJavaScriptWillStartLoadingNotification";

NSString *const RCTDidInitializeModuleNotification = @"RCTDidInitializeModuleNotification";
NSString *const RCTDidSetupModuleNotification = @"RCTDidSetupModuleNotification";
NSString *const RCTDidSetupModuleNotificationModuleNameKey = @"moduleName";
NSString *const RCTDidSetupModuleNotificationSetupTimeKey = @"setupTime";

/*
* W3C Pointer Events
Expand Down
15 changes: 0 additions & 15 deletions packages/react-native/React/CxxBridge/RCTCxxBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,6 @@ int32_t getUniqueId()

}

static void notifyAboutModuleSetup(RCTPerformanceLogger *performanceLogger, const char *tag)
{
NSString *moduleName = [[NSString alloc] initWithUTF8String:tag];
if (moduleName) {
int64_t setupTime = [performanceLogger durationForTag:RCTPLNativeModuleSetup];
[[NSNotificationCenter defaultCenter] postNotificationName:RCTDidSetupModuleNotification
object:nil
userInfo:@{
RCTDidSetupModuleNotificationModuleNameKey : moduleName,
RCTDidSetupModuleNotificationSetupTimeKey : @(setupTime)
}];
}
}

static void mapReactMarkerToPerformanceLogger(
const ReactMarker::ReactMarkerId markerId,
RCTPerformanceLogger *performanceLogger,
Expand Down Expand Up @@ -158,7 +144,6 @@ static void mapReactMarkerToPerformanceLogger(
break;
case ReactMarker::NATIVE_MODULE_SETUP_STOP:
[performanceLogger markStopForTag:RCTPLNativeModuleSetup];
notifyAboutModuleSetup(performanceLogger, tag);
break;
// Not needed in bridge mode.
case ReactMarker::REACT_INSTANCE_INIT_START:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,20 +278,6 @@ - (instancetype)initWithBridgeProxy:(RCTBridgeProxy *)bridgeProxy
jsInvoker:jsInvoker];
}

- (void)notifyAboutTurboModuleSetup:(const char *)name
{
NSString *moduleName = [[NSString alloc] initWithUTF8String:name];
if (moduleName) {
int64_t setupTime = [self->_bridge.performanceLogger durationForTag:RCTPLTurboModuleSetup];
[[NSNotificationCenter defaultCenter] postNotificationName:RCTDidSetupModuleNotification
object:nil
userInfo:@{
RCTDidSetupModuleNotificationModuleNameKey : moduleName,
RCTDidSetupModuleNotificationSetupTimeKey : @(setupTime)
}];
}
}

/**
* Given a name for a TurboModule, return a C++ object which is the instance
* of that TurboModule C++ class. This class wraps the TurboModule's ObjC instance.
Expand Down Expand Up @@ -919,7 +905,6 @@ - (void)installJSBindings:(facebook::jsi::Runtime &)runtime

if (moduleWasNotInitialized && [self moduleIsInitialized:moduleName]) {
[self->_bridge.performanceLogger markStopForTag:RCTPLTurboModuleSetup];
[self notifyAboutTurboModuleSetup:moduleName];
}

if (turboModule) {
Expand All @@ -935,7 +920,6 @@ - (void)installJSBindings:(facebook::jsi::Runtime &)runtime
auto moduleName = name.c_str();

TurboModulePerfLogger::moduleJSRequireBeginningStart(moduleName);
auto moduleWasNotInitialized = ![self moduleIsInitialized:moduleName];

/**
* By default, all TurboModules are long-lived.
Expand All @@ -944,10 +928,6 @@ - (void)installJSBindings:(facebook::jsi::Runtime &)runtime
*/
auto turboModule = [self provideLegacyModule:moduleName];

if (moduleWasNotInitialized && [self moduleIsInitialized:moduleName]) {
[self notifyAboutTurboModuleSetup:moduleName];
}

if (turboModule) {
TurboModulePerfLogger::moduleJSRequireEndingEnd(moduleName);
} else {
Expand Down

0 comments on commit 2b93491

Please sign in to comment.