r9968 vince - in /trunk/netsurf/desktop: browser.c browser.h
by netsurf@semichrome.net
Author: vince
Date: Thu Feb 11 04:58:26 2010
New Revision: 9968
URL: http://source.netsurf-browser.org?rev=9968&view=rev
Log:
Review fixups from Daniel Silverstone
Ensure status text statistics are initialised
Fix documentation and indentation of status text variables.
Modified:
trunk/netsurf/desktop/browser.c
trunk/netsurf/desktop/browser.h
Modified: trunk/netsurf/desktop/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.c?rev=996...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Thu Feb 11 04:58:26 2010
@@ -197,8 +197,11 @@
bw->drag_type = DRAGGING_NONE;
bw->scale = (float) option_scale / 100.0;
+ /* initialise status text cache */
bw->status_text = NULL;
bw->status_text_len = 0;
+ bw->status_match = 0;
+ bw->status_miss = 0;
}
Modified: trunk/netsurf/desktop/browser.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.h?rev=996...
==============================================================================
--- trunk/netsurf/desktop/browser.h (original)
+++ trunk/netsurf/desktop/browser.h Thu Feb 11 04:58:26 2010
@@ -44,11 +44,11 @@
struct scroll_msg_data;
typedef bool (*browser_caret_callback)(struct browser_window *bw,
- uint32_t key, void *p);
+ uint32_t key, void *p);
typedef bool (*browser_paste_callback)(struct browser_window *bw,
- const char *utf8, unsigned utf8_len, bool last, void *p);
+ const char *utf8, unsigned utf8_len, bool last, void *p);
typedef void (*browser_move_callback)(struct browser_window *bw,
- void *p);
+ void *p);
@@ -105,7 +105,7 @@
unsigned int drag_resize_right : 1;
unsigned int drag_resize_up : 1;
unsigned int drag_resize_down : 1;
-
+
/** Scroll capturing all mouse events */
struct scroll *scroll;
@@ -173,14 +173,14 @@
/** search context for free text search */
struct search_context *search_context;
-
+
struct form_control *visible_select_menu;
- /** cache of the currently displayed status text. */
- char *status_text;
- int status_text_len;
- int status_match;
- int status_miss;
+ /** cache of the currently displayed status text. */
+ char *status_text; /**< Current status bar text. */
+ int status_text_len; /**< Length of the ::status_text buffer. */
+ int status_match; /**< Number of times an idempotent status-set operation was performed. */
+ int status_miss; /**< Number of times status was really updated. */
};
@@ -201,7 +201,7 @@
* a drag. */
BROWSER_MOUSE_CLICK_1 = 4, /* button 1 clicked. */
BROWSER_MOUSE_CLICK_2 = 8, /* button 2 clicked. */
- BROWSER_MOUSE_DOUBLE_CLICK = 16, /* button 1 double clicked */
+ BROWSER_MOUSE_DOUBLE_CLICK = 16, /* button 1 double clicked */
BROWSER_MOUSE_DRAG_1 = 32, /* start of button 1 drag operation */
BROWSER_MOUSE_DRAG_2 = 64, /* start of button 2 drag operation */
@@ -230,17 +230,17 @@
extern bool browser_reformat_pending;
struct browser_window * browser_window_create(const char *url,
- struct browser_window *clone, const char *referrer,
- bool history_add, bool new_tab);
+ struct browser_window *clone, const char *referrer,
+ bool history_add, bool new_tab);
void browser_window_initialise_common(struct browser_window *bw,
- struct browser_window *clone);
+ struct browser_window *clone);
void browser_window_go(struct browser_window *bw, const char *url,
- const char *referrer, bool history_add);
+ const char *referrer, bool history_add);
void browser_window_go_unverifiable(struct browser_window *bw,
- const char *url, const char *referrer, bool history_add,
- struct content *parent);
+ const char *url, const char *referrer, bool history_add,
+ struct content *parent);
void browser_window_download(struct browser_window *bw,
- const char *url, const char *referrer);
+ const char *url, const char *referrer);
void browser_window_update(struct browser_window *bw, bool scroll_to_top);
void browser_window_stop(struct browser_window *bw);
void browser_window_reload(struct browser_window *bw, bool all);
@@ -250,31 +250,31 @@
void browser_window_set_scale(struct browser_window *bw, float scale, bool all);
void browser_window_refresh_url_bar(struct browser_window *bw, const char *url,
- const char *frag);
+ const char *frag);
void browser_window_mouse_click(struct browser_window *bw,
- browser_mouse_state mouse, int x, int y);
+ browser_mouse_state mouse, int x, int y);
void browser_window_mouse_track(struct browser_window *bw,
- browser_mouse_state mouse, int x, int y);
+ browser_mouse_state mouse, int x, int y);
void browser_window_mouse_drag_end(struct browser_window *bw,
- browser_mouse_state mouse, int x, int y);
+ browser_mouse_state mouse, int x, int y);
bool browser_window_key_press(struct browser_window *bw, uint32_t key);
bool browser_window_paste_text(struct browser_window *bw, const char *utf8,
- unsigned utf8_len, bool last);
+ unsigned utf8_len, bool last);
void browser_window_form_select(struct browser_window *bw,
- struct form_control *control, int item);
+ struct form_control *control, int item);
void browser_redraw_box(struct content *c, struct box *box);
void browser_form_submit(struct browser_window *bw, struct browser_window *target,
- struct form *form, struct form_control *submit_button);
+ struct form *form, struct form_control *submit_button);
void browser_scroll_callback(void *client_data,
- struct scroll_msg_data *scroll_data);
+ struct scroll_msg_data *scroll_data);
void browser_select_menu_callback(void *client_data,
- int x, int y, int width, int height);
-
+ int x, int y, int width, int height);
+
void browser_window_redraw_rect(struct browser_window *bw, int x, int y,
- int width, int height);
+ int width, int height);
bool browser_window_back_available(struct browser_window *bw);
bool browser_window_forward_available(struct browser_window *bw);
@@ -291,7 +291,7 @@
/* In platform specific thumbnail.c. */
bool thumbnail_create(struct content *content, struct bitmap *bitmap,
- const char *url);
+ const char *url);
/* In platform specific schedule.c. */
void schedule(int t, void (*callback)(void *p), void *p);
12 years, 11 months
r9967 jmb - /trunk/netsurf/utils/valgrind.supp
by netsurf@semichrome.net
Author: jmb
Date: Wed Feb 10 18:23:59 2010
New Revision: 9967
URL: http://source.netsurf-browser.org?rev=9967&view=rev
Log:
Valgrind suppressions file
Added:
trunk/netsurf/utils/valgrind.supp
Added: trunk/netsurf/utils/valgrind.supp
URL: http://source.netsurf-browser.org/trunk/netsurf/utils/valgrind.supp?rev=9...
==============================================================================
--- trunk/netsurf/utils/valgrind.supp (added)
+++ trunk/netsurf/utils/valgrind.supp Wed Feb 10 18:23:59 2010
@@ -1,0 +1,14 @@
+# Valgrind suppression file for NetSurf
+
+# Suppress a valgrind message about use of uninitialized memory in strchrnul().
+# This use is OK because it provides only a speedup.
+{
+ strchrnul-addr4
+ Memcheck:Addr4
+ fun:strchrnul
+}
+{
+ strchrnul-addr8
+ Memcheck:Addr8
+ fun:strchrnul
+}
12 years, 12 months
r9966 vince - in /trunk/netsurf: desktop/browser.c riscos/gui/status_bar.c
by netsurf@semichrome.net
Author: vince
Date: Wed Feb 10 18:10:58 2010
New Revision: 9966
URL: http://source.netsurf-browser.org?rev=9966&view=rev
Log:
remove RISC OS status bar text caching
Modified:
trunk/netsurf/desktop/browser.c
trunk/netsurf/riscos/gui/status_bar.c
Modified: trunk/netsurf/desktop/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.c?rev=996...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Wed Feb 10 18:10:58 2010
@@ -936,7 +936,7 @@
}
bw->status_miss++;
- gui_window_set_status(bw->window, text);
+ gui_window_set_status(bw->window, bw->status_text);
}
Modified: trunk/netsurf/riscos/gui/status_bar.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/gui/status_bar.c?r...
==============================================================================
--- trunk/netsurf/riscos/gui/status_bar.c (original)
+++ trunk/netsurf/riscos/gui/status_bar.c Wed Feb 10 18:10:58 2010
@@ -314,31 +314,10 @@
{
assert(sb);
- /* check for no change */
- if (sb->text) {
- /* strings match */
- if (!strcmp(text, sb->text))
- return;
- } else {
- /* still no string */
- if (!text)
- return;
- }
-
- /* release the old text */
- if (sb->text)
- free(sb->text);
-
- /* copy new text if required. we don't abort on the string duplication
- * failing as it would just cause the visible display to be out of
- * sync with the (failed) text */
- if (text)
- sb->text = strdup(text);
- else
- sb->text = NULL;
+ sb->text = text;
/* redraw the window */
- if (sb->visible)
+ if ((sb->visible) && (text != NULL))
xwimp_force_redraw(sb->w, 0, 0, sb->width - WIDGET_WIDTH, 65536);
}
12 years, 12 months
r9965 vince - in /trunk/netsurf/desktop: browser.c browser.h
by netsurf@semichrome.net
Author: vince
Date: Wed Feb 10 17:37:06 2010
New Revision: 9965
URL: http://source.netsurf-browser.org?rev=9965&view=rev
Log:
cache the status text to reduce teh number of window status update calls to teh frontend
Modified:
trunk/netsurf/desktop/browser.c
trunk/netsurf/desktop/browser.h
Modified: trunk/netsurf/desktop/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.c?rev=996...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Wed Feb 10 17:37:06 2010
@@ -196,6 +196,9 @@
bw->reformat_pending = false;
bw->drag_type = DRAGGING_NONE;
bw->scale = (float) option_scale / 100.0;
+
+ bw->status_text = NULL;
+ bw->status_text_len = 0;
}
@@ -906,9 +909,34 @@
void browser_window_set_status(struct browser_window *bw, const char *text)
{
+ int text_len;
+ /* find topmost window */
while (bw->parent)
bw = bw->parent;
- gui_window_set_status(bw->window, text);
+
+ if ((bw->status_text != NULL) &&
+ (strcmp(text, bw->status_text) == 0)) {
+ /* status text is unchanged */
+ bw->status_match++;
+ return;
+ }
+
+ /* status text is changed */
+
+ text_len = strlen(text);
+
+ if ((bw->status_text == NULL) || (bw->status_text_len < text_len)) {
+ /* no current string allocation or it is not long enough */
+ free(bw->status_text);
+ bw->status_text = strdup(text);
+ bw->status_text_len = text_len;
+ } else {
+ /* current allocation has enough space */
+ memcpy(bw->status_text, text, text_len + 1);
+ }
+
+ bw->status_miss++;
+ gui_window_set_status(bw->window, text);
}
@@ -1006,6 +1034,10 @@
free(bw->name);
free(bw->frag_id);
+ free(bw->status_text);
+ bw->status_text = NULL;
+ LOG(("Status text cache match:miss %d:%d",
+ bw->status_match, bw->status_miss));
}
Modified: trunk/netsurf/desktop/browser.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.h?rev=996...
==============================================================================
--- trunk/netsurf/desktop/browser.h (original)
+++ trunk/netsurf/desktop/browser.h Wed Feb 10 17:37:06 2010
@@ -175,6 +175,12 @@
struct search_context *search_context;
struct form_control *visible_select_menu;
+
+ /** cache of the currently displayed status text. */
+ char *status_text;
+ int status_text_len;
+ int status_match;
+ int status_miss;
};
12 years, 12 months
r9964 jmb - /trunk/netsurf/framebuffer/gui.c
by netsurf@semichrome.net
Author: jmb
Date: Wed Feb 10 01:22:50 2010
New Revision: 9964
URL: http://source.netsurf-browser.org?rev=9964&view=rev
Log:
Process command line after loading options file.
Modified:
trunk/netsurf/framebuffer/gui.c
Modified: trunk/netsurf/framebuffer/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/gui.c?rev=996...
==============================================================================
--- trunk/netsurf/framebuffer/gui.c (original)
+++ trunk/netsurf/framebuffer/gui.c Wed Feb 10 01:22:50 2010
@@ -419,11 +419,7 @@
void gui_init(int argc, char** argv)
{
char buf[PATH_MAX];
- nsfb_t *nsfb;
-
- if (process_cmdline(argc,argv) != true)
- die("unable to process command line.\n");
-
+ nsfb_t *nsfb;
fb_find_resource(buf, "Aliases", "./framebuffer/res/Aliases");
LOG(("Using '%s' as Aliases file", buf));
@@ -450,6 +446,9 @@
fb_find_resource(buf, "quirks.css", "./framebuffer/res/quirks.css");
quirks_stylesheet_url = path_to_url(buf);
+
+ if (process_cmdline(argc,argv) != true)
+ die("unable to process command line.\n");
nsfb = framebuffer_initialise(fename, fewidth, feheight, febpp);
if (nsfb == NULL)
12 years, 12 months
r9962 jmb - /trunk/netsurf/content/fetchers/fetch_curl.c
by netsurf@semichrome.net
Author: jmb
Date: Tue Feb 9 18:32:12 2010
New Revision: 9962
URL: http://source.netsurf-browser.org?rev=9962&view=rev
Log:
Rate limit fetch progress notifications.
Modified:
trunk/netsurf/content/fetchers/fetch_curl.c
Modified: trunk/netsurf/content/fetchers/fetch_curl.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/fetchers/fetch_cu...
==============================================================================
--- trunk/netsurf/content/fetchers/fetch_curl.c (original)
+++ trunk/netsurf/content/fetchers/fetch_curl.c Tue Feb 9 18:32:12 2010
@@ -79,6 +79,7 @@
time_t file_etag; /**< ETag for local objects */
#define MAX_CERTS 10
struct cert_info cert_data[MAX_CERTS]; /**< HTTPS certificate data */
+ unsigned int last_progress_update; /**< Time of last progress update */
};
struct cache_handle {
@@ -97,7 +98,6 @@
static bool curl_with_openssl;
static char fetch_error_buffer[CURL_ERROR_SIZE]; /**< Error buffer for cURL. */
-static char fetch_progress_buffer[256]; /**< Progress buffer for cURL */
static char fetch_proxy_userpwd[100]; /**< Proxy authentication details. */
static bool fetch_curl_initialise(const char *scheme);
@@ -346,6 +346,7 @@
fetch->file_etag = 0;
fetch->http_code = 0;
memset(fetch->cert_data, 0, sizeof(fetch->cert_data));
+ fetch->last_progress_update = 0;
if (!fetch->url ||
(post_urlenc && !fetch->post_urlenc) ||
@@ -907,11 +908,23 @@
int fetch_curl_progress(void *clientp, double dltotal, double dlnow,
double ultotal, double ulnow)
{
+ static char fetch_progress_buffer[256]; /**< Progress buffer for cURL */
struct curl_fetch_info *f = (struct curl_fetch_info *) clientp;
+ unsigned int time_now_cs;
double percent;
if (f->abort)
return 0;
+
+ /* Rate limit each fetch's progress notifications to 2 a second */
+#define UPDATES_PER_SECOND 2
+#define UPDATE_DELAY_CS (100 / UPDATES_PER_SECOND)
+ time_now_cs = wallclock();
+ if (time_now_cs - f->last_progress_update < UPDATE_DELAY_CS)
+ return 0;
+ f->last_progress_update = time_now_cs;
+#undef UPDATE_DELAY_CS
+#undef UPDATES_PERS_SECOND
if (dltotal > 0) {
percent = dlnow * 100.0f / dltotal;
12 years, 12 months
r9961 tlsa - in /trunk/netsurf/!NetSurf/Resources: de/Messages en/Messages fr/Messages it/Messages
by netsurf@semichrome.net
Author: tlsa
Date: Tue Feb 9 16:58:36 2010
New Revision: 9961
URL: http://source.netsurf-browser.org?rev=9961&view=rev
Log:
Remove duplicate. Thanks to Sebastian Barthel.
Modified:
trunk/netsurf/!NetSurf/Resources/de/Messages
trunk/netsurf/!NetSurf/Resources/en/Messages
trunk/netsurf/!NetSurf/Resources/fr/Messages
trunk/netsurf/!NetSurf/Resources/it/Messages
Modified: trunk/netsurf/!NetSurf/Resources/de/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/de/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/de/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/de/Messages Tue Feb 9 16:58:36 2010
@@ -688,7 +688,6 @@
MiscError:Unerwarteter Fehler:
FileError:Datei existiert nicht:
PrintError:Ein Fehler trat während des Druckens auf:
-AWNotSeen:Das Programm AWViewer wurde nicht gefunden.
EncNotRec:Encodierung nicht erkannt.
FileOpenError:Datei ist nicht zu öffnen: '%s'
DirectoryError:Verzeichnis '%s' existiert bereits.
Modified: trunk/netsurf/!NetSurf/Resources/en/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/en/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/en/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/en/Messages Tue Feb 9 16:58:36 2010
@@ -691,7 +691,6 @@
MiscError:An unexpected error occurred:
FileError:File does not exist:
PrintError:An error occurred when printing:
-AWNotSeen:Please locate the AWViewer application and try again.
# Specific errors - displayed in a dialog box
#
Modified: trunk/netsurf/!NetSurf/Resources/fr/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/fr/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/fr/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/fr/Messages Tue Feb 9 16:58:36 2010
@@ -688,7 +688,6 @@
MiscError:Une erreur inattendue s'est produite:
FileError:Le fichier n'existe pas:
PrintError:Une erreur s'est produite lors de l'impression:
-AWNotSeen:Localisez l'application AMViewer SVP puis réessayez.
EncNotRec:Encoding type not recognised.
FileOpenError:could not open file '%s'
DirectoryError:directory '%s' already exists
Modified: trunk/netsurf/!NetSurf/Resources/it/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/it/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/it/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/it/Messages Tue Feb 9 16:58:36 2010
@@ -693,7 +693,6 @@
MiscError:Si è verificato un errore inatteso:
FileError:Il file è inesistente:
PrintError:Si è verificato un errore durante la stampa:
-AWNotSeen:Per favore imposta l'applicazione AWViewer e riprova nuovamente.
EncNotRec:Tipo di codifica sconosciuta.
FileOpenError:impossibile aprire il file '%s'
DirectoryError:directory '%s' già esistente
12 years, 12 months
r9959 jmb - in /branches/jmb/new-cache: content/content.c content/content.h content/content_protected.h desktop/netsurf.c
by netsurf@semichrome.net
Author: jmb
Date: Sun Feb 7 05:58:35 2010
New Revision: 9959
URL: http://source.netsurf-browser.org?rev=9959&view=rev
Log:
Content is no longer responsible for managing the cache.
Modified:
branches/jmb/new-cache/content/content.c
branches/jmb/new-cache/content/content.h
branches/jmb/new-cache/content/content_protected.h
branches/jmb/new-cache/desktop/netsurf.c
Modified: branches/jmb/new-cache/content/content.c
URL: http://source.netsurf-browser.org/branches/jmb/new-cache/content/content....
==============================================================================
--- branches/jmb/new-cache/content/content.c (original)
+++ branches/jmb/new-cache/content/content.c Sun Feb 7 05:58:35 2010
@@ -82,10 +82,6 @@
#include "utils/talloc.h"
#include "utils/utils.h"
-
-/** Linked list of all content structures. May include more than one content
- * per URL. Doubly-linked. */
-struct content *content_list = 0;
/** An entry in mime_map. */
struct mime_entry {
@@ -361,7 +357,6 @@
static void content_update_status(struct content *c);
static void content_destroy(struct content *c);
-static void content_stop_check(struct content *c);
/**
@@ -437,111 +432,7 @@
content_set_status(c, messages_get("Loading"));
- c->prev = 0;
- c->next = content_list;
- if (content_list)
- content_list->prev = c;
- content_list = c;
-
return c;
-}
-
-
-/**
- * Get a content from the memory cache.
- *
- * \param url URL of content
- * \return content if found, or 0
- *
- * Searches the list of contents for one corresponding to the given url, and
- * which is fresh and shareable.
- */
-
-struct content * content_get(const char *url)
-{
- struct content *c;
-
- for (c = content_list; c; c = c->next) {
- if (!c->fresh)
- /* not fresh */
- continue;
- if (c->status == CONTENT_STATUS_ERROR)
- /* error state */
- continue;
- /** \todo We need to reconsider the entire caching strategy in
- * the light of data being shared between specific contents.
- *
- * For example, string dictionaries are owned by the document,
- * and all stylesheets used by the document share the same
- * dictionary.
- *
- * The CSS content handler retrieves the dictionary from its
- * parent content. This relies upon there being a 1:1 mapping
- * between documents and stylesheets.
- *
- * The type of a content is only known once we've received the
- * headers from the fetch layer (and potentially some of the
- * content data, too, if we ever sniff for the type). There
- * is thus a problem with returning contents of unknown type
- * here -- when we subsequently discover that they must only
- * have one user, we clone them. By that point, however, we've
- * no idea what the parent content is, which means that they
- * end up with the wrong parent (and thus wrong dictionary).
- *
- * Of course, the problem with ignoring unknown content types
- * here is that, for all the content types which may be shared,
- * we end up duplicating them and wasting memory. Hence the
- * need to reconsider everything.
- */
- if (c->type == CONTENT_UNKNOWN)
- continue;
- if (c->type != CONTENT_UNKNOWN &&
- handler_map[c->type].no_share &&
- c->user_list->next)
- /* not shareable, and has a user already */
- continue;
- if (strcmp(llcache_handle_get_url(c->llcache), url))
- continue;
- return c;
- }
-
- return 0;
-}
-
-
-/**
- * Get a READY or DONE content from the memory cache.
- *
- * \param url URL of content
- * \return content if found, or 0
- *
- * Searches the list of contents for one corresponding to the given url, and
- * which is fresh, shareable and either READY or DONE.
- */
-
-struct content * content_get_ready(const char *url)
-{
- struct content *c;
-
- for (c = content_list; c; c = c->next) {
- if (!c->fresh)
- /* not fresh */
- continue;
- if (c->status != CONTENT_STATUS_READY &&
- c->status != CONTENT_STATUS_DONE)
- /* not ready or done */
- continue;
- if (c->type != CONTENT_UNKNOWN &&
- handler_map[c->type].no_share &&
- c->user_list->next)
- /* not shareable, and has a user already */
- continue;
- if (strcmp(llcache_handle_get_url(c->llcache), url))
- continue;
- return c;
- }
-
- return 0;
}
@@ -823,65 +714,6 @@
/**
- * Clean unused contents from the content_list.
- *
- * Destroys any contents in the content_list with no users or in
- * CONTENT_STATUS_ERROR. Fresh contents in CONTENT_STATUS_DONE may be kept even
- * with no users.
- *
- * Each content is also checked for stop requests.
- */
-
-void content_clean(void)
-{
- unsigned int size;
- struct content *c, *next, *prev;
-
- /* destroy unused stale contents and contents with errors */
- for (c = content_list; c; c = next) {
- next = c->next;
-
- /* this function must not be called from a content function */
- assert(!c->locked);
-
- if (c->user_list->next && c->status != CONTENT_STATUS_ERROR)
- /* content has users */
- continue;
-
- if (c->fresh && c->status == CONTENT_STATUS_DONE)
- /* content is fresh */
- continue;
-
- /* content can be destroyed */
- content_destroy(c);
- }
-
- /* check for pending stops */
- for (c = content_list; c; c = c->next) {
- if (c->status == CONTENT_STATUS_READY)
- content_stop_check(c);
- }
-
- /* attempt to shrink the memory cache (unused fresh contents) */
- size = 0;
- next = 0;
- for (c = content_list; c; c = c->next) {
- next = c;
- c->talloc_size = talloc_total_size(c);
- size += c->size + c->talloc_size;
- }
- for (c = next; c && (unsigned int) option_memory_cache_size < size;
- c = prev) {
- prev = c->prev;
- if (c->user_list->next)
- continue;
- size -= c->size + c->talloc_size;
- content_destroy(c);
- }
-}
-
-
-/**
* Destroy and free a content.
*
* Calls the destroy function for the content, and frees the structure.
@@ -892,13 +724,6 @@
assert(c);
LOG(("content %p %s", c, llcache_handle_get_url(c->llcache)));
assert(!c->locked);
-
- if (c->next)
- c->next->prev = c->prev;
- if (c->prev)
- c->prev->next = c->next;
- else
- content_list = c->next;
if (c->type < HANDLER_MAP_COUNT && handler_map[c->type].destroy)
handler_map[c->type].destroy(c);
@@ -929,38 +754,6 @@
c->refresh = 0;
talloc_free(c->title);
c->title = 0;
-}
-
-
-/**
- * Free all contents in the content_list.
- */
-
-void content_quit(void)
-{
- bool progress = true;
- struct content *c, *next;
-
- while (content_list && progress) {
- progress = false;
- for (c = content_list; c; c = next) {
- assert(c->next != c);
- next = c->next;
-
- if (c->user_list->next &&
- c->status != CONTENT_STATUS_ERROR)
- /* content has users */
- continue;
-
- /* content can be destroyed */
- content_destroy(c);
- progress = true;
- }
- }
-
- if (content_list) {
- LOG(("bug: some contents could not be destroyed"));
- }
}
@@ -1214,34 +1007,6 @@
/**
- * Check if all users have requested a stop, and do it if so.
- */
-
-void content_stop_check(struct content *c)
-{
- struct content_user *user;
- union content_msg_data data;
-
- assert(c->status == CONTENT_STATUS_READY);
-
- /* user_list starts with a sentinel */
- for (user = c->user_list->next; user; user = user->next)
- if (!user->stop)
- return;
-
- LOG(("%p %s", c, llcache_handle_get_url(c->llcache)));
-
- /* all users have requested stop */
- assert(handler_map[c->type].stop);
- handler_map[c->type].stop(c);
- assert(c->status == CONTENT_STATUS_DONE);
-
- content_set_status(c, messages_get("Stopped"));
- content_broadcast(c, CONTENT_MSG_DONE, data);
-}
-
-
-/**
* A window containing the content has been opened.
*
* \param c content that has been opened
Modified: branches/jmb/new-cache/content/content.h
URL: http://source.netsurf-browser.org/branches/jmb/new-cache/content/content....
==============================================================================
--- branches/jmb/new-cache/content/content.h (original)
+++ branches/jmb/new-cache/content/content.h Sun Feb 7 05:58:35 2010
@@ -96,8 +96,6 @@
content_type content_lookup(const char *mime_type);
struct content * content_create(const char *url);
-struct content * content_get(const char *url);
-struct content * content_get_ready(const char *url);
bool content_can_reformat(struct content *c);
bool content_set_type(struct content *c, content_type type,
const char *mime_type, const char *params[],
@@ -108,9 +106,7 @@
void content_convert(struct content *c, int width, int height);
void content_set_done(struct content *c);
void content_reformat(struct content *c, int width, int height);
-void content_clean(void);
void content_reset(struct content *c);
-void content_quit(void);
bool content_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
Modified: branches/jmb/new-cache/content/content_protected.h
URL: http://source.netsurf-browser.org/branches/jmb/new-cache/content/content_...
==============================================================================
--- branches/jmb/new-cache/content/content_protected.h (original)
+++ branches/jmb/new-cache/content/content_protected.h Sun Feb 7 05:58:35 2010
@@ -192,9 +192,6 @@
unsigned int line; /**< Line no, 0 if not applicable. */
} error_list[40];
unsigned int error_count; /**< Number of valid error entries. */
-
- struct content *prev; /**< Previous in global content list. */
- struct content *next; /**< Next in global content list. */
};
extern const char * const content_type_name[];
Modified: branches/jmb/new-cache/desktop/netsurf.c
URL: http://source.netsurf-browser.org/branches/jmb/new-cache/desktop/netsurf....
==============================================================================
--- branches/jmb/new-cache/desktop/netsurf.c (original)
+++ branches/jmb/new-cache/desktop/netsurf.c Sun Feb 7 05:58:35 2010
@@ -141,16 +141,6 @@
void netsurf_poll(void)
{
- static unsigned int last_clean = 0;
- unsigned int current_time = wallclock();
-
- /* avoid calling content_clean() more often than once every 5
- * seconds.
- */
- if (last_clean + 500 < current_time) {
- last_clean = current_time;
- content_clean();
- }
gui_poll(fetch_active);
fetch_poll();
}
@@ -164,8 +154,6 @@
{
LOG(("Closing GUI"));
gui_quit();
- LOG(("Closing content"));
- content_quit();
LOG(("Closing fetches"));
fetch_quit();
LOG(("Closing utf8"));
12 years, 12 months