The Trunk: Tools-ct.915.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Tools-ct.915.mcz

commits-2
Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-ct.915.mcz

==================== Summary ====================

Name: Tools-ct.915
Author: ct
Time: 15 November 2019, 5:30:02.890005 pm
UUID: 326d55bd-8463-7e43-a517-e934932fb3a9
Ancestors: Tools-mt.914

Refactor ProcessBrowser nil checks again and move them into #stackListKey:from:. Also, use #browseMethod: in #browseContext to ensure the right version is browsed

Thanks to Marcel for the review!

=============== Diff against Tools-mt.914 ===============

Item was changed:
  ----- Method: ProcessBrowser>>browseContext (in category 'stack list') -----
  browseContext
+ ToolSet browseMethod: selectedContext method!
- selectedContext
- ifNil: [^ self].
- ToolSet browse: self selectedClass selector: self selectedSelector!

Item was changed:
  ----- Method: ProcessBrowser>>changePriority (in category 'process actions') -----
  changePriority
  | str newPriority nameAndRules |
- selectedProcess ifNil: [^ self].
  nameAndRules := self nameAndRulesForSelectedProcess.
  nameAndRules third
  ifFalse: [self inform: 'Nope, won''t change priority of ' , nameAndRules first.
  ^ self].
  str := UIManager default
  request: 'New priority'
   initialAnswer: selectedProcess priority asString.
  newPriority := str asNumber asInteger.
  newPriority
  ifNil: [^ self].
  (newPriority < 1
  or: [newPriority > Processor highestPriority])
  ifTrue: [self inform: 'Bad priority'.
  ^ self].
  self class setProcess: selectedProcess toPriority: newPriority.
  self updateProcessList!

Item was changed:
  ----- Method: ProcessBrowser>>chasePointers (in category 'process actions') -----
  chasePointers
  | saved |
- selectedProcess ifNil: [^ self].
  saved := selectedProcess.
  [selectedProcess := nil.
  (Smalltalk includesKey: #PointerFinder)
  ifTrue: [PointerFinder on: saved]
  ifFalse: [self inspectPointers]]
  ensure: [selectedProcess := saved]!

Item was changed:
  ----- Method: ProcessBrowser>>debugProcess (in category 'process actions') -----
  debugProcess
  | nameAndRules |
- selectedProcess ifNil: [^ self].
  nameAndRules := self nameAndRulesForSelectedProcess.
  nameAndRules third
  ifFalse: [self inform: 'Nope, won''t debug ' , nameAndRules first.
  ^ self].
  self class debugProcess: selectedProcess.!

Item was changed:
  ----- Method: ProcessBrowser>>exploreContext (in category 'stack list') -----
  exploreContext
+ selectedContext explore!
- selectedContext ifNotNil: #explore!

Item was changed:
  ----- Method: ProcessBrowser>>exploreProcess (in category 'process list') -----
  exploreProcess
+ selectedProcess explore!
- selectedProcess ifNotNil: #explore!

Item was changed:
  ----- Method: ProcessBrowser>>exploreReceiver (in category 'stack list') -----
  exploreReceiver
+ selectedContext receiver explore!
- selectedContext ifNotNil: [
- selectedContext receiver explore]!

Item was changed:
  ----- Method: ProcessBrowser>>inspectContext (in category 'stack list') -----
  inspectContext
+ selectedContext inspect!
- selectedContext ifNotNil: #inspect!

Item was changed:
  ----- Method: ProcessBrowser>>inspectPointers (in category 'process actions') -----
  inspectPointers
  | tc pointers |
- selectedProcess ifNil: [^ self].
  tc := thisContext.
  pointers := PointerFinder
  pointersTo: selectedProcess
  except: {
  self processList.
  tc.
  self}.
  pointers isEmpty ifTrue: [^ self].
  OrderedCollectionInspector
  openOn: pointers
  withEvalPane: false
  withLabel: 'Objects pointing to ' , selectedProcess browserPrintString!

Item was changed:
  ----- Method: ProcessBrowser>>inspectProcess (in category 'process list') -----
  inspectProcess
+ selectedProcess inspect!
- selectedProcess ifNotNil: #inspect!

Item was changed:
  ----- Method: ProcessBrowser>>inspectReceiver (in category 'stack list') -----
  inspectReceiver
+ selectedContext receiver inspect!
- selectedContext ifNotNil: [
- selectedContext receiver inspect]!

Item was changed:
  ----- Method: ProcessBrowser>>messageTally (in category 'stack list') -----
  messageTally
  | secString secs |
- selectedProcess ifNil: [^ self].
  secString := UIManager default request: 'Profile for how many seconds?' initialAnswer: '4'.
  secString isEmptyOrNil ifTrue: [^ self].
  secs := secString asNumber asInteger.
  (secs isNil or: [secs isZero])
  ifTrue: [^ self].
  [ TimeProfileBrowser spyOnProcess: selectedProcess forMilliseconds: secs * 1000 ] forkAt: selectedProcess priority + 1.!

Item was changed:
  ----- Method: ProcessBrowser>>processListKey:from: (in category 'process list') -----
+ processListKey: aKey from: aView
+
+ aKey
+ caseOf: {
+ [$f] -> [^ self findContext].
+ [$g] -> [^ self nextContext].
+ [$a] -> [^ self toggleAutoUpdate].
+ [$u] -> [^ self updateProcessList] }
+ otherwise: [].
+ selectedProcess ifNil: [^ self changed: #flash].
+ ^ aKey
+ caseOf: {
+ [$i] -> [self inspectProcess].
+ [$I] -> [self exploreProcess].
+ [$c] -> [self chasePointers].
+ [$P] -> [self inspectPointers].
+ [$t] -> [self terminateProcess].
+ [$r] -> [self resumeProcess].
+ [$s] -> [self suspendProcess].
+ [$d] -> [self debugProcess].
+ [$p] -> [self changePriority].
+ [$m] -> [self messageTally].
+ [$S] -> [self signalSemaphore].
+ [$k] -> [self moreStack]}
+ otherwise: [self arrowKey: aKey from: aView]!
- processListKey: aKey from: aView
- ^ aKey caseOf: {
- [$i] -> [self inspectProcess].
- [$I] -> [self exploreProcess].
- [$c] -> [self chasePointers].
- [$P] -> [self inspectPointers].
- [$t] -> [self terminateProcess].
- [$r] -> [self resumeProcess].
- [$s] -> [self suspendProcess].
- [$d] -> [self debugProcess].
- [$p] -> [self changePriority].
- [$m] -> [self messageTally].
- [$f] -> [self findContext].
- [$g] -> [self nextContext].
- [$a] -> [self toggleAutoUpdate].
- [$u] -> [self updateProcessList].
- [$S] -> [self signalSemaphore].
- [$k] -> [self moreStack]}
- otherwise: [self arrowKey: aKey from: aView]!

Item was changed:
  ----- Method: ProcessBrowser>>resumeProcess (in category 'process actions') -----
  resumeProcess
- selectedProcess ifNil: [^ self].
  self class resumeProcess: selectedProcess.
  self updateProcessList!

Item was changed:
  ----- Method: ProcessBrowser>>signalSemaphore (in category 'process actions') -----
  signalSemaphore
- selectedProcess ifNil: [^ self].
  (selectedProcess suspendingList isKindOf: Semaphore)
  ifFalse: [^ self].
  [selectedProcess suspendingList signal] fork.
  (Delay forMilliseconds: 300) wait.
  "Hate to make the UI wait, but it's convenient..."
  self updateProcessList!

Item was changed:
  ----- Method: ProcessBrowser>>stackListKey:from: (in category 'views') -----
+ stackListKey: aKey from: aView
+
+ selectedContext ifNil: [^ self changed: #flash].
+ ^ aKey
+ caseOf: {
+ [$c] -> [self inspectContext].
+ [$C] -> [self exploreContext].
+ [$i] -> [self inspectReceiver].
+ [$I] -> [self exploreReceiver].
+ [$b] -> [self browseContext]}
+ otherwise: [self arrowKey: aKey from: aView]!
- stackListKey: aKey from: aView
- ^ aKey caseOf: {
- [$c] -> [self inspectContext].
- [$C] -> [self exploreContext].
- [$i] -> [self inspectReceiver].
- [$I] -> [self exploreReceiver].
- [$b] -> [self browseContext]}
- otherwise: [self arrowKey: aKey from: aView]!

Item was changed:
  ----- Method: ProcessBrowser>>suspendProcess (in category 'process actions') -----
  suspendProcess
  | nameAndRules |
- selectedProcess ifNil: [^ self].
  selectedProcess isSuspended
  ifTrue: [^ self].
  nameAndRules := self nameAndRulesForSelectedProcess.
  nameAndRules second
  ifFalse: [self inform: 'Nope, won''t suspend ' , nameAndRules first.
  ^ self].
  self class suspendProcess: selectedProcess.
  self updateProcessList!

Item was changed:
  ----- Method: ProcessBrowser>>terminateProcess (in category 'process actions') -----
  terminateProcess
  | nameAndRules |
- selectedProcess ifNil: [^ self].
  nameAndRules := self nameAndRulesForSelectedProcess.
  nameAndRules second
  ifFalse: [self inform: 'Nope, won''t kill ' , nameAndRules first.
  ^ self].
  self class terminateProcess: selectedProcess.
  self updateProcessList!