From 5c4bbe2fa5243c4f0a619f0232881d72f32fe182 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Thu, 8 Jul 2021 12:46:15 +0800 Subject: [PATCH] feat:fix cannot record onDestroy --- .../doric/src/main/java/pub/doric/DoricNativeDriver.java | 2 +- doric-iOS/Pod/Classes/DoricNativeDriver.m | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doric-android/doric/src/main/java/pub/doric/DoricNativeDriver.java b/doric-android/doric/src/main/java/pub/doric/DoricNativeDriver.java index a128cde7..14602f49 100644 --- a/doric-android/doric/src/main/java/pub/doric/DoricNativeDriver.java +++ b/doric-android/doric/src/main/java/pub/doric/DoricNativeDriver.java @@ -146,7 +146,7 @@ public class DoricNativeDriver implements IDoricDriver { if (doricContext != null) { return doricContext.getPerformanceProfile(); } - return new DoricPerformanceProfile("Empty"); + return new DoricPerformanceProfile(contextId); } @Override diff --git a/doric-iOS/Pod/Classes/DoricNativeDriver.m b/doric-iOS/Pod/Classes/DoricNativeDriver.m index 3099fb5e..f4c0ef70 100644 --- a/doric-iOS/Pod/Classes/DoricNativeDriver.m +++ b/doric-iOS/Pod/Classes/DoricNativeDriver.m @@ -170,7 +170,8 @@ - (DoricAsyncResult *)invokeContextEntity:(NSString *)contextId method:(NSString - (DoricAsyncResult *)createContext:(NSString *)contextId script:(NSString *)script source:(NSString *)source { DoricAsyncResult *ret = [[DoricAsyncResult alloc] init]; - DoricPerformanceProfile *performanceProfile = [DoricContextManager.instance getContext:contextId].performanceProfile; + DoricPerformanceProfile *performanceProfile = [DoricContextManager.instance getContext:contextId].performanceProfile + ?: [[DoricPerformanceProfile alloc] initWithName:contextId]; [performanceProfile prepare:@"Create"]; __weak typeof(self) _self = self; [self.jsExecutor ensureRunOnJSThread:^{ @@ -191,7 +192,8 @@ - (DoricAsyncResult *)createContext:(NSString *)contextId script:(NSString *)scr - (DoricAsyncResult *)destroyContext:(NSString *)contextId { DoricAsyncResult *ret = [[DoricAsyncResult alloc] init]; - DoricPerformanceProfile *performanceProfile = [DoricContextManager.instance getContext:contextId].performanceProfile; + DoricPerformanceProfile *performanceProfile = [DoricContextManager.instance getContext:contextId].performanceProfile + ?: [[DoricPerformanceProfile alloc] initWithName:contextId]; [performanceProfile prepare:@"Destroy"]; __weak typeof(self) _self = self; [self.jsExecutor ensureRunOnJSThread:^{