The Trunk: Collections-ul.321.mcz

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

The Trunk: Collections-ul.321.mcz

commits-2
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.321.mcz

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

Name: Collections-ul.321
Author: ul
Time: 26 February 2010, 3:01:22.27 pm
UUID: 7b829734-4ff6-8941-8eeb-24c08d0d95ec
Ancestors: Collections-nice.320

- add support for multiple finalizers per object to WeakRegistry

=============== Diff against Collections-nice.320 ===============

Item was changed:
  ----- Method: WeakRegistry>>add: (in category 'adding') -----
  add: anObject
  "Add anObject to the receiver. Store the object as well as the associated executor."
+
+ ^self add: anObject executor: anObject executor!
- | executor |
- executor := anObject executor.
- self protected:[
- valueDictionary at: anObject put: executor.
- ].
- ^anObject!

Item was changed:
  ----- Method: WeakRegistry>>add:executor: (in category 'adding') -----
  add: anObject executor: anExecutor
  "Add anObject to the receiver. Store the object as well as the associated executor."
+
+ self protected: [
+ (valueDictionary associationAt: anObject ifAbsent: nil)
+ ifNil: [ valueDictionary at: anObject put: anExecutor ]
+ ifNotNil: [ :association |
+ | finalizer |
+ (finalizer := association value) class == ObjectFinalizerCollection
+ ifTrue: [ finalizer add: anExecutor ]
+ ifFalse: [
+ association value: (ObjectFinalizerCollection
+ with: association value
+ with: anExecutor) ] ] ].
- self protected:[
- valueDictionary at: anObject put: anExecutor.
- ].
  ^anObject!

Item was changed:
  ----- Method: WeakRegistry>>postCopy (in category 'copying') -----
  postCopy
 
  self protected: [ "Uses the original accessLock"
  accessLock := Semaphore forMutualExclusion.
  valueDictionary := valueDictionary copy.
+ valueDictionary associationsDo: [ :each |
+ each value class == ObjectFinalizerCollection
+ ifTrue: [ each value: each value copy ] ].
  self installFinalizer ]!