Skip to content

Commit

Permalink
Revert "[ReactNative] Fix crash when reload during profile"
Browse files Browse the repository at this point in the history
  • Loading branch information
natansh committed Jul 8, 2015
1 parent 0ffb2d3 commit f21e79d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 31 deletions.
12 changes: 0 additions & 12 deletions React/Base/RCTBatchedBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,6 @@ - (instancetype)initWithParentBridge:(RCTBridge *)bridge
*/
[self registerModules];

/**
* If currently profiling, hook into the current instance
*/
if (RCTProfileIsProfiling()) {
RCTProfileHookModules(self);
}

/**
* Start the application script
*/
Expand Down Expand Up @@ -371,13 +364,8 @@ - (void)invalidate
}
moduleData.queue = nil;
}

dispatch_group_notify(group, dispatch_get_main_queue(), ^{
[_javaScriptExecutor executeBlockOnJavaScriptQueue:^{
if (RCTProfileIsProfiling()) {
RCTProfileUnhookModules(self);
}

[_jsDisplayLink invalidate];
_jsDisplayLink = nil;

Expand Down
13 changes: 0 additions & 13 deletions React/Base/RCTProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,6 @@ RCT_EXTERN void RCTProfileImmediateEvent(NSString *, NSTimeInterval , NSString *
RCTProfileEndEvent([NSString stringWithFormat:@"[%@ %@]", NSStringFromClass([self class]), NSStringFromSelector(_cmd)], category, arguments); \
}

/**
* Hook into a bridge instance to log all bridge module's method calls
*/
RCT_EXTERN void RCTProfileHookModules(RCTBridge *);

/**
* Unhook from a given bridge instance's modules
*/
RCT_EXTERN void RCTProfileUnhookModules(RCTBridge *);

#else

#define RCTProfileBeginFlowEvent()
Expand All @@ -135,7 +125,4 @@ RCT_EXTERN void RCTProfileUnhookModules(RCTBridge *);

#define RCTProfileBlock(block, ...) block

#define RCTProfileHookModules(...)
#define RCTProfileUnhookModules(...)

#endif
8 changes: 3 additions & 5 deletions React/Base/RCTProfile.m
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,14 @@ static IMP RCTProfileMsgForward(NSObject *self, SEL selector)
return imp;
}

void RCTProfileHookModules(RCTBridge *bridge)
static void RCTProfileHookModules(RCTBridge *);
static void RCTProfileHookModules(RCTBridge *bridge)
{
for (RCTModuleData *moduleData in [bridge valueForKey:@"_modules"]) {
[moduleData dispatchBlock:^{
Class moduleClass = moduleData.cls;
Class proxyClass = objc_allocateClassPair(moduleClass, RCTProfileProxyClassName(moduleClass), 0);

if (!proxyClass) {
return;
}

unsigned int methodCount;
Method *methods = class_copyMethodList(moduleClass, &methodCount);
for (NSUInteger i = 0; i < methodCount; i++) {
Expand Down Expand Up @@ -188,6 +185,7 @@ void RCTProfileHookModules(RCTBridge *bridge)
}
}

void RCTProfileUnhookModules(RCTBridge *);
void RCTProfileUnhookModules(RCTBridge *bridge)
{
for (RCTModuleData *moduleData in [bridge valueForKey:@"_modules"]) {
Expand Down
2 changes: 1 addition & 1 deletion React/Views/RCTNavigator.m
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ - (void)dispatchFakeScrollEvent
*/
- (UIView *)reactSuperview
{
RCTAssert(!_bridge.isValid || self.superview != nil, @"put reactNavSuperviewLink back");
RCTAssert(self.superview != nil, @"put reactNavSuperviewLink back");
return self.superview ? self.superview : self.reactNavSuperviewLink;
}

Expand Down

0 comments on commit f21e79d

Please sign in to comment.