summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-03-08 14:40:09 +0000
committerVincent Sanders <vince@kyllikki.org>2014-05-12 23:47:43 +0100
commit657abbd245dc777f61314ad476deb821cff0b90a (patch)
tree08e738f76b2e23870f87aa451582199a19a99c31 /desktop
parentccc9ad969b61758184e1b9129ce257cdd7c7ab4e (diff)
downloadnetsurf-657abbd245dc777f61314ad476deb821cff0b90a.tar.gz
netsurf-657abbd245dc777f61314ad476deb821cff0b90a.tar.bz2
low level source data cache backing store interface.
Diffstat (limited to 'desktop')
-rw-r--r--desktop/gui.h11
-rw-r--r--desktop/gui_factory.c41
2 files changed, 50 insertions, 2 deletions
diff --git a/desktop/gui.h b/desktop/gui.h
index c0a5a4e21..24838c9df 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -69,6 +69,7 @@ struct hlcache_handle;
struct download_context;
struct nsurl;
struct gui_file_table;
+struct gui_llcache_table;
typedef struct nsnsclipboard_styles {
size_t start; /**< Start of run */
@@ -520,7 +521,6 @@ struct gui_browser_table {
};
-
/**
* NetSurf operation function table
*
@@ -572,6 +572,15 @@ struct netsurf_table {
* Provides routines for the interactive text search on a page.
*/
struct gui_search_table *search;
+
+ /**
+ * Low level cache table.
+ *
+ * Used by the low level cache to push objects to persistant
+ * storage. The table is optional and may be NULL which
+ * uses the default implementation.
+ */
+ struct gui_llcache_table *llcache;
};
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index 756f5dd0e..45d9516fa 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -17,6 +17,8 @@
*/
#include "content/hlcache.h"
+#include "content/backing_store.h"
+
#include "desktop/download.h"
#include "desktop/gui_factory.h"
#include "utils/file.h"
@@ -25,7 +27,6 @@
struct netsurf_table *guit = NULL;
-
static void gui_default_window_set_title(struct gui_window *g, const char *title)
{
}
@@ -400,6 +401,34 @@ static nserror verify_search_register(struct gui_search_table *gst)
return NSERROR_OK;
}
+/** verify low level cache persistant backing store table is valid */
+static nserror verify_llcache_register(struct gui_llcache_table *glt)
+{
+ /* check table is present */
+ if (glt == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ /* mandantory operations */
+ if (glt->store == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+ if (glt->fetch == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+ if (glt->invalidate == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+ if (glt->initialise == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+ if (glt->finalise == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ return NSERROR_OK;
+}
+
static nsurl *gui_default_get_resource_url(const char *path)
{
return NULL;
@@ -622,6 +651,16 @@ nserror gui_factory_register(struct netsurf_table *gt)
return err;
}
+ /* llcache table */
+ if (gt->llcache == NULL) {
+ /* set default backing store table */
+ gt->llcache = null_llcache_table;
+ }
+ err = verify_llcache_register(gt->llcache);
+ if (err != NSERROR_OK) {
+ return err;
+ }
+
guit = gt;
return NSERROR_OK;