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:^{