Ticket #24677: startup-performance.diff

File startup-performance.diff, 2.1 KB (added by dnet, 18 hours ago)

the actual patch I would like to submit

  • src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java

     
    284284            .setOptional(true)
    285285            .getResourceAsync(result -> {
    286286                if (result != null) {
     287                    // Pre-render off EDT to avoid flooding the event queue with expensive SVG rendering
     288                    ImageIcon small = result.getImageIcon(ImageProvider.ImageSizes.SMALLICON.getImageDimension());
     289                    ImageIcon large = result.getImageIcon(ImageProvider.ImageSizes.LARGEICON.getImageDimension());
    287290                    GuiHelper.runInEDT(() -> {
    288291                        try {
    289                             result.attachImageIcon(this, true);
     292                            putValue(Action.SMALL_ICON, small);
     293                            putValue(Action.LARGE_ICON_KEY, large);
     294                            putValue("ImageResource", result);
    290295                        } catch (IllegalArgumentException e) {
    291296                            Logging.warn(toString() + ": " + PRESET_ICON_ERROR_MSG_PREFIX + iconName);
    292297                            Logging.warn(e);
  • src/org/openstreetmap/josm/tools/ImageProvider.java

     
    724724     * @since 13252
    725725     */
    726726    public CompletableFuture<Void> getResourceAsync(Consumer<? super ImageResource> action) {
    727         return isRemote()
    728                 ? CompletableFuture.supplyAsync(this::getResource, IMAGE_FETCHER).thenAcceptAsync(action, IMAGE_FETCHER)
    729                 : CompletableFuture.completedFuture(getResource()).thenAccept(action);
     727        return CompletableFuture.supplyAsync(this::getResource, IMAGE_FETCHER).thenAcceptAsync(action, IMAGE_FETCHER);
    730728    }
    731729
    732730    /**