diff options
author | Joerg Kubitz | 2021-10-12 09:10:45 +0000 |
---|---|---|
committer | Andrey Loskutov | 2021-10-12 15:03:00 +0000 |
commit | 485d05449115e746767fb9516931c39249d5ecec (patch) | |
tree | ca772a289e8093e9c288d43226381ac901dd3db2 | |
parent | 1f06e8394a6da27b10fcb818fb613fc835546228 (diff) | |
download | eclipse.platform.debug-485d05449115e746767fb9516931c39249d5ecec.tar.gz eclipse.platform.debug-485d05449115e746767fb9516931c39249d5ecec.tar.xz eclipse.platform.debug-485d05449115e746767fb9516931c39249d5ecec.zip |
Bug 576521 - Avoid UI freezes due to slow Debug viewI20211103-0020I20211102-1800I20211102-1020I20211101-1800I20211031-1800I20211030-1800I20211029-1800I20211028-1800I20211027-1800I20211026-1800I20211025-1800I20211024-1800I20211023-1800I20211022-1800I20211022-0920I20211022-0130I20211021-1800I20211020-1800I20211019-1800I20211018-1800I20211017-1800I20211016-1800I20211015-1800I20211014-1800I20211013-1800I20211012-1800
Only proceed maximum 100 model changes of the
Debug view in one batch and then give other
UI tasks a chance to proceed in between.
This should avoid long UI freezes while updating
the JFace tree in case debuggee application generates
many model changes that need to be processed in the Debug view
Change-Id: I0a9ef6764e41f88ace3bae57ed40adaad9a8c368
Signed-off-by: Joerg Kubitz <jkubitz-eclipse@gmx.de>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.debug/+/186381
Tested-by: Platform Bot <platform-bot@eclipse.org>
Reviewed-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java index 4ed94c55a..c00ae9ffe 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java @@ -401,6 +401,9 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon private class DelayedDoModelChangedJob extends WorkbenchJob { + // limit batch size to avoid freezing the UI. + private static final int MAX_BATCH_SIZE = 100; + // queue of submitted deltas to process private final List<Object> fQueue = new ArrayList<>(); private boolean shutdown; @@ -418,8 +421,18 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon if (shutdown || fQueue.isEmpty()) { return Status.OK_STATUS; } - currentBatch = new ArrayList<>(fQueue); - fQueue.clear(); + fQueue.removeIf(o -> { + if (currentBatch.size() < MAX_BATCH_SIZE) { + currentBatch.add(o); + return true; + } + return false; + }); + if (!fQueue.isEmpty()) { + // There is work left. + // Give other UI tasks chance to work instead of freezing UI + schedule(); + } } if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER) { DebugUIPlugin.trace("Delayed batch size: " + currentBatch.size()); //$NON-NLS-1$ |