[squeak-dev] The Inbox: Tools-ct.873.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Aug 9 23:08:10 UTC 2019


A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-ct.873.mcz

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

Name: Tools-ct.873
Author: ct
Time: 10 August 2019, 1:08:06.919412 am
UUID: 2929ef39-906f-2a40-a5b8-f41da1384c2e
Ancestors: Tools-mt.870

Refactor ProcessBrowser & test edge cases

Various shortcuts lead to an error message if no process/context was selected, before loading this commit. Same went for cancelling the messageTally dialog.

=============== Diff against Tools-mt.870 ===============

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].
- 	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 ifNotNil: #explore!
- 	selectedContext explore!

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

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

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

Item was changed:
  ----- Method: ProcessBrowser>>inspectPointers (in category 'process actions') -----
  inspectPointers
  	| tc pointers |
+ 	selectedProcess ifNil: [^ self].
- 	selectedProcess ifNil: [^self].
  	tc := thisContext.
+ 	pointers := PointerFinder
+ 		pointersTo: selectedProcess
+ 		except: { 
+ 			self processList.
+ 			tc.
+ 			self}.
+ 	pointers isEmpty ifTrue: [^ self].
- 	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 ifNotNil: #inspect!
- 	selectedProcess inspect!

Item was changed:
  ----- Method: ProcessBrowser>>inspectReceiver (in category 'stack list') -----
  inspectReceiver
+ 	selectedContext ifNotNil: [
+ 		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])
- 	(secs isNil
- 			or: [secs isZero])
  		ifTrue: [^ self].
  	[ TimeProfileBrowser spyOnProcess: selectedProcess forMilliseconds: secs * 1000 ] forkAt: selectedProcess priority + 1.!

Item was changed:
  ----- Method: ProcessBrowser>>resumeProcess (in category 'process actions') -----
  resumeProcess
+ 	selectedProcess ifNil: [^ self].
- 	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>>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!



More information about the Squeak-dev mailing list