22#include <proto/timer.h>
23#include <proto/utility.h>
33#include "amiga/hash/xxhash.h"
40static struct Hook ami_font_cache_hook;
48static LONG ami_font_cache_sort(
struct Hook *hook, APTR key1, APTR key2)
50 if(key1 == key2)
return 0;
51 if(key1 < key2)
return -1;
64 if(node == NULL)
return;
70 if(curtime.Seconds > 300)
73 "Freeing font %p not used for %ld seconds",
74 node->skip_node.sn_Key,
77 RemoveSkipNode(skiplist, node->skip_node.sn_Key);
79 }
while((node = nnode));
100 GetSysTime(&curtime);
101 SubTime(&curtime, &fnode->
lastused);
105 "Freeing %s not used for %ld seconds",
110 }
while((node=nnode));
118static void ami_font_cache_del_skiplist(
struct SkipList *skiplist)
120 struct SkipNode *node;
121 struct SkipNode *nnode;
123 node = GetFirstSkipNode(skiplist);
124 if(node == NULL)
return;
127 nnode = GetNextSkipNode(skiplist, node);
130 }
while((node = nnode));
132 DeleteSkipList(skiplist);
143 hash = XXH32(
font, strlen(
font), 0);
155 NSLOG(netsurf, INFO,
"Font cache miss: %s (%lx)", font, hash);
182 node->
dtz_Node.ln_Name = strdup(font);
189 NSLOG(netsurf, INFO,
"Cleaning up font cache");
202 ami_font_cache_hook.h_Entry = (HOOKFUNC)ami_font_cache_sort;
203 ami_font_cache_hook.h_Data = 0;
nserror ami_schedule(int t, void(*callback)(void *p), void *p)
Schedule a callback.
void ami_font_bullet_close(void *nso)
static struct MinList * ami_font_cache_list
void ami_font_cache_fini(void)
struct ami_font_cache_node * ami_font_cache_alloc_entry(const char *font)
void ami_font_cache_insert(struct ami_font_cache_node *nodedata, const char *font)
void ami_font_cache_init(void)
static void ami_font_cache_cleanup(struct MinList *ami_font_cache_list)
struct ami_font_cache_node * ami_font_cache_locate(const char *font)
struct MinList * NewObjList(void)
void FreeObjList(struct MinList *objlist)
void ObjectCallback(struct nsObject *dtzo, void(*callback)(void *nso))
void DelObject(struct nsObject *dtzo)
struct nsObject * AddObject(struct MinList *objlist, ULONG otype)
#define NSLOG(catname, level, logmsg, args...)
struct Node * GetHead(struct List *list)
struct Node * GetSucc(struct Node *node)
Minimal compatibility header for AmigaOS 3.
#define IsMinListEmpty(L)
Interface to utility string handling.
struct OutlineFont * font