[squeak-dev] The Inbox: ShoutCore-mt.37.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Dec 17 10:57:32 UTC 2012
A new version of ShoutCore was added to project The Inbox:
http://source.squeak.org/inbox/ShoutCore-mt.37.mcz
==================== Summary ====================
Name: ShoutCore-mt.37
Author: mt
Time: 17 December 2012, 11:57:32.236 am
UUID: cce8d08d-57b9-8b49-b498-39bf68b2515d
Ancestors: ShoutCore-cwp.36
Fixed background styling. There was a race condition between the UI process and a process that was started at the same priority level just to send #stylerStyledInBackground: to the view. Now, this message is enqueued to the deferred message queue in the UI process to avoid such race conditions.
=============== Diff against ShoutCore-cwp.36 ===============
Item was changed:
Object subclass: #SHTextStyler
+ instanceVariableNames: 'backgroundProcess text monitor view stylingEnabled'
- instanceVariableNames: 'sem backgroundProcess text monitor view stylingEnabled'
classVariableNames: ''
poolDictionaries: ''
category: 'ShoutCore-Styling'!
!SHTextStyler commentStamp: 'tween 8/27/2004 10:54' prior: 0!
I am an Abstract class.
Subclasses of me can create formatted, coloured, and styled copies of Text that is given to them.
They may perform their styling asynchronously, in a background process which I create and manage.
My public interface is...
view: aViewOrMorph - set the view that will receive notifications when styling has completed.
format: aText - modifies aText's string
style: aText - modifies the TextAttributes of aText, but does not change the string, then sends #stylerStyled: to the view.
styleInBackgroundProcess: aText - performs style: in a background process, then sends #stylerStylednBackground: to the view.
styledTextFor: aText - answers a formatted and styled copy of aText
unstyledTextFrom: aText - answers a copy of aText with all TextAttributes removed
Subclasses of me should re-implement...
privateFormat: aText - answer a formatted version of aText; the String may be changed
privateStyle: aText - modify the TextAttributes of aText; but do not change the String
!
Item was changed:
----- Method: SHTextStyler>>styleInBackgroundProcess: (in category 'styling') -----
styleInBackgroundProcess: aText
self terminateBackgroundStylingProcess.
stylingEnabled ifTrue:[
text := aText copy.
self monitor critical: [
+ backgroundProcess := [
+ self privateStyle: text.
+ view ifNotNil: [:v |
+ WorldState addDeferredUIMessage: [v stylerStyledInBackground: text]]
+ ] forkAt: Processor userBackgroundPriority]].
- sem := Semaphore new.
- [sem notNil
- ifTrue: [
- sem wait.
- view ifNotNil:[view stylerStyledInBackground: text]]
- ] forkAt: Processor activePriority.
- backgroundProcess :=
- [self privateStyle: text.
- sem signal]
- forkAt: Processor userBackgroundPriority] ]
!
Item was changed:
----- Method: SHTextStyler>>terminateBackgroundStylingProcess (in category 'private') -----
terminateBackgroundStylingProcess
self monitor critical: [
backgroundProcess
ifNotNil: [
backgroundProcess terminate.
+ backgroundProcess := nil]].!
- backgroundProcess := nil].
- sem
- ifNotNil:[
- sem terminateProcess.
- sem := nil].
- ] !
Item was changed:
----- Method: SHTextStyler>>veryDeepInner: (in category 'copying') -----
veryDeepInner: aDeepCopier
super veryDeepInner: aDeepCopier.
+ backgroundProcess := monitor := nil.
- sem := backgroundProcess := monitor := nil.
text := text veryDeepCopyWith: aDeepCopier.
view := view veryDeepCopyWith: aDeepCopier!
More information about the Squeak-dev
mailing list
|