From dcf7f631f4a48391eab5a453cb44c0b0de53366d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciprian=20P=C3=A3tru?= Date: Thu, 9 Feb 2017 12:33:13 -0800 Subject: [PATCH] Enable perf monitor for CxxBridge Reviewed By: javache Differential Revision: D4510939 fbshipit-source-id: f90dc5c97b98ce68cb2c21e5f283790880b032a4 --- React/Profiler/RCTPerfMonitor.m | 39 ++++++++++++++------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/React/Profiler/RCTPerfMonitor.m b/React/Profiler/RCTPerfMonitor.m index d1b0ca9d4..f2aaf5c3e 100644 --- a/React/Profiler/RCTPerfMonitor.m +++ b/React/Profiler/RCTPerfMonitor.m @@ -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 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];