Skip to content

Commit

Permalink
refactor: Remove outdated comments, clean up code (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlmasB committed Mar 24, 2023
1 parent b878844 commit 449d8e3
Showing 1 changed file with 6 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -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.
*
Expand Down Expand Up @@ -373,8 +373,7 @@ public void handleLaunch(List<String> files) {
setApplicationUncaughtExceptionHandler();

startInBackground("Set up Scene Builder", () -> {
backgroundStartPhase0();
backgroundStartPhase1();
backgroundStart();
setUpUserLibrary(showWelcomeDialog);
createEmptyDocumentWindow();
});
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 449d8e3

Please sign in to comment.