2011-09-05 03:50:14 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2011 Vincent Sanders <vince@netsurf-browser.org>
|
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* Cache implementation for bitmap images decoded into frontend format.
|
|
|
|
*/
|
|
|
|
|
2011-09-05 03:50:14 +04:00
|
|
|
#include <assert.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <string.h>
|
2016-04-20 01:20:29 +03:00
|
|
|
#include <stdlib.h>
|
2011-09-05 03:50:14 +04:00
|
|
|
|
2017-01-21 17:20:55 +03:00
|
|
|
#include "netsurf/inttypes.h"
|
2016-04-20 01:20:29 +03:00
|
|
|
#include "utils/utils.h"
|
2011-12-30 04:58:35 +04:00
|
|
|
#include "utils/log.h"
|
2016-05-30 13:23:32 +03:00
|
|
|
#include "netsurf/misc.h"
|
2016-05-27 01:01:03 +03:00
|
|
|
#include "netsurf/bitmap.h"
|
2016-06-06 10:59:23 +03:00
|
|
|
#include "content/llcache.h"
|
|
|
|
#include "content/content_protected.h"
|
|
|
|
#include "desktop/gui_internal.h"
|
2011-12-30 04:58:35 +04:00
|
|
|
|
2016-06-06 16:47:27 +03:00
|
|
|
#include "image/image_cache.h"
|
|
|
|
#include "image/image.h"
|
2011-09-05 03:50:14 +04:00
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/**
|
|
|
|
* Age of an entry within the cache
|
2011-09-05 03:50:14 +04:00
|
|
|
*
|
|
|
|
* type deffed away so it can be readily changed later perhaps to a
|
|
|
|
* wallclock time structure.
|
|
|
|
*/
|
|
|
|
typedef unsigned int cache_age;
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/**
|
|
|
|
* Image cache entry
|
2011-09-05 03:50:14 +04:00
|
|
|
*/
|
|
|
|
struct image_cache_entry_s {
|
2016-11-21 02:52:45 +03:00
|
|
|
struct image_cache_entry_s *next; /**< next cache entry in list */
|
|
|
|
struct image_cache_entry_s *prev; /**< previous cache entry in list */
|
|
|
|
|
|
|
|
/** content is used as a key */
|
|
|
|
struct content *content;
|
|
|
|
/** associated bitmap entry */
|
|
|
|
struct bitmap *bitmap;
|
|
|
|
/** routine to convert content into bitmap */
|
2011-09-05 03:50:14 +04:00
|
|
|
image_cache_convert_fn *convert;
|
|
|
|
|
|
|
|
/* Statistics for replacement algorithm */
|
2011-09-05 21:25:08 +04:00
|
|
|
|
2011-09-05 03:50:14 +04:00
|
|
|
unsigned int redraw_count; /**< number of times object has been drawn */
|
|
|
|
cache_age redraw_age; /**< Age of last redraw */
|
|
|
|
size_t bitmap_size; /**< size if storage occupied by bitmap */
|
|
|
|
cache_age bitmap_age; /**< Age of last conversion to a bitmap by cache*/
|
2011-09-05 21:25:08 +04:00
|
|
|
|
|
|
|
int conversion_count; /**< Number of times image has been converted */
|
2011-09-05 03:50:14 +04:00
|
|
|
};
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/**
|
|
|
|
* Current state of the cache.
|
2011-09-05 03:50:14 +04:00
|
|
|
*
|
|
|
|
* Global state of the cache. entries "age" is determined based on a
|
|
|
|
* monotonically incrementing operation count. This avoids issues with
|
|
|
|
* using wall clock time while allowing the LRU algorithm to work
|
|
|
|
* sensibly.
|
|
|
|
*/
|
|
|
|
struct image_cache_s {
|
2011-09-07 02:01:47 +04:00
|
|
|
/** Cache parameters */
|
|
|
|
struct image_cache_parameters params;
|
|
|
|
|
|
|
|
/** The "age" of the current operation */
|
2011-10-12 16:34:11 +04:00
|
|
|
cache_age current_age;
|
2011-09-07 02:01:47 +04:00
|
|
|
|
|
|
|
/* The objects the cache holds */
|
2011-10-12 16:34:11 +04:00
|
|
|
struct image_cache_entry_s *entries;
|
2011-09-05 03:50:14 +04:00
|
|
|
|
2011-09-07 02:01:47 +04:00
|
|
|
|
|
|
|
/* Statistics for management algorithm */
|
2011-09-05 03:50:14 +04:00
|
|
|
|
|
|
|
/** total size of bitmaps currently allocated */
|
2011-10-12 16:34:11 +04:00
|
|
|
size_t total_bitmap_size;
|
2011-09-05 03:50:14 +04:00
|
|
|
|
2011-09-07 02:01:47 +04:00
|
|
|
/** Total count of bitmaps currently allocated */
|
|
|
|
int bitmap_count;
|
|
|
|
|
|
|
|
/** Maximum size of bitmaps allocated at any one time */
|
2011-09-05 03:50:14 +04:00
|
|
|
size_t max_bitmap_size;
|
2016-11-21 02:52:45 +03:00
|
|
|
/** The number of objects when maximum bitmap usage occurred */
|
2011-09-05 03:50:14 +04:00
|
|
|
int max_bitmap_size_count;
|
|
|
|
|
2011-09-07 02:01:47 +04:00
|
|
|
/** Maximum count of bitmaps allocated at any one time */
|
2011-09-05 03:50:14 +04:00
|
|
|
int max_bitmap_count;
|
2016-11-21 02:52:45 +03:00
|
|
|
/** The size of the bitmaps when the max count occurred */
|
2011-09-05 03:50:14 +04:00
|
|
|
size_t max_bitmap_count_size;
|
|
|
|
|
2011-09-07 02:01:47 +04:00
|
|
|
/** Bitmap was not available at plot time required conversion */
|
2011-10-12 16:34:11 +04:00
|
|
|
int miss_count;
|
|
|
|
uint64_t miss_size;
|
2011-09-07 02:01:47 +04:00
|
|
|
/** Bitmap was available at plot time required no conversion */
|
|
|
|
int hit_count;
|
2011-10-12 16:34:11 +04:00
|
|
|
uint64_t hit_size;
|
2011-09-07 02:01:47 +04:00
|
|
|
/** Bitmap was not available at plot time and required
|
|
|
|
* conversion which failed.
|
2011-10-12 16:34:11 +04:00
|
|
|
*/
|
|
|
|
int fail_count;
|
|
|
|
uint64_t fail_size;
|
2011-09-07 02:01:47 +04:00
|
|
|
|
|
|
|
/* Cache entry freed without ever being redrawn */
|
2011-10-12 16:34:11 +04:00
|
|
|
int total_unrendered;
|
2011-09-07 02:01:47 +04:00
|
|
|
/** Bitmap was available but never required - wasted conversions */
|
2011-10-12 16:34:11 +04:00
|
|
|
int specultive_miss_count;
|
2011-09-07 02:01:47 +04:00
|
|
|
|
|
|
|
/** Total number of additional (after the first) conversions */
|
|
|
|
int total_extra_conversions;
|
|
|
|
/** counts total number of images with more than one conversion */
|
2011-10-12 16:34:11 +04:00
|
|
|
int total_extra_conversions_count;
|
2011-09-07 02:01:47 +04:00
|
|
|
|
|
|
|
/** Bitmap with most conversions was converted this many times */
|
2011-10-12 16:34:11 +04:00
|
|
|
int peak_conversions;
|
2011-09-07 02:01:47 +04:00
|
|
|
/** Size of bitmap with most conversions */
|
2011-10-12 16:34:11 +04:00
|
|
|
unsigned int peak_conversions_size;
|
2011-09-05 03:50:14 +04:00
|
|
|
};
|
|
|
|
|
2011-09-10 04:55:39 +04:00
|
|
|
/** image cache state */
|
2011-09-05 03:50:14 +04:00
|
|
|
static struct image_cache_s *image_cache = NULL;
|
|
|
|
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/**
|
|
|
|
* Find a cache entry by index.
|
|
|
|
*
|
|
|
|
* \param entryn index of cache entry
|
|
|
|
* \return cache entry at index or NULL if not found.
|
2011-10-11 02:41:31 +04:00
|
|
|
*/
|
|
|
|
static struct image_cache_entry_s *image_cache__findn(int entryn)
|
|
|
|
{
|
|
|
|
struct image_cache_entry_s *found;
|
|
|
|
|
|
|
|
found = image_cache->entries;
|
|
|
|
while ((found != NULL) && (entryn > 0)) {
|
|
|
|
entryn--;
|
|
|
|
found = found->next;
|
|
|
|
}
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Find the cache entry for a content
|
|
|
|
*
|
|
|
|
* \param c The content to get an entry for
|
|
|
|
* \return The image cache entry or NULL if not found.
|
2011-09-05 03:50:14 +04:00
|
|
|
*/
|
|
|
|
static struct image_cache_entry_s *image_cache__find(const struct content *c)
|
|
|
|
{
|
|
|
|
struct image_cache_entry_s *found;
|
|
|
|
|
|
|
|
found = image_cache->entries;
|
|
|
|
while ((found != NULL) && (found->content != c)) {
|
|
|
|
found = found->next;
|
|
|
|
}
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/**
|
|
|
|
* Update the image cache statistics with an entry.
|
|
|
|
*
|
|
|
|
* \param centry The image cache entry to update the stats with.
|
|
|
|
*/
|
2011-09-05 03:50:14 +04:00
|
|
|
static void image_cache_stats_bitmap_add(struct image_cache_entry_s *centry)
|
|
|
|
{
|
|
|
|
centry->bitmap_age = image_cache->current_age;
|
2011-09-05 21:25:08 +04:00
|
|
|
centry->conversion_count++;
|
2011-09-05 03:50:14 +04:00
|
|
|
|
|
|
|
image_cache->total_bitmap_size += centry->bitmap_size;
|
|
|
|
image_cache->bitmap_count++;
|
|
|
|
|
|
|
|
if (image_cache->total_bitmap_size > image_cache->max_bitmap_size) {
|
2011-10-12 16:34:11 +04:00
|
|
|
image_cache->max_bitmap_size = image_cache->total_bitmap_size;
|
2011-09-05 03:50:14 +04:00
|
|
|
image_cache->max_bitmap_size_count = image_cache->bitmap_count;
|
2011-10-12 16:34:11 +04:00
|
|
|
|
2011-09-05 03:50:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (image_cache->bitmap_count > image_cache->max_bitmap_count) {
|
2011-10-12 16:34:11 +04:00
|
|
|
image_cache->max_bitmap_count = image_cache->bitmap_count;
|
2011-09-05 03:50:14 +04:00
|
|
|
image_cache->max_bitmap_count_size = image_cache->total_bitmap_size;
|
|
|
|
}
|
2011-09-05 21:25:08 +04:00
|
|
|
|
|
|
|
if (centry->conversion_count == 2) {
|
|
|
|
image_cache->total_extra_conversions_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (centry->conversion_count > 1) {
|
|
|
|
image_cache->total_extra_conversions++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((centry->conversion_count > image_cache->peak_conversions) ||
|
|
|
|
(centry->conversion_count == image_cache->peak_conversions &&
|
|
|
|
centry->bitmap_size > image_cache->peak_conversions_size)) {
|
|
|
|
image_cache->peak_conversions = centry->conversion_count;
|
|
|
|
image_cache->peak_conversions_size = centry->bitmap_size;
|
|
|
|
}
|
2011-09-05 03:50:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void image_cache__link(struct image_cache_entry_s *centry)
|
|
|
|
{
|
|
|
|
centry->next = image_cache->entries;
|
|
|
|
centry->prev = NULL;
|
|
|
|
if (centry->next != NULL) {
|
|
|
|
centry->next->prev = centry;
|
|
|
|
}
|
|
|
|
image_cache->entries = centry;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void image_cache__unlink(struct image_cache_entry_s *centry)
|
|
|
|
{
|
|
|
|
/* unlink entry */
|
|
|
|
if (centry->prev == NULL) {
|
|
|
|
/* first in list */
|
|
|
|
if (centry->next != NULL) {
|
|
|
|
centry->next->prev = centry->prev;
|
|
|
|
image_cache->entries = centry->next;
|
|
|
|
} else {
|
|
|
|
/* empty list */
|
2011-10-12 16:34:11 +04:00
|
|
|
image_cache->entries = NULL;
|
2011-09-05 03:50:14 +04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
centry->prev->next = centry->next;
|
|
|
|
|
|
|
|
if (centry->next != NULL) {
|
|
|
|
centry->next->prev = centry->prev;
|
2011-10-12 16:34:11 +04:00
|
|
|
}
|
2011-09-05 03:50:14 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/**
|
|
|
|
* free bitmap from an image cache entry
|
|
|
|
*
|
|
|
|
* \param centry The image cache entry to free bitmap from.
|
|
|
|
*/
|
2011-10-12 16:34:11 +04:00
|
|
|
static void image_cache__free_bitmap(struct image_cache_entry_s *centry)
|
2011-09-05 03:50:14 +04:00
|
|
|
{
|
|
|
|
if (centry->bitmap != NULL) {
|
2011-09-15 13:25:05 +04:00
|
|
|
#ifdef IMAGE_CACHE_VERBOSE
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"Freeing bitmap %p size %d age %d redraw count %d",
|
|
|
|
centry->bitmap,
|
|
|
|
centry->bitmap_size,
|
|
|
|
image_cache->current_age - centry->bitmap_age,
|
|
|
|
centry->redraw_count);
|
2011-09-15 13:25:05 +04:00
|
|
|
#endif
|
2015-04-14 01:19:04 +03:00
|
|
|
guit->bitmap->destroy(centry->bitmap);
|
2011-09-05 03:50:14 +04:00
|
|
|
centry->bitmap = NULL;
|
|
|
|
image_cache->total_bitmap_size -= centry->bitmap_size;
|
|
|
|
image_cache->bitmap_count--;
|
|
|
|
if (centry->redraw_count == 0) {
|
|
|
|
image_cache->specultive_miss_count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/**
|
|
|
|
* free image cache entry
|
|
|
|
*
|
|
|
|
* \param centry The image cache entry to free.
|
|
|
|
*/
|
2011-09-05 03:50:14 +04:00
|
|
|
static void image_cache__free_entry(struct image_cache_entry_s *centry)
|
|
|
|
{
|
2011-09-15 13:25:05 +04:00
|
|
|
#ifdef IMAGE_CACHE_VERBOSE
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "freeing %p ", centry);
|
2011-09-15 13:25:05 +04:00
|
|
|
#endif
|
2011-09-05 03:50:14 +04:00
|
|
|
|
2011-09-05 20:14:25 +04:00
|
|
|
if (centry->redraw_count == 0) {
|
|
|
|
image_cache->total_unrendered++;
|
|
|
|
}
|
|
|
|
|
2011-09-05 03:50:14 +04:00
|
|
|
image_cache__free_bitmap(centry);
|
|
|
|
|
|
|
|
image_cache__unlink(centry);
|
|
|
|
|
|
|
|
free(centry);
|
|
|
|
}
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/**
|
|
|
|
* Image cache cleaner
|
|
|
|
*
|
|
|
|
* \param icache The image cache context.
|
|
|
|
*/
|
2011-09-07 02:01:47 +04:00
|
|
|
static void image_cache__clean(struct image_cache_s *icache)
|
|
|
|
{
|
|
|
|
struct image_cache_entry_s *centry = icache->entries;
|
|
|
|
|
|
|
|
while (centry != NULL) {
|
2011-10-12 16:34:11 +04:00
|
|
|
if ((icache->current_age - centry->redraw_age) >
|
2011-09-07 02:01:47 +04:00
|
|
|
icache->params.bg_clean_time) {
|
|
|
|
/* only consider older entries, avoids active entries */
|
2011-10-12 16:34:11 +04:00
|
|
|
if ((icache->total_bitmap_size >
|
|
|
|
(icache->params.limit - icache->params.hysteresis)) &&
|
2011-09-07 21:51:41 +04:00
|
|
|
(rand() > (RAND_MAX / 2))) {
|
2011-09-07 02:01:47 +04:00
|
|
|
image_cache__free_bitmap(centry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
centry=centry->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/**
|
|
|
|
* Cache background scheduled callback.
|
|
|
|
*
|
|
|
|
* \param p The image cache context.
|
|
|
|
*/
|
2011-09-07 02:01:47 +04:00
|
|
|
static void image_cache__background_update(void *p)
|
|
|
|
{
|
|
|
|
struct image_cache_s *icache = p;
|
2011-10-12 16:34:11 +04:00
|
|
|
|
2011-09-07 02:01:47 +04:00
|
|
|
/* increment current cache age */
|
|
|
|
icache->current_age += icache->params.bg_clean_time;
|
2011-10-12 16:34:11 +04:00
|
|
|
|
2011-09-15 13:25:05 +04:00
|
|
|
#ifdef IMAGE_CACHE_VERBOSE
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "Cache age %ds", icache->current_age / 1000);
|
2011-09-15 13:25:05 +04:00
|
|
|
#endif
|
2011-09-07 02:01:47 +04:00
|
|
|
|
|
|
|
image_cache__clean(icache);
|
|
|
|
|
2016-04-16 00:50:28 +03:00
|
|
|
guit->misc->schedule(icache->params.bg_clean_time,
|
2014-03-08 18:13:27 +04:00
|
|
|
image_cache__background_update,
|
|
|
|
icache);
|
2011-09-07 02:01:47 +04:00
|
|
|
}
|
|
|
|
|
2011-09-05 03:50:14 +04:00
|
|
|
/* exported interface documented in image_cache.h */
|
2011-10-07 22:12:47 +04:00
|
|
|
struct bitmap *image_cache_get_bitmap(const struct content *c)
|
2011-09-05 03:50:14 +04:00
|
|
|
{
|
|
|
|
struct image_cache_entry_s *centry;
|
|
|
|
|
|
|
|
centry = image_cache__find(c);
|
|
|
|
if (centry == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (centry->bitmap == NULL) {
|
|
|
|
if (centry->convert != NULL) {
|
|
|
|
centry->bitmap = centry->convert(centry->content);
|
2011-10-12 16:34:11 +04:00
|
|
|
}
|
2011-09-05 03:50:14 +04:00
|
|
|
|
|
|
|
if (centry->bitmap != NULL) {
|
|
|
|
image_cache_stats_bitmap_add(centry);
|
|
|
|
image_cache->miss_count++;
|
2011-09-07 13:15:33 +04:00
|
|
|
image_cache->miss_size += centry->bitmap_size;
|
2011-09-05 03:50:14 +04:00
|
|
|
} else {
|
|
|
|
image_cache->fail_count++;
|
2011-09-07 13:15:33 +04:00
|
|
|
image_cache->fail_size += centry->bitmap_size;
|
2011-09-05 03:50:14 +04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
image_cache->hit_count++;
|
2011-09-07 13:15:33 +04:00
|
|
|
image_cache->hit_size += centry->bitmap_size;
|
2011-09-05 03:50:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return centry->bitmap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* exported interface documented in image_cache.h */
|
|
|
|
bool image_cache_speculate(struct content *c)
|
|
|
|
{
|
|
|
|
bool decision = false;
|
|
|
|
|
2011-09-07 02:01:47 +04:00
|
|
|
/* If the cache is below its target usage and the bitmap is
|
|
|
|
* small enough speculate.
|
2011-10-12 16:34:11 +04:00
|
|
|
*/
|
|
|
|
if ((image_cache->total_bitmap_size < image_cache->params.limit) &&
|
2011-09-07 02:01:47 +04:00
|
|
|
(c->size <= image_cache->params.speculative_small)) {
|
|
|
|
#ifdef IMAGE_CACHE_VERBOSE
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"content size (%d) is smaller than minimum (%d)",
|
|
|
|
c->size,
|
|
|
|
SPECULATE_SMALL);
|
2011-09-07 02:01:47 +04:00
|
|
|
#endif
|
2011-09-05 03:50:14 +04:00
|
|
|
decision = true;
|
|
|
|
}
|
|
|
|
|
2011-09-07 02:01:47 +04:00
|
|
|
#ifdef IMAGE_CACHE_VERBOSE
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "returning %d", decision);
|
2011-09-07 02:01:47 +04:00
|
|
|
#endif
|
2011-09-05 03:50:14 +04:00
|
|
|
return decision;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* exported interface documented in image_cache.h */
|
|
|
|
struct bitmap *image_cache_find_bitmap(struct content *c)
|
|
|
|
{
|
|
|
|
struct image_cache_entry_s *centry;
|
|
|
|
|
|
|
|
centry = image_cache__find(c);
|
|
|
|
if (centry == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return centry->bitmap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* exported interface documented in image_cache.h */
|
2011-10-12 16:34:11 +04:00
|
|
|
nserror
|
2011-09-07 02:01:47 +04:00
|
|
|
image_cache_init(const struct image_cache_parameters *image_cache_parameters)
|
2011-09-05 03:50:14 +04:00
|
|
|
{
|
|
|
|
image_cache = calloc(1, sizeof(struct image_cache_s));
|
2011-09-07 02:01:47 +04:00
|
|
|
if (image_cache == NULL) {
|
|
|
|
return NSERROR_NOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
image_cache->params = *image_cache_parameters;
|
2011-09-05 03:50:14 +04:00
|
|
|
|
2016-04-16 00:50:28 +03:00
|
|
|
guit->misc->schedule(image_cache->params.bg_clean_time,
|
2014-03-08 18:13:27 +04:00
|
|
|
image_cache__background_update,
|
|
|
|
image_cache);
|
2011-09-05 03:50:14 +04:00
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"Image cache initialised with a limit of %"PRIsizet" hysteresis of %"PRIsizet,
|
|
|
|
image_cache->params.limit,
|
|
|
|
image_cache->params.hysteresis);
|
2011-09-10 04:55:39 +04:00
|
|
|
|
2011-09-05 03:50:14 +04:00
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* exported interface documented in image_cache.h */
|
|
|
|
nserror image_cache_fini(void)
|
|
|
|
{
|
2011-09-15 13:25:05 +04:00
|
|
|
unsigned int op_count;
|
2011-09-05 03:50:14 +04:00
|
|
|
|
2016-04-16 00:50:28 +03:00
|
|
|
guit->misc->schedule(-1, image_cache__background_update, image_cache);
|
2011-09-05 03:50:14 +04:00
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "Size at finish %"PRIsizet" (in %d)",
|
|
|
|
image_cache->total_bitmap_size, image_cache->bitmap_count);
|
2011-09-05 03:50:14 +04:00
|
|
|
|
|
|
|
while (image_cache->entries != NULL) {
|
|
|
|
image_cache__free_entry(image_cache->entries);
|
|
|
|
}
|
|
|
|
|
2011-10-12 16:34:11 +04:00
|
|
|
op_count = image_cache->hit_count +
|
|
|
|
image_cache->miss_count +
|
2011-09-07 13:15:33 +04:00
|
|
|
image_cache->fail_count;
|
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "Age %ds", image_cache->current_age / 1000);
|
|
|
|
NSLOG(netsurf, INFO, "Peak size %"PRIsizet" (in %d)",
|
|
|
|
image_cache->max_bitmap_size,
|
|
|
|
image_cache->max_bitmap_size_count);
|
|
|
|
NSLOG(netsurf, INFO, "Peak image count %d (size %"PRIsizet")",
|
|
|
|
image_cache->max_bitmap_count,
|
|
|
|
image_cache->max_bitmap_count_size);
|
2011-09-15 13:25:05 +04:00
|
|
|
|
|
|
|
if (op_count > 0) {
|
|
|
|
uint64_t op_size;
|
|
|
|
|
2011-10-12 16:34:11 +04:00
|
|
|
op_size = image_cache->hit_size +
|
|
|
|
image_cache->miss_size +
|
2011-09-15 13:25:05 +04:00
|
|
|
image_cache->fail_size;
|
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"Cache total/hit/miss/fail (counts) %d/%d/%d/%d (100%%/%d%%/%d%%/%d%%)",
|
|
|
|
op_count,
|
|
|
|
image_cache->hit_count,
|
|
|
|
image_cache->miss_count,
|
|
|
|
image_cache->fail_count,
|
|
|
|
(image_cache->hit_count * 100) / op_count,
|
|
|
|
(image_cache->miss_count * 100) / op_count,
|
|
|
|
(image_cache->fail_count * 100) / op_count);
|
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"Cache total/hit/miss/fail (size) %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64" (100%%/%"PRId64"%%/%"PRId64"%%/%"PRId64"%%)",
|
|
|
|
op_size,
|
|
|
|
image_cache->hit_size,
|
|
|
|
image_cache->miss_size,
|
|
|
|
image_cache->fail_size,
|
|
|
|
(image_cache->hit_size * 100) / op_size,
|
|
|
|
(image_cache->miss_size * 100) / op_size,
|
|
|
|
(image_cache->fail_size * 100) / op_size);
|
2011-09-15 13:25:05 +04:00
|
|
|
}
|
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"Total images never rendered: %d (includes %d that were converted)",
|
|
|
|
image_cache->total_unrendered,
|
|
|
|
image_cache->specultive_miss_count);
|
2011-09-15 13:25:05 +04:00
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"Total number of excessive conversions: %d (from %d images converted more than once)",
|
|
|
|
image_cache->total_extra_conversions,
|
|
|
|
image_cache->total_extra_conversions_count);
|
2011-09-15 13:25:05 +04:00
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "Bitmap of size %d had most (%d) conversions",
|
|
|
|
image_cache->peak_conversions_size,
|
|
|
|
image_cache->peak_conversions);
|
2011-09-15 13:25:05 +04:00
|
|
|
|
2011-09-05 03:50:14 +04:00
|
|
|
free(image_cache);
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* exported interface documented in image_cache.h */
|
2011-10-12 16:34:11 +04:00
|
|
|
nserror image_cache_add(struct content *content,
|
|
|
|
struct bitmap *bitmap,
|
2011-09-05 03:50:14 +04:00
|
|
|
image_cache_convert_fn *convert)
|
|
|
|
{
|
|
|
|
struct image_cache_entry_s *centry;
|
|
|
|
|
|
|
|
/* bump the cache age by a ms to ensure multiple items are not
|
2011-10-12 16:34:11 +04:00
|
|
|
* added at exactly the same time
|
2011-09-05 03:50:14 +04:00
|
|
|
*/
|
|
|
|
image_cache->current_age++;
|
|
|
|
|
|
|
|
centry = image_cache__find(content);
|
|
|
|
if (centry == NULL) {
|
|
|
|
/* new cache entry, content not previously added */
|
|
|
|
centry = calloc(1, sizeof(struct image_cache_entry_s));
|
|
|
|
if (centry == NULL) {
|
|
|
|
return NSERROR_NOMEM;
|
|
|
|
}
|
|
|
|
image_cache__link(centry);
|
|
|
|
centry->content = content;
|
|
|
|
|
|
|
|
centry->bitmap_size = content->width * content->height * 4;
|
|
|
|
}
|
|
|
|
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO, "centry %p, content %p, bitmap %p", centry,
|
|
|
|
content, bitmap);
|
2011-09-05 03:50:14 +04:00
|
|
|
|
|
|
|
centry->convert = convert;
|
|
|
|
|
|
|
|
/* set bitmap entry if one is passed, free extant one if present */
|
|
|
|
if (bitmap != NULL) {
|
|
|
|
if (centry->bitmap != NULL) {
|
2015-04-14 01:19:04 +03:00
|
|
|
guit->bitmap->destroy(centry->bitmap);
|
2011-09-05 03:50:14 +04:00
|
|
|
} else {
|
|
|
|
image_cache_stats_bitmap_add(centry);
|
|
|
|
}
|
|
|
|
centry->bitmap = bitmap;
|
|
|
|
} else {
|
|
|
|
/* no bitmap, check to see if we should speculatively convert */
|
2011-10-12 16:34:11 +04:00
|
|
|
if ((centry->convert != NULL) &&
|
2011-09-05 03:50:14 +04:00
|
|
|
(image_cache_speculate(content) == true)) {
|
|
|
|
centry->bitmap = centry->convert(centry->content);
|
|
|
|
|
|
|
|
if (centry->bitmap != NULL) {
|
|
|
|
image_cache_stats_bitmap_add(centry);
|
|
|
|
} else {
|
|
|
|
image_cache->fail_count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* exported interface documented in image_cache.h */
|
|
|
|
nserror image_cache_remove(struct content *content)
|
|
|
|
{
|
|
|
|
struct image_cache_entry_s *centry;
|
|
|
|
|
|
|
|
/* get the cache entry */
|
|
|
|
centry = image_cache__find(content);
|
|
|
|
if (centry == NULL) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"Could not find cache entry for content (%p)", content);
|
2011-09-05 03:50:14 +04:00
|
|
|
return NSERROR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
image_cache__free_entry(centry);
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
2011-10-11 02:41:31 +04:00
|
|
|
/* exported interface documented in image_cache.h */
|
|
|
|
int image_cache_snsummaryf(char *string, size_t size, const char *fmt)
|
|
|
|
{
|
|
|
|
size_t slen = 0; /* current output string length */
|
2011-10-12 16:34:11 +04:00
|
|
|
int fmtc = 0; /* current index into format string */
|
|
|
|
bool pct;
|
2011-10-11 02:41:31 +04:00
|
|
|
unsigned int op_count;
|
2011-10-12 16:34:11 +04:00
|
|
|
uint64_t op_size;
|
2011-10-11 02:41:31 +04:00
|
|
|
|
2011-10-12 16:34:11 +04:00
|
|
|
op_count = image_cache->hit_count +
|
|
|
|
image_cache->miss_count +
|
|
|
|
image_cache->fail_count;
|
2011-10-11 02:41:31 +04:00
|
|
|
|
2011-10-12 16:34:11 +04:00
|
|
|
op_size = image_cache->hit_size +
|
|
|
|
image_cache->miss_size +
|
|
|
|
image_cache->fail_size;
|
2011-10-11 02:41:31 +04:00
|
|
|
|
2011-10-12 16:34:11 +04:00
|
|
|
while((slen < size) && (fmt[fmtc] != 0)) {
|
|
|
|
if (fmt[fmtc] == '%') {
|
|
|
|
fmtc++;
|
2011-10-11 02:41:31 +04:00
|
|
|
|
2011-10-12 16:34:11 +04:00
|
|
|
/* check for percentage modifier */
|
|
|
|
if (fmt[fmtc] == 'p') {
|
|
|
|
fmtc++;
|
|
|
|
pct = true;
|
|
|
|
} else {
|
|
|
|
pct = false;
|
|
|
|
}
|
2011-10-11 02:41:31 +04:00
|
|
|
|
2011-10-12 16:34:11 +04:00
|
|
|
#define FMTCHR(chr,fmt,var) case chr : \
|
2011-10-18 11:34:15 +04:00
|
|
|
slen += snprintf(string + slen, size - slen, "%"fmt, image_cache->var); break
|
2011-10-11 02:41:31 +04:00
|
|
|
|
2011-10-12 16:34:11 +04:00
|
|
|
#define FMTPCHR(chr,fmt,var,div) \
|
|
|
|
case chr : \
|
|
|
|
if (pct) { \
|
|
|
|
if (div > 0) { \
|
2011-10-18 11:34:15 +04:00
|
|
|
slen += snprintf(string + slen, size - slen, "%"PRId64, (uint64_t)((image_cache->var * 100) / div)); \
|
2011-10-12 16:34:11 +04:00
|
|
|
} else { \
|
|
|
|
slen += snprintf(string + slen, size - slen, "100"); \
|
|
|
|
} \
|
|
|
|
} else { \
|
2011-10-18 11:34:15 +04:00
|
|
|
slen += snprintf(string + slen, size - slen, "%"fmt, image_cache->var); \
|
2011-10-12 16:34:11 +04:00
|
|
|
} break
|
2011-10-11 02:41:31 +04:00
|
|
|
|
|
|
|
|
2011-10-12 16:34:11 +04:00
|
|
|
switch (fmt[fmtc]) {
|
|
|
|
case '%':
|
|
|
|
string[slen] = '%';
|
|
|
|
slen++;
|
|
|
|
break;
|
2011-10-11 02:41:31 +04:00
|
|
|
|
2016-03-18 00:55:12 +03:00
|
|
|
FMTCHR('a', PRIssizet, params.limit);
|
|
|
|
FMTCHR('b', PRIssizet, params.hysteresis);
|
|
|
|
FMTCHR('c', PRIssizet, total_bitmap_size);
|
2011-10-18 11:34:15 +04:00
|
|
|
FMTCHR('d', "d", bitmap_count);
|
|
|
|
FMTCHR('e', "d", current_age / 1000);
|
2016-03-18 00:55:12 +03:00
|
|
|
FMTCHR('f', PRIssizet, max_bitmap_size);
|
2011-10-18 11:34:15 +04:00
|
|
|
FMTCHR('g', "d", max_bitmap_size_count);
|
|
|
|
FMTCHR('h', "d", max_bitmap_count);
|
2016-03-18 00:55:12 +03:00
|
|
|
FMTCHR('i', PRIssizet, max_bitmap_count_size);
|
2011-10-11 02:41:31 +04:00
|
|
|
|
|
|
|
|
2011-10-12 16:34:11 +04:00
|
|
|
case 'j':
|
|
|
|
slen += snprintf(string + slen, size - slen,
|
|
|
|
"%d", pct?100:op_count);
|
|
|
|
break;
|
2011-10-11 02:41:31 +04:00
|
|
|
|
2011-10-18 11:34:15 +04:00
|
|
|
FMTPCHR('k', "d", hit_count, op_count);
|
|
|
|
FMTPCHR('l', "d", miss_count, op_count);
|
|
|
|
FMTPCHR('m', "d", fail_count, op_count);
|
2011-10-12 16:34:11 +04:00
|
|
|
|
|
|
|
case 'n':
|
|
|
|
slen += snprintf(string + slen, size - slen,
|
2011-10-18 11:34:15 +04:00
|
|
|
"%"PRId64, pct?100:op_size);
|
2011-10-12 16:34:11 +04:00
|
|
|
break;
|
|
|
|
|
2011-10-18 11:34:15 +04:00
|
|
|
FMTPCHR('o', PRId64, hit_size, op_size);
|
|
|
|
FMTPCHR('q', PRId64, miss_size, op_size);
|
|
|
|
FMTPCHR('r', PRId64, fail_size, op_size);
|
2011-10-12 16:34:11 +04:00
|
|
|
|
2011-10-18 11:34:15 +04:00
|
|
|
FMTCHR('s', "d", total_unrendered);
|
|
|
|
FMTCHR('t', "d", specultive_miss_count);
|
|
|
|
FMTCHR('u', "d", total_extra_conversions);
|
|
|
|
FMTCHR('v', "d", total_extra_conversions_count);
|
|
|
|
FMTCHR('w', "d", peak_conversions_size);
|
|
|
|
FMTCHR('x', "d", peak_conversions);
|
2011-10-12 16:34:11 +04:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
#undef FMTCHR
|
|
|
|
#undef FMTPCHR
|
|
|
|
|
|
|
|
fmtc++;
|
|
|
|
} else {
|
|
|
|
string[slen] = fmt[fmtc];
|
|
|
|
slen++;
|
|
|
|
fmtc++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ensure that we NUL-terminate the output */
|
|
|
|
string[min(slen, size - 1)] = '\0';
|
2011-10-11 02:41:31 +04:00
|
|
|
|
|
|
|
return slen;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* exported interface documented in image_cache.h */
|
|
|
|
int image_cache_snentryf(char *string, size_t size, unsigned int entryn,
|
|
|
|
const char *fmt)
|
|
|
|
{
|
|
|
|
struct image_cache_entry_s *centry;
|
|
|
|
size_t slen = 0; /* current output string length */
|
|
|
|
int fmtc = 0; /* current index into format string */
|
2012-04-12 17:43:57 +04:00
|
|
|
lwc_string *origin; /* current entry's origin */
|
2011-10-11 02:41:31 +04:00
|
|
|
|
|
|
|
centry = image_cache__findn(entryn);
|
|
|
|
if (centry == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
while((slen < size) && (fmt[fmtc] != 0)) {
|
|
|
|
if (fmt[fmtc] == '%') {
|
|
|
|
fmtc++;
|
|
|
|
switch (fmt[fmtc]) {
|
|
|
|
case 'e':
|
|
|
|
slen += snprintf(string + slen, size - slen,
|
|
|
|
"%d", entryn);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'r':
|
|
|
|
slen += snprintf(string + slen, size - slen,
|
|
|
|
"%u", centry->redraw_count);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'a':
|
|
|
|
slen += snprintf(string + slen, size - slen,
|
|
|
|
"%.2f", (float)((image_cache->current_age - centry->redraw_age)) / 1000);
|
|
|
|
break;
|
2011-10-12 16:34:11 +04:00
|
|
|
|
|
|
|
|
2011-10-11 02:41:31 +04:00
|
|
|
case 'c':
|
|
|
|
slen += snprintf(string + slen, size - slen,
|
|
|
|
"%d", centry->conversion_count);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'g':
|
|
|
|
slen += snprintf(string + slen, size - slen,
|
|
|
|
"%.2f", (float)((image_cache->current_age - centry->bitmap_age)) / 1000);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'k':
|
|
|
|
slen += snprintf(string + slen, size - slen,
|
|
|
|
"%p", centry->content);
|
|
|
|
break;
|
|
|
|
|
2012-03-25 20:42:45 +04:00
|
|
|
case 'U':
|
|
|
|
slen += snprintf(string + slen, size - slen,
|
2016-11-21 02:52:45 +03:00
|
|
|
"%s", nsurl_access(llcache_handle_get_url(centry->content->llcache)));
|
2012-03-25 20:42:45 +04:00
|
|
|
break;
|
2012-04-12 17:43:57 +04:00
|
|
|
|
|
|
|
case 'o':
|
|
|
|
if (nsurl_has_component(llcache_handle_get_url(
|
|
|
|
centry->content->llcache),
|
|
|
|
NSURL_HOST)) {
|
|
|
|
origin = nsurl_get_component(
|
|
|
|
llcache_handle_get_url(
|
|
|
|
centry->content->
|
|
|
|
llcache),
|
|
|
|
NSURL_HOST);
|
2016-11-21 02:52:45 +03:00
|
|
|
|
2012-04-12 17:43:57 +04:00
|
|
|
slen += snprintf(string + slen,
|
|
|
|
size - slen, "%s",
|
2016-11-21 02:52:45 +03:00
|
|
|
lwc_string_data(
|
|
|
|
origin));
|
2012-04-12 17:43:57 +04:00
|
|
|
|
|
|
|
lwc_string_unref(origin);
|
|
|
|
} else {
|
|
|
|
slen += snprintf(string + slen,
|
|
|
|
size - slen, "%s",
|
2016-11-21 02:52:45 +03:00
|
|
|
"localhost");
|
2012-04-12 17:43:57 +04:00
|
|
|
}
|
|
|
|
break;
|
2016-11-21 02:52:45 +03:00
|
|
|
|
2011-10-11 02:41:31 +04:00
|
|
|
case 's':
|
|
|
|
if (centry->bitmap != NULL) {
|
2011-10-12 16:34:11 +04:00
|
|
|
slen += snprintf(string + slen,
|
2011-10-11 02:41:31 +04:00
|
|
|
size - slen,
|
2016-03-18 00:55:12 +03:00
|
|
|
"%" PRIssizet,
|
2011-10-11 02:41:31 +04:00
|
|
|
centry->bitmap_size);
|
|
|
|
} else {
|
2011-10-12 16:34:11 +04:00
|
|
|
slen += snprintf(string + slen,
|
2011-10-11 02:41:31 +04:00
|
|
|
size - slen,
|
|
|
|
"0");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
fmtc++;
|
|
|
|
} else {
|
|
|
|
string[slen] = fmt[fmtc];
|
|
|
|
slen++;
|
|
|
|
fmtc++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ensure that we NUL-terminate the output */
|
|
|
|
string[min(slen, size - 1)] = '\0';
|
|
|
|
|
|
|
|
return slen;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-05 03:50:14 +04:00
|
|
|
/* exported interface documented in image_cache.h */
|
2011-10-12 16:34:11 +04:00
|
|
|
bool image_cache_redraw(struct content *c,
|
2011-09-05 03:50:14 +04:00
|
|
|
struct content_redraw_data *data,
|
2011-10-12 16:34:11 +04:00
|
|
|
const struct rect *clip,
|
2011-09-05 03:50:14 +04:00
|
|
|
const struct redraw_context *ctx)
|
|
|
|
{
|
|
|
|
struct image_cache_entry_s *centry;
|
|
|
|
|
|
|
|
/* get the cache entry */
|
|
|
|
centry = image_cache__find(c);
|
|
|
|
if (centry == NULL) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"Could not find cache entry for content (%p)", c);
|
2012-09-30 02:09:32 +04:00
|
|
|
return false;
|
2011-09-05 03:50:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (centry->bitmap == NULL) {
|
|
|
|
if (centry->convert != NULL) {
|
|
|
|
centry->bitmap = centry->convert(centry->content);
|
2011-10-12 16:34:11 +04:00
|
|
|
}
|
2011-09-05 03:50:14 +04:00
|
|
|
|
|
|
|
if (centry->bitmap != NULL) {
|
|
|
|
image_cache_stats_bitmap_add(centry);
|
|
|
|
image_cache->miss_count++;
|
2011-09-07 13:15:33 +04:00
|
|
|
image_cache->miss_size += centry->bitmap_size;
|
2011-09-05 03:50:14 +04:00
|
|
|
} else {
|
|
|
|
image_cache->fail_count++;
|
2011-09-07 13:15:33 +04:00
|
|
|
image_cache->fail_size += centry->bitmap_size;
|
2011-09-05 03:50:14 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
image_cache->hit_count++;
|
2011-09-07 13:15:33 +04:00
|
|
|
image_cache->hit_size += centry->bitmap_size;
|
2011-09-05 03:50:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* update statistics */
|
2011-10-12 16:34:11 +04:00
|
|
|
centry->redraw_count++;
|
2011-09-05 03:50:14 +04:00
|
|
|
centry->redraw_age = image_cache->current_age;
|
|
|
|
|
2011-12-30 04:58:35 +04:00
|
|
|
return image_bitmap_plot(centry->bitmap, data, clip, ctx);
|
2011-09-05 03:50:14 +04:00
|
|
|
}
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/* exported interface documented in image_cache.h */
|
2011-09-05 03:50:14 +04:00
|
|
|
void image_cache_destroy(struct content *content)
|
|
|
|
{
|
|
|
|
struct image_cache_entry_s *centry;
|
|
|
|
|
|
|
|
/* get the cache entry */
|
|
|
|
centry = image_cache__find(content);
|
|
|
|
if (centry == NULL) {
|
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done
@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 20:28:12 +03:00
|
|
|
NSLOG(netsurf, INFO,
|
|
|
|
"Could not find cache entry for content (%p)", content);
|
2011-09-05 03:50:14 +04:00
|
|
|
} else {
|
|
|
|
image_cache__free_entry(centry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/* exported interface documented in image_cache.h */
|
2011-09-05 03:50:14 +04:00
|
|
|
void *image_cache_get_internal(const struct content *c, void *context)
|
|
|
|
{
|
2011-10-07 22:12:47 +04:00
|
|
|
return image_cache_get_bitmap(c);
|
2011-09-05 03:50:14 +04:00
|
|
|
}
|
|
|
|
|
2016-11-21 02:52:45 +03:00
|
|
|
/* exported interface documented in image_cache.h */
|
2011-09-05 03:50:14 +04:00
|
|
|
content_type image_cache_content_type(void)
|
|
|
|
{
|
|
|
|
return CONTENT_IMAGE;
|
|
|
|
}
|