Browse Source

feat: KERNEL-10354 bytebuddy / 加解密性能优化 @Harrison

将启动画面整体前移到启动最开始的时候。
减少视觉偏差。
feature/x
Harrison 3 years ago
parent
commit
93a52c73bc
  1. 32
      designer-realize/src/main/java/com/fr/start/MainDesigner.java
  2. 2
      designer-realize/src/main/java/com/fr/start/SplashContext.java
  3. 31
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  4. 8
      designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

32
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -16,6 +16,7 @@ import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIPreviewButton; import com.fr.design.gui.ibutton.UIPreviewButton;
import com.fr.design.gui.ibutton.UISaveForbiddenButton; import com.fr.design.gui.ibutton.UISaveForbiddenButton;
@ -42,6 +43,7 @@ import com.fr.design.module.DesignModuleFactory;
import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.design.monitor.DesignerLifecycleMonitorContext;
import com.fr.design.notification.ui.NotificationCenterPane; import com.fr.design.notification.ui.NotificationCenterPane;
import com.fr.design.share.SharableManager; import com.fr.design.share.SharableManager;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.env.utils.DesignerInteractionHistory; import com.fr.env.utils.DesignerInteractionHistory;
@ -59,6 +61,7 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.lifecycle.FineLifecycleFatalError; import com.fr.stable.lifecycle.FineLifecycleFatalError;
import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLTools;
import com.fr.start.common.SplashCommon;
import com.fr.start.module.StartupArgs; import com.fr.start.module.StartupArgs;
import com.fr.start.server.ServerTray; import com.fr.start.server.ServerTray;
import com.fr.third.org.apache.commons.lang3.time.StopWatch; import com.fr.third.org.apache.commons.lang3.time.StopWatch;
@ -107,6 +110,7 @@ public class MainDesigner extends BaseDesigner {
*/ */
public static void main(String[] args) { public static void main(String[] args) {
showSplash();
DeepLinkManager.getInstance().start(args); DeepLinkManager.getInstance().start(args);
StopWatch watch = new StopWatch(); StopWatch watch = new StopWatch();
watch.start(); watch.start();
@ -137,6 +141,17 @@ public class MainDesigner extends BaseDesigner {
watch.stop(); watch.stop();
} }
private static void showSplash() {
// 快快显示启动画面
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
SplashContext.getInstance().registerSplash(createSplash());
SplashContext.getInstance().show();
}
});
}
/** /**
* 创建新建文件的快捷方式数组 * 创建新建文件的快捷方式数组
* *
@ -529,4 +544,21 @@ public class MainDesigner extends BaseDesigner {
historyCollector.saveXMLFile(); historyCollector.saveXMLFile();
} }
private static SplashStrategy createSplash() {
OemProcessor oemProcessor = OemHandler.findOem();
if (oemProcessor != null) {
SplashStrategy splashStrategy = null;
try {
splashStrategy = oemProcessor.createSplashStrategy();
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (splashStrategy != null) {
return splashStrategy;
}
}
return new SplashCommon();
}
} }

2
designer-realize/src/main/java/com/fr/start/SplashContext.java

@ -36,7 +36,7 @@ public class SplashContext {
private SplashStrategy splashStrategy; private SplashStrategy splashStrategy;
private String moduleId = ""; private String moduleId = Toolkit.i18nText("Fine-Design_Basic_Initializing");
private int loadingIndex = 0; private int loadingIndex = 0;
private String[] loading = new String[]{"..", "....", "......"}; private String[] loading = new String[]{"..", "....", "......"};

31
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -5,13 +5,11 @@ import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.dialog.TipDialog; import com.fr.design.dialog.TipDialog;
import com.fr.design.fun.OemProcessor;
import com.fr.design.fun.impl.GlobalListenerProviderManager; import com.fr.design.fun.impl.GlobalListenerProviderManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector; import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector;
import com.fr.design.mainframe.messagecollect.StartupMessageCollector; import com.fr.design.mainframe.messagecollect.StartupMessageCollector;
import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignerPort; import com.fr.design.utils.DesignerPort;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
@ -26,11 +24,7 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.start.DesignerProcessType; import com.fr.start.DesignerProcessType;
import com.fr.start.OemHandler;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.start.SplashContext;
import com.fr.start.SplashStrategy;
import com.fr.start.common.SplashCommon;
import com.fr.start.server.FineEmbedServer; import com.fr.start.server.FineEmbedServer;
import com.fr.value.NotNullLazyValue; import com.fr.value.NotNullLazyValue;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -100,14 +94,6 @@ public class DesignerStartup extends Activator {
DesignerExiter.getInstance().execute(); DesignerExiter.getInstance().execute();
return; return;
} }
// 快快显示启动画面
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
SplashContext.getInstance().registerSplash(createSplash());
SplashContext.getInstance().show();
}
});
} }
@Override @Override
@ -142,23 +128,6 @@ public class DesignerStartup extends Activator {
StartupMessageCollector.getInstance().recordStartupLog(); StartupMessageCollector.getInstance().recordStartupLog();
} }
private SplashStrategy createSplash() {
OemProcessor oemProcessor = OemHandler.findOem();
if (oemProcessor != null) {
SplashStrategy splashStrategy = null;
try {
splashStrategy = oemProcessor.createSplashStrategy();
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (splashStrategy != null) {
return splashStrategy;
}
}
return new SplashCommon();
}
private void browserDemoIfNeeded() { private void browserDemoIfNeeded() {
if (startupArgsValue.getValue().isDemo()) { if (startupArgsValue.getValue().isDemo()) {

8
designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

@ -2,14 +2,11 @@ package com.fr.start.module;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.event.EventDispatcher;
import com.fr.file.TmpFileUtils; import com.fr.file.TmpFileUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.module.ModuleEvent;
/** /**
* Created by juhaoyu on 2018/1/8. * Created by juhaoyu on 2018/1/8.
@ -21,8 +18,9 @@ public class PreStartActivator extends Activator {
//清空临时文件 //清空临时文件
TmpFileUtils.cleanUpInnerTmpFiles(); TmpFileUtils.cleanUpInnerTmpFiles();
RestartHelper.deleteRecordFilesWhenStart(); RestartHelper.deleteRecordFilesWhenStart();
//初始化 //初始化起始画面放到 SplashContext 里面
EventDispatcher.fire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("Fine-Design_Basic_Initializing")); //EventDispatcher.fire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("Fine-Design_Basic_Initializing"));
// 完成初始化 // 完成初始化
//noinspection ResultOfMethodCallIgnored //noinspection ResultOfMethodCallIgnored
CloudCenter.getInstance(); CloudCenter.getInstance();

Loading…
Cancel
Save