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,10 +142,7 @@ RCT_EXPORT_MODULE()
{
_bridge = bridge;
// TODO: enable on cxx bridge
if ([_bridge isKindOfClass:[RCTBatchedBridge class]]) {
[_bridge.devMenu addItem:self.devMenuItem];
}
[_bridge.devMenu addItem:self.devMenuItem];
}
- (void)invalidate
@ -322,23 +319,21 @@ RCT_EXPORT_MODULE()
[_uiDisplayLink addToRunLoop:[NSRunLoop mainRunLoop]
forMode:NSRunLoopCommonModes];
id<RCTJavaScriptExecutor> executor = [_bridge valueForKey:@"javaScriptExecutor"];
if ([executor isKindOfClass:[RCTJSCExecutor class]]) {
self.container.frame = (CGRect) {
self.container.frame.origin, {
self.container.frame.size.width + 44,
self.container.frame.size.height
}
};
[self.container addSubview:self.jsGraph];
[self.container addSubview:self.jsGraphLabel];
[executor executeBlockOnJavaScriptQueue:^{
self->_jsDisplayLink = [CADisplayLink displayLinkWithTarget:self
selector:@selector(threadUpdate:)];
[self->_jsDisplayLink addToRunLoop:[NSRunLoop currentRunLoop]
forMode:NSRunLoopCommonModes];
}];
}
self.container.frame = (CGRect) {
self.container.frame.origin, {
self.container.frame.size.width + 44,
self.container.frame.size.height
}
};
[self.container addSubview:self.jsGraph];
[self.container addSubview:self.jsGraphLabel];
[_bridge dispatchBlock:^{
self->_jsDisplayLink = [CADisplayLink displayLinkWithTarget:self
selector:@selector(threadUpdate:)];
[self->_jsDisplayLink addToRunLoop:[NSRunLoop currentRunLoop]
forMode:NSRunLoopCommonModes];
} queue:RCTJSThread];
}
- (void)hide
@ -424,7 +419,7 @@ RCT_EXPORT_MODULE()
static NSRegularExpression *GCRegex;
static dispatch_once_t 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
options:0
error:nil];