Skip to content

Commit

Permalink
sandbox: document overridden constructors with mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
LinqLover committed Jan 2, 2025
1 parent c87d62f commit 97039e7
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ allocateOrRecycleBuffer: initialSize
"Try to recycly a buffer. If this is not possibly, create a new one."
| buffer |
thisContext isSandboxContext ifTrue:
[^ BalloonBuffer new: initialSize].
["avoid mutex, don't recycle"
^ BalloonBuffer new: initialSize].
CacheProtect critical:[
buffer := BufferCache at: 1.
BufferCache at: 1 put: nil.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ recycleBuffer: balloonBuffer
"Try to keep the buffer for later drawing operations."

thisContext isSandboxContext ifTrue:
[^ self].
["avoid mutex, don't recycle"
^ self].
CacheProtect critical:[ | buffer |
buffer := BufferCache at: 1.
(buffer isNil or:[buffer size < balloonBuffer size] )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"allocateOrRecycleBuffer:" : "ct 12/29/2024 04:08",
"recycleBuffer:" : "ct 12/29/2024 04:10" },
"allocateOrRecycleBuffer:" : "ct 1/2/2025 23:38",
"recycleBuffer:" : "ct 1/2/2025 23:38" },
"instance" : {
} }
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ forMethod: aMethod "<CompiledMethod>"
Answer an existing instance from the cache if it exists, cacheing a new one if required."

thisContext isSandboxContext ifTrue:
[^ self sandboxedForMethod: aMethod].
["avoid mutex, don't use cache"
^ self sandboxedForMethod: aMethod].
^self protected: [
MapCache
at: aMethod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"forMethod:" : "ct 12/29/2024 03:25",
"forMethod:" : "ct 1/2/2025 23:39",
"sandboxedForMethod:" : "ct 1/2/2025 22:58" },
"instance" : {
} }
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ new

| newProcess |
thisContext isSandboxContext ifTrue:
[^ self sandboxedNew].
["avoid mutex, don't populate cache"
^ self sandboxedNew].
newProcess := super new.
AllProcessesLock critical: [AllProcesses add: newProcess].
^ newProcess
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"new" : "ct 1/2/2025 04:04",
"new" : "ct 1/2/2025 23:39",
"sandboxedNew" : "ct 1/2/2025 23:09" },
"instance" : {
} }

0 comments on commit 97039e7

Please sign in to comment.