UI: refactored updates in thread / stack view
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 17 Jan 2018 07:03:58 +0000
changeset 55 fd2637e6d153
parent 54 d974a70c70ad
child 56 6c7ed8cc00ea
UI: refactored updates in thread / stack view * Do not reload tree on thread exit event. This slows down things a lot on Windows when debugging Smalltalk/X as threads are created and terminated every now and again. Only do that on stopped event. * Do not reload three on running event - thre tree would be not up to date anyways, no need to bother.
VDBAbstractListApplication.st
VDBStackApplication.st
--- a/VDBAbstractListApplication.st	Wed Jan 17 06:46:47 2018 +0000
+++ b/VDBAbstractListApplication.st	Wed Jan 17 07:03:58 2018 +0000
@@ -238,16 +238,30 @@
 
 !VDBAbstractListApplication methodsFor:'change & update'!
 
+enqueueDelayedUpdate: selector
+    self window sensor pushUserEvent: selector for:self
+
+    "Created: / 17-01-2018 / 06:50:29 / jv"
+!
+
+enqueueDelayedUpdate: selector with: argument
+    self window sensor pushUserEvent: selector for:self  withArgument: argument
+
+    "Created: / 17-01-2018 / 06:50:39 / jv"
+!
+
 enqueueDelayedUpdateInternalList
-    self window sensor pushUserEvent:#delayedUpdateInternalList for:self
+   self enqueueDelayedUpdate: #delayedUpdateInternalList
 
     "Created: / 20-09-2014 / 23:05:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 17-01-2018 / 06:51:55 / jv"
 !
 
 enqueueDelayedUpdateSelection
-    self window sensor pushUserEvent:#delayedUpdateSelection   for:self
+    self enqueueDelayedUpdate: #delayedUpdateSelection
 
     "Created: / 27-02-2015 / 15:35:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 17-01-2018 / 06:52:09 / jv"
 !
 
 update:aspect with:param from:sender
--- a/VDBStackApplication.st	Wed Jan 17 06:46:47 2018 +0000
+++ b/VDBStackApplication.st	Wed Jan 17 07:03:58 2018 +0000
@@ -156,10 +156,12 @@
 
 !VDBStackApplication methodsFor:'change & update'!
 
-enqueueUpdateInternalSelectionAfterThreadStopped: aGDBThread 
-    self window sensor pushUserEvent:#updateInternalSelectionAfterThreadStopped: for:self withArgument: aGDBThread
+enqueueUpdateAfterThreadStopped:aGDBThread 
+    self enqueueDelayedUpdate:#delayedUpdateAfterThreadStopped:
+        with:aGDBThread
 
     "Created: / 22-09-2014 / 23:15:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 17-01-2018 / 06:52:50 / jv"
 !
 
 update:aspect with:param from:sender
@@ -190,24 +192,6 @@
     "Modified: / 21-09-2014 / 23:52:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-updateInternalSelectionAfterThreadStopped: thread
-    "/ It may happen that by te time we get here the thread is running
-    "/ again, so care for this.
-    thread isStopped ifTrue:[
-        | threadP framePs frameP |
-        threadP := self internalListHolder value root 
-                        recursiveDetect:[ :e | e isThreadPresenter and:[ e thread == thread ] ].
-        framePs := threadP children.
-        framePs notEmpty ifTrue:[
-            frameP := threadP children first.
-            self internalSelectionHolder value: frameP
-        ].
-    ].
-
-    "Created: / 22-09-2014 / 23:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 06-07-2017 / 08:56:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 updateSelection
     | internalSelection frame thread group |
 
@@ -237,6 +221,28 @@
 
 !VDBStackApplication methodsFor:'change & update-delayed'!
 
+delayedUpdateAfterThreadStopped:thread 
+    "/ It may happen that by te time we get here the thread is running
+    "/ again, so care for this.
+    
+    thread isStopped ifTrue:[
+        |threadP framePs frameP|
+
+        threadP := self internalListHolder value root 
+                recursiveDetect:[:e | e isThreadPresenter and:[ e thread == thread ] ].
+        framePs := threadP children.
+        framePs notEmpty ifTrue:[
+            frameP := threadP children first.
+            frameP parent expand.
+            self internalSelectionHolder value:frameP
+        ].
+    ].
+
+    "Created: / 22-09-2014 / 23:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 06-07-2017 / 08:56:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 16-01-2018 / 20:22:04 / jv"
+!
+
 delayedUpdateInternalList
     | root  list |
 
@@ -297,9 +303,10 @@
 !VDBStackApplication methodsFor:'event handling'!
 
 onRunningEvent: event
-    self enqueueDelayedUpdateInternalList.
+    internalListView invalidate
 
     "Created: / 30-09-2014 / 00:02:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 17-01-2018 / 06:59:11 / jv"
 !
 
 onStoppedEvent: event
@@ -308,7 +315,7 @@
     self enqueueDelayedUpdateInternalList.
     stoppedThread := event stoppedThread.
     stoppedThread notNil ifTrue:[
-        self enqueueUpdateInternalSelectionAfterThreadStopped:event stoppedThread.
+        self enqueueUpdateAfterThreadStopped:event stoppedThread.
     ].
 
     "Created: / 17-09-2014 / 23:04:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -316,13 +323,6 @@
     "Modified: / 15-01-2018 / 11:51:51 / jv"
 !
 
-onThreadExitedEvent: event
-    self enqueueDelayedUpdateInternalList.
-
-    "Created: / 18-09-2014 / 23:30:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 20-09-2014 / 23:08:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 onThreadGroupExitedEvent: event
     self enqueueDelayedUpdateInternalList.
 
@@ -345,11 +345,11 @@
         when: GDBRunningEvent               send: #onRunningEvent: to: self;
         when: GDBStoppedEvent               send: #onStoppedEvent: to: self;
         when: GDBThreadGroupStartedEvent    send: #onThreadGroupStartedEvent: to: self;
-        when: GDBThreadExitedEvent          send: #onThreadExitedEvent: to: self;
         when: GDBThreadGroupExitedEvent     send: #onThreadGroupExitedEvent: to: self
 
     "Created: / 07-06-2014 / 14:33:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 02-03-2015 / 06:42:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 17-01-2018 / 06:56:46 / jv"
 ! !
 
 !VDBStackApplication class methodsFor:'documentation'!