From 6fc2bfc5c3b853e8aa199ee50db085993179aeac Mon Sep 17 00:00:00 2001 From: FPabl0 Date: Fri, 4 Jun 2021 12:09:49 -0500 Subject: [PATCH] rename CleanTask to Clean and ForceCleanFor to CleanCanvas as suggested in the PR review --- internal/cache/base.go | 10 +++++----- internal/driver/glfw/loop.go | 2 +- internal/driver/glfw/window.go | 2 +- internal/driver/gomobile/driver.go | 2 +- internal/driver/gomobile/window.go | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/cache/base.go b/internal/cache/base.go index 0eaef5b059..040ac9ceb8 100644 --- a/internal/cache/base.go +++ b/internal/cache/base.go @@ -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 } @@ -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 diff --git a/internal/driver/glfw/loop.go b/internal/driver/glfw/loop.go index aebeaf832f..0a7527e22f 100644 --- a/internal/driver/glfw/loop.go +++ b/internal/driver/glfw/loop.go @@ -222,7 +222,7 @@ func (d *gLDriver) startDrawThread() { d.repaintWindow(w) } - cache.CleanTask() + cache.Clean() } } }() diff --git a/internal/driver/glfw/window.go b/internal/driver/glfw/window.go index 2754879c4b..9c6eb46fb7 100644 --- a/internal/driver/glfw/window.go +++ b/internal/driver/glfw/window.go @@ -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 diff --git a/internal/driver/gomobile/driver.go b/internal/driver/gomobile/driver.go index 2a8b927a23..7d9d2bf353 100644 --- a/internal/driver/gomobile/driver.go +++ b/internal/driver/gomobile/driver.go @@ -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() { diff --git a/internal/driver/gomobile/window.go b/internal/driver/gomobile/window.go index 75a91ea517..1ecb1c139a 100644 --- a/internal/driver/gomobile/window.go +++ b/internal/driver/gomobile/window.go @@ -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