Support start and stopping systrace from repl
Reviewed By: @jspahrsummers Differential Revision: D2512911 fb-gh-sync-id: f5441219f9d7063b3602c55efac9f07407e33f56
This commit is contained in:
parent
e48807abfd
commit
f7065e5c0a
|
@ -889,24 +889,19 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
|||
{
|
||||
RCTAssertMainThread();
|
||||
|
||||
if (![self.bundleURL.scheme isEqualToString:@"http"]) {
|
||||
RCTLogError(@"To run the profiler you must be running from the dev server");
|
||||
return;
|
||||
}
|
||||
|
||||
[_javaScriptExecutor executeBlockOnJavaScriptQueue:^{
|
||||
RCTProfileInit(self);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)stopProfiling
|
||||
- (void)stopProfiling:(void (^)(NSData *))callback
|
||||
{
|
||||
RCTAssertMainThread();
|
||||
|
||||
[_javaScriptExecutor executeBlockOnJavaScriptQueue:^{
|
||||
NSString *log = RCTProfileEnd(self);
|
||||
NSData *logData = [log dataUsingEncoding:NSUTF8StringEncoding];
|
||||
RCTProfileSendResult(self, @"systrace", logData);
|
||||
callback(logData);
|
||||
}];
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
@interface RCTBridge (Profiling)
|
||||
|
||||
- (void)startProfiling;
|
||||
- (void)stopProfiling;
|
||||
- (void)stopProfiling:(void (^)(NSData *))callback;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -520,7 +520,9 @@ RCT_EXPORT_METHOD(reload)
|
|||
if (enabled) {
|
||||
[_bridge startProfiling];
|
||||
} else {
|
||||
[_bridge stopProfiling];
|
||||
[_bridge stopProfiling:^(NSData *logData) {
|
||||
RCTProfileSendResult(_bridge, @"systrace", logData);
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue