Enable perf monitor for CxxBridge

Reviewed By: javache

Differential Revision: D4510939

fbshipit-source-id: f90dc5c97b98ce68cb2c21e5f283790880b032a4
This commit is contained in:
Ciprian Pãtru 2017-02-09 12:33:13 -08:00 committed by Facebook Github Bot
parent a99f6f51a9
commit dcf7f631f4
1 changed files with 17 additions and 22 deletions

View File

@ -142,11 +142,8 @@ RCT_EXPORT_MODULE()
{ {
_bridge = bridge; _bridge = bridge;
// TODO: enable on cxx bridge
if ([_bridge isKindOfClass:[RCTBatchedBridge class]]) {
[_bridge.devMenu addItem:self.devMenuItem]; [_bridge.devMenu addItem:self.devMenuItem];
} }
}
- (void)invalidate - (void)invalidate
{ {
@ -322,8 +319,6 @@ RCT_EXPORT_MODULE()
[_uiDisplayLink addToRunLoop:[NSRunLoop mainRunLoop] [_uiDisplayLink addToRunLoop:[NSRunLoop mainRunLoop]
forMode:NSRunLoopCommonModes]; forMode:NSRunLoopCommonModes];
id<RCTJavaScriptExecutor> executor = [_bridge valueForKey:@"javaScriptExecutor"];
if ([executor isKindOfClass:[RCTJSCExecutor class]]) {
self.container.frame = (CGRect) { self.container.frame = (CGRect) {
self.container.frame.origin, { self.container.frame.origin, {
self.container.frame.size.width + 44, self.container.frame.size.width + 44,
@ -332,13 +327,13 @@ RCT_EXPORT_MODULE()
}; };
[self.container addSubview:self.jsGraph]; [self.container addSubview:self.jsGraph];
[self.container addSubview:self.jsGraphLabel]; [self.container addSubview:self.jsGraphLabel];
[executor executeBlockOnJavaScriptQueue:^{
[_bridge dispatchBlock:^{
self->_jsDisplayLink = [CADisplayLink displayLinkWithTarget:self self->_jsDisplayLink = [CADisplayLink displayLinkWithTarget:self
selector:@selector(threadUpdate:)]; selector:@selector(threadUpdate:)];
[self->_jsDisplayLink addToRunLoop:[NSRunLoop currentRunLoop] [self->_jsDisplayLink addToRunLoop:[NSRunLoop currentRunLoop]
forMode:NSRunLoopCommonModes]; forMode:NSRunLoopCommonModes];
}]; } queue:RCTJSThread];
}
} }
- (void)hide - (void)hide
@ -424,7 +419,7 @@ RCT_EXPORT_MODULE()
static NSRegularExpression *GCRegex; static NSRegularExpression *GCRegex;
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ dispatch_once(&onceToken, ^{
NSString *pattern = @"\\[GC: (Eden|Full)Collection, (?:Skipped copying|Did copy), ([\\d\\.]+) (\\wb), ([\\d.]+) (\\ws)\\]"; NSString *pattern = @"\\[GC: [\\d\\.]+ \\wb => (Eden|Full)Collection, (?:Skipped copying|Did copy), ([\\d\\.]+) \\wb, [\\d.]+ \\ws\\]";
GCRegex = [NSRegularExpression regularExpressionWithPattern:pattern GCRegex = [NSRegularExpression regularExpressionWithPattern:pattern
options:0 options:0
error:nil]; error:nil];