Skip to content

Commit

Permalink
rename CleanTask to Clean and ForceCleanFor to CleanCanvas as suggest…
Browse files Browse the repository at this point in the history
…ed in the PR review
  • Loading branch information
fpabl0 committed Jun 4, 2021
1 parent 8764345 commit 6fc2bfc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions internal/cache/base.go
Expand Up @@ -24,10 +24,10 @@ func init() {
}
}

// CleanTask run cache clean task, it should be called on paint events.
func CleanTask() {
// Clean run cache clean task, it should be called on paint events.
func Clean() {
now := time.Now()
// do not run clean task so fast
// do not run clean task too fast
if now.Sub(lastClean) < 10*time.Second {
return
}
Expand All @@ -51,9 +51,9 @@ func CleanTask() {
lastClean = time.Now()
}

// ForceCleanFor forces a complete remove of all the objects that belong to the specified
// CleanCanvas performs a complete remove of all the objects that belong to the specified
// canvas. Usually used to free all objects from a closing windows.
func ForceCleanFor(canvas fyne.Canvas) {
func CleanCanvas(canvas fyne.Canvas) {
deletingObjs := make([]fyne.CanvasObject, 0, 50)

// find all objects that belong to the specified canvas
Expand Down
2 changes: 1 addition & 1 deletion internal/driver/glfw/loop.go
Expand Up @@ -222,7 +222,7 @@ func (d *gLDriver) startDrawThread() {

d.repaintWindow(w)
}
cache.CleanTask()
cache.Clean()
}
}
}()
Expand Down
2 changes: 1 addition & 1 deletion internal/driver/glfw/window.go
Expand Up @@ -450,7 +450,7 @@ func (w *window) Close() {

// remove all canvas objects from the cache
w.QueueEvent(func() {
cache.ForceCleanFor(w.canvas)
cache.CleanCanvas(w.canvas)
})

// trigger callbacks
Expand Down
2 changes: 1 addition & 1 deletion internal/driver/gomobile/driver.go
Expand Up @@ -262,7 +262,7 @@ func (d *mobileDriver) handlePaint(e paint.Event, w fyne.Window) {
d.paintWindow(w, newSize)
d.app.Publish()
}
cache.CleanTask()
cache.Clean()
}

func (d *mobileDriver) onStart() {
Expand Down
2 changes: 1 addition & 1 deletion internal/driver/gomobile/window.go
Expand Up @@ -171,7 +171,7 @@ func (w *window) Close() {

// remove all canvas objects from the cache
w.QueueEvent(func() {
cache.ForceCleanFor(w.canvas)
cache.CleanCanvas(w.canvas)
})

// Call this in a go routine, because this function could be called
Expand Down

0 comments on commit 6fc2bfc

Please sign in to comment.