iOS: reorder registry alloc to avoid setEnvironmentVariable abnormal

This commit is contained in:
王劲鹏 2023-03-01 16:28:47 +08:00 committed by osborn
parent 15364618e1
commit f67f0ce75a

View File

@ -69,7 +69,7 @@ @implementation DoricJSEngine
- (instancetype)init {
if (self = [super init]) {
_initialized = NO;
_registry = [[DoricRegistry alloc] initWithJSEngine:self];
_profile = [[DoricPerformanceProfile alloc] initWithName:@"JSEngine"];
if (_registry.globalPerformanceAnchorHook) {
[_profile addAnchorHook:_registry.globalPerformanceAnchorHook];
@ -110,7 +110,10 @@ - (instancetype)init {
@"localeLanguage": [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode] ?: @"",
@"localeCountry": [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] ?: @"",
}.mutableCopy;
_registry = [[DoricRegistry alloc] initWithJSEngine:self];
[self.registry registerMonitor:[DoricDefaultMonitor new]];
[self ensureRunOnJSThread:^() {
[self.profile start:@"Init"];
self.timers = [[NSMutableDictionary alloc] init];