feat:fix iOS memory leak in debugging

This commit is contained in:
pengfei.zhou
2021-03-04 10:02:29 +08:00
committed by osborn
parent b972cce1cd
commit 627f323ae3
14 changed files with 124 additions and 36 deletions

View File

@@ -42,4 +42,21 @@ - (instancetype)initWithWSClient:(DoricWSClient *)wsClient {
- (void)initJSEngine {
self.jsExecutor = [[DoricRemoteJSExecutor alloc] initWithWSClient:self.wsClient];
}
- (void)teardown {
[super teardown];
if ([self.jsExecutor isKindOfClass:DoricRemoteJSExecutor.class]) {
[((DoricRemoteJSExecutor *) (self.jsExecutor)) teardown];
}
}
- (void)ensureRunOnJSThread:(dispatch_block_t)block {
if ([self.jsExecutor isKindOfClass:DoricRemoteJSExecutor.class]
&& ((DoricRemoteJSExecutor *) (self.jsExecutor)).invokingMethod) {
NSThread *thread = [[NSThread alloc] initWithBlock:block];
[thread start];
} else {
[super ensureRunOnJSThread:block];
}
}
@end