From 6996d3f93cd9a375772134a51de80396efed6bb5 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Fri, 16 May 2014 16:30:09 -0400 Subject: [PATCH] Bug 435142 - Duplicate *running events cause UI slowness Change-Id: I4b30e6cd62b7cc822442ddd14c3c1440f6bab376 Signed-off-by: Marc Khouzam Reviewed-on: https://git.eclipse.org/r/26780 Tested-by: Hudson CI Reviewed-by: Mikhail Khodjaiants Reviewed-by: Alvaro Sanchez-Leon --- .../eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java | 8 +++++++- .../src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java index ff3c6a446ad..d7a97edbeea 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java @@ -1529,12 +1529,18 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo return; } + MIThreadRunState threadState = fThreadRunStates.get(e.getDMContext()); + if (threadState != null && threadState.fLatestEvent instanceof IResumedDMEvent) { + // Ignore multiple running events in a row. They will only slow down the UI + // for no added value. + return; + } + if (fRunToLineActiveOperation == null && fStepInToSelectionActiveOperation == null) { // No special case here, i.e. send notification getSession().dispatchEvent(new ResumedEvent(e.getDMContext(), e), getProperties()); } else { // Either RunToLine or StepIntoSelection operations are active - MIThreadRunState threadState = fThreadRunStates.get(e.getDMContext()); if (threadState == null || threadState.fLatestEvent instanceof ISuspendedDMEvent) { // Need to send out Running event notification, only once per operation, then a stop event is expected // at the end of the operation diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java index 1485b45e880..77eaf6f72be 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java @@ -482,13 +482,19 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I * @noreference This method is not intended to be referenced by clients. */ @DsfServiceEventHandler - public void eventDispatched(final MIRunningEvent e) { + public void eventDispatched(MIRunningEvent e) { if (fDisableNextRunningEvent) { fDisableNextRunningEvent = false; // We don't broadcast this running event return; } + if (fLatestEvent instanceof IResumedDMEvent) { + // Ignore multiple running events in a row. They will only slow down the UI + // for no added value. + return; + } + IDMEvent event = null; // Find the container context, which is used in multi-threaded debugging. IContainerDMContext containerDmc = DMContexts.getAncestorOfType(e.getDMContext(), IContainerDMContext.class);