summaryrefslogtreecommitdiff
path: root/desktop/netsurf.c
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/netsurf.c')
-rw-r--r--desktop/netsurf.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index 0928442dc..bd785898f 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -24,15 +24,19 @@
#include <stdio.h>
#include <stdlib.h>
#include <libwapcaplet/libwapcaplet.h>
+#include <dom/dom.h>
#include "netsurf/inttypes.h"
#include "utils/config.h"
+#include "utils/errors.h"
+#include "utils/nscolour.h"
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/string.h"
#include "utils/utf8.h"
#include "utils/messages.h"
+#include "utils/useragent.h"
#include "content/content_factory.h"
#include "content/fetchers.h"
#include "content/hlcache.h"
@@ -47,6 +51,7 @@
#include "netsurf/browser_window.h"
#include "desktop/system_colour.h"
+#include "desktop/page-info.h"
#include "desktop/searchweb.h"
#include "netsurf/misc.h"
#include "desktop/gui_internal.h"
@@ -94,7 +99,7 @@
static void netsurf_lwc_iterator(lwc_string *str, void *pw)
{
- NSLOG(netsurf, WARNING, "[%3u] %.*s", str->refcnt,
+ NSLOG(netsurf, WARNING, "[%3"PRIu32"] %.*s", str->refcnt,
(int)lwc_string_length(str), lwc_string_data(str));
}
@@ -132,6 +137,10 @@ nserror netsurf_init(const char *store_path)
if (ret != NSERROR_OK)
return ret;
+ ret = nscolour_update();
+ if (ret != NSERROR_OK)
+ return ret;
+
/* set up cache limits based on the memory cache size option */
hlcache_parameters.llcache.limit = nsoption_int(memory_cache_size);
@@ -146,10 +155,10 @@ nserror netsurf_init(const char *store_path)
hlcache_parameters.llcache.fetch_attempts = nsoption_uint(max_retried_fetches);
/* image cache is 25% of total memory cache size */
- image_cache_parameters.limit = (hlcache_parameters.llcache.limit * 25) / 100;
+ image_cache_parameters.limit = hlcache_parameters.llcache.limit / 4;
/* image cache hysteresis is 20% of the image cache size */
- image_cache_parameters.hysteresis = (image_cache_parameters.limit * 20) / 100;
+ image_cache_parameters.hysteresis = image_cache_parameters.limit / 5;
/* account for image cache use from total */
hlcache_parameters.llcache.limit -= image_cache_parameters.limit;
@@ -158,10 +167,13 @@ nserror netsurf_init(const char *store_path)
hlcache_parameters.llcache.store.limit = nsoption_uint(disc_cache_size);
/* set backing store hysterissi to 20% */
- hlcache_parameters.llcache.store.hysteresis = (hlcache_parameters.llcache.store.limit * 20) / 100;;
+ hlcache_parameters.llcache.store.hysteresis = hlcache_parameters.llcache.store.limit / 5;
/* set the path to the backing store */
- hlcache_parameters.llcache.store.path = store_path;
+ hlcache_parameters.llcache.store.path =
+ nsoption_charp(disc_cache_path) ?
+ nsoption_charp(disc_cache_path) :
+ store_path;
/* image handler bitmap cache */
ret = image_cache_init(&image_cache_parameters);
@@ -204,6 +216,11 @@ nserror netsurf_init(const char *store_path)
js_initialise();
+ ret = page_info_init();
+ if (ret != NSERROR_OK) {
+ return ret;
+ }
+
return NSERROR_OK;
}
@@ -218,7 +235,10 @@ void netsurf_exit(void)
NSLOG(netsurf, INFO, "Closing GUI");
guit->misc->quit();
-
+
+ NSLOG(netsurf, INFO, "Finalising page-info module");
+ page_info_fini();
+
NSLOG(netsurf, INFO, "Finalising JavaScript");
js_finalise();
@@ -230,6 +250,8 @@ void netsurf_exit(void)
NSLOG(netsurf, INFO, "Closing fetches");
fetcher_quit();
+ /* Now the fetchers are done, our user-agent string can go */
+ free_user_agent_string();
/* dump any remaining cache entries */
image_cache_fini();
@@ -250,6 +272,9 @@ void netsurf_exit(void)
messages_destroy();
corestrings_fini();
+ if (dom_namespace_finalise() != DOM_NO_ERR) {
+ NSLOG(netsurf, WARNING, "Unable to finalise DOM namespace strings");
+ }
NSLOG(netsurf, INFO, "Remaining lwc strings:");
lwc_iterate_strings(netsurf_lwc_iterator, NULL);