From 449d8e34380925ecd10af1bd9bb2cce7fba9597f Mon Sep 17 00:00:00 2001 From: Almas Baim Date: Fri, 24 Mar 2023 09:32:48 +0000 Subject: [PATCH] refactor: Remove outdated comments, clean up code (#613) --- .../scenebuilder/app/SceneBuilderApp.java | 34 ++++--------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java index 25439a934..4472a22ac 100644 --- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java +++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Gluon and/or its affiliates. + * Copyright (c) 2016, 2023, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -373,8 +373,7 @@ public void handleLaunch(List files) { setApplicationUncaughtExceptionHandler(); startInBackground("Set up Scene Builder", () -> { - backgroundStartPhase0(); - backgroundStartPhase1(); + backgroundStart(); setUpUserLibrary(showWelcomeDialog); createEmptyDocumentWindow(); }); @@ -843,34 +842,13 @@ private void performUseToolTheme(ToolTheme toolTheme) { private String getToolStylesheet() { return ResourceUtils.getToolStylesheet(toolTheme); } - - /* - * Background startup - * - * To speed SB startup, we create two threads which anticipate some - * initialization tasks and offload the JFX thread: - * - 'Phase 0' thread executes tasks that do not require JFX initialization - * - 'Phase 1' thread executes tasks that requires JFX initialization - * - * Tasks executed here must be carefully chosen: - * 1) they must be thread-safe - * 2) they should be order-safe : whether they are executed in background - * or by the JFX thread should make no difference. - * - * Currently we simply anticipate creation of big singleton instances - * (like Metadata, Preferences...) - */ - - private void backgroundStartPhase0() { - assert Platform.isFxApplicationThread() == false; // Warning + /** + * This runs in a background thread to speed up SB startup. + */ + private void backgroundStart() { PreferencesController.getSingleton(); Metadata.getMetadata(); - } - - private void backgroundStartPhase1() { - assert Platform.isFxApplicationThread() == false; // Warning - BuiltinLibrary.getLibrary(); if (EditorPlatform.IS_MAC) { MenuBarController.getSystemMenuBarController();