shithub: mycel

Download patch

ref: 85fea0775d72dfef343bca0343be8f4921ac9ce7
parent: a77b6367283f8372a14e8b4b399731fea28c271c
author: Philip Silva <philip.silva@protonmail.com>
date: Thu Dec 17 07:49:29 EST 2020

Caching

--- a/browser/browser.go
+++ b/browser/browser.go
@@ -1117,7 +1117,6 @@
 
 func (h *History) Push(u *url.URL) {
 	h.urls = append(h.urls, u)
-	imageCache = make(map[string]*draw.Image)
 }
 
 func (h *History) Back() {
@@ -1290,6 +1289,13 @@
 }
 
 func (b *Browser) render(buf []byte) {
+	log.Printf("Empty cache...")
+	cache = make(map[string]struct {
+		opossum.ContentType
+		buf []byte
+	})
+	imageCache = make(map[string]*draw.Image)
+
 	b.html = string(buf) // TODO: correctly interpret UTF8
 	b.layoutWebsite()
 
@@ -1302,8 +1308,6 @@
 		}
 	})
 	PrintTree(b.Website.UI)
-	//log.Printf("Empty image cache...")
-	//cache = make(map[string][]byte)
 	log.Printf("Render...")
 	dui.Render()
 	log.Printf("Rendering done")