diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-12-10 12:40:09 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-12-22 12:44:56 +0400 |
commit | 78698a2ecf9d17340ce337ecf73ce6e355299f89 (patch) | |
tree | b25d5e7a6b53a3c51733b5319b0b9535e037bf6a /intern/memutil/MEM_CacheLimiterC-Api.h | |
parent | c7a970a78eab2dea902b202d583fa98f70b54ba3 (diff) |
Add ItemDestroyable to the cache limitor
This callback is used when cache limiter needs to remove
some cached objects when running out of limit.
From blender side it's used to keep painted images always
in memory.
This fixes issue when painted images were removing from
the memory after image cache rewrite.
Diffstat (limited to 'intern/memutil/MEM_CacheLimiterC-Api.h')
-rw-r--r-- | intern/memutil/MEM_CacheLimiterC-Api.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/intern/memutil/MEM_CacheLimiterC-Api.h b/intern/memutil/MEM_CacheLimiterC-Api.h index 7579dbdd4d1..a6a3ec85777 100644 --- a/intern/memutil/MEM_CacheLimiterC-Api.h +++ b/intern/memutil/MEM_CacheLimiterC-Api.h @@ -47,6 +47,9 @@ typedef size_t (*MEM_CacheLimiter_DataSize_Func) (void*); /* function used to measure priority of item when freeing memory */ typedef int (*MEM_CacheLimiter_ItemPriority_Func) (void*, int); +/* function to check whether item could be destroyed */ +typedef bool (*MEM_CacheLimiter_ItemDestroyable_Func) (void*); + #ifndef __MEM_CACHELIMITER_H__ void MEM_CacheLimiter_set_maximum(size_t m); size_t MEM_CacheLimiter_get_maximum(void); @@ -145,6 +148,9 @@ void *MEM_CacheLimiter_get(MEM_CacheLimiterHandleC *handle); void MEM_CacheLimiter_ItemPriority_Func_set(MEM_CacheLimiterC *This, MEM_CacheLimiter_ItemPriority_Func item_priority_func); +void MEM_CacheLimiter_ItemDestroyable_Func_set(MEM_CacheLimiterC *This, + MEM_CacheLimiter_ItemDestroyable_Func item_destroyable_func); + size_t MEM_CacheLimiter_get_memory_in_use(MEM_CacheLimiterC *This); #ifdef __cplusplus |