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

@@ -32,6 +32,8 @@ @interface DoricContextDebuggable : NSObject
@property(nonatomic, weak) DoricContext *doricContext;
@property(nonatomic, weak) id <DoricDriverProtocol> nativeDriver;
@property(nonatomic, weak) DoricWSClient *wsClient;
@property(nonatomic, weak) DoricDebugDriver *debugDriver;
@end
@implementation DoricContextDebuggable
@@ -46,10 +48,12 @@ - (instancetype)initWithWSClient:(DoricWSClient *)client context:(DoricContext *
- (void)startDebug {
[self.doricContext setDriver:[[DoricDebugDriver alloc] initWithWSClient:self.wsClient]];
self.debugDriver = self.doricContext.driver;
[self.doricContext reload:self.doricContext.script];
}
- (void)stopDebug:(BOOL)resume {
[self.debugDriver teardown];
self.doricContext.driver = self.nativeDriver;
if (resume) {
[self.doricContext reload:self.doricContext.script];