mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 01:40:08 +00:00
Fix class pair register on reload
Summary: public It was possible after reload to detach from the new instance, removing the markers. Reviewed By: jspahrsummers Differential Revision: D2696208 fb-gh-sync-id: ad8f5d449f51c7c74a20ae7c0cafc4fc786ea390
This commit is contained in:
parent
977a40ed04
commit
a7e2059c15
@ -48,7 +48,6 @@ NSString *const RCTProfilePrefix = @"rct_profile_";
|
||||
// This is actually a BOOL - but has to be compatible with OSAtomic
|
||||
static volatile uint32_t RCTProfileProfiling;
|
||||
|
||||
static BOOL RCTProfileHookedModules;
|
||||
static NSDictionary *RCTProfileInfo;
|
||||
static NSMutableDictionary *RCTProfileOngoingEvents;
|
||||
static NSTimeInterval RCTProfileStartTime;
|
||||
@ -210,19 +209,21 @@ void RCTProfileHookModules(RCTBridge *bridge)
|
||||
{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-pointer-compare"
|
||||
if (RCTProfileTrampoline == NULL || RCTProfileHookedModules) {
|
||||
if (RCTProfileTrampoline == NULL) {
|
||||
return;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
RCTProfileHookedModules = YES;
|
||||
|
||||
for (RCTModuleData *moduleData in [bridge valueForKey:@"moduleDataByID"]) {
|
||||
[bridge dispatchBlock:^{
|
||||
Class moduleClass = moduleData.moduleClass;
|
||||
Class proxyClass = objc_allocateClassPair(moduleClass, RCTProfileProxyClassName(moduleClass), 0);
|
||||
|
||||
if (!proxyClass) {
|
||||
proxyClass = objc_getClass(RCTProfileProxyClassName(moduleClass));
|
||||
if (proxyClass) {
|
||||
object_setClass(moduleData.instance, proxyClass);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -255,19 +256,12 @@ void RCTProfileHookModules(RCTBridge *bridge)
|
||||
|
||||
void RCTProfileUnhookModules(RCTBridge *bridge)
|
||||
{
|
||||
if (!RCTProfileHookedModules) {
|
||||
return;
|
||||
}
|
||||
|
||||
RCTProfileHookedModules = NO;
|
||||
|
||||
dispatch_group_enter(RCTProfileGetUnhookGroup());
|
||||
|
||||
for (RCTModuleData *moduleData in [bridge valueForKey:@"moduleDataByID"]) {
|
||||
Class proxyClass = object_getClass(moduleData.instance);
|
||||
if (moduleData.moduleClass != proxyClass) {
|
||||
object_setClass(moduleData.instance, moduleData.moduleClass);
|
||||
objc_disposeClassPair(proxyClass);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user