Add option to start sampling profiler on app launch

Reviewed By: mhorowitz

Differential Revision: D4415989

fbshipit-source-id: 30704c2b618656cb7cc0ccdf87dec315b30b62f3
This commit is contained in:
Pieter De Baets
2017-01-25 14:28:02 -08:00
committed by Facebook Github Bot
parent 5bb19a5bf5
commit a407ff94ee
5 changed files with 23 additions and 4 deletions

View File

@@ -338,7 +338,9 @@ static NSThread *newJavaScriptThread(void)
contextRef = context.JSGlobalContextRef;
} else {
if (self->_useCustomJSCLibrary) {
JSC_configureJSCForIOS(true);
JSC_configureJSCForIOS(true, RCTJSONStringify(@{
@"StartSamplingProfilerOnInit": @(self->_bridge.devMenu.startSamplingProfilerOnLaunch)
}, NULL).UTF8String);
}
contextRef = JSC_JSGlobalContextCreateInGroup(self->_useCustomJSCLibrary, nullptr, nullptr);
context = [JSC_JSContext(contextRef) contextWithJSGlobalContextRef:contextRef];
@@ -1028,7 +1030,7 @@ static NSData *loadRAMBundle(NSURL *sourceURL, NSError **error, RandomAccessBund
- (void)_createContext
{
if (_useCustomJSCLibrary) {
JSC_configureJSCForIOS(true);
JSC_configureJSCForIOS(true, "{}");
}
JSGlobalContextRef ctx = JSC_JSGlobalContextCreateInGroup(_useCustomJSCLibrary, nullptr, nullptr);
_context = [JSC_JSContext(ctx) contextWithJSGlobalContextRef:ctx];