From 657abbd245dc777f61314ad476deb821cff0b90a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sat, 8 Mar 2014 14:40:09 +0000 Subject: low level source data cache backing store interface. --- desktop/gui.h | 11 ++++++++++- desktop/gui_factory.c | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) (limited to 'desktop') 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; -- cgit v1.2.3