summaryrefslogtreecommitdiff
path: root/content/llcache.h
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2019-08-03 21:13:19 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2019-08-03 21:13:19 +0100
commit09eb89e3c3b7ce98d66369ca5d6c41283caf9873 (patch)
tree7bc9d9015bdec9ad99c6373bbebe26cf215f960b /content/llcache.h
parent84a9c5accf63a5cfdbf288f3aba137fc5945aa02 (diff)
downloadnetsurf-09eb89e3c3b7ce98d66369ca5d6c41283caf9873.tar.gz
netsurf-09eb89e3c3b7ce98d66369ca5d6c41283caf9873.tar.bz2
Migrate query dispatch up from llcache to hlcache
As a first step in refactoring query handling to be managed by `browser_window`, this migrates the calling of the query handler from the llcache object code up to the hlcache. In theory this may result in multiple queries happening for one object, but we mitigate multiple-responses in the llcache so all should be well. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'content/llcache.h')
-rw-r--r--content/llcache.h91
1 files changed, 52 insertions, 39 deletions
diff --git a/content/llcache.h b/content/llcache.h
index 796db66f8..762edf060 100644
--- a/content/llcache.h
+++ b/content/llcache.h
@@ -48,45 +48,6 @@ typedef struct llcache_post_data {
} data; /**< POST data content */
} llcache_post_data;
-/** Low-level cache event types */
-typedef enum {
- LLCACHE_EVENT_HAD_HEADERS, /**< Received all headers */
- LLCACHE_EVENT_HAD_DATA, /**< Received some data */
- LLCACHE_EVENT_DONE, /**< Finished fetching data */
-
- LLCACHE_EVENT_ERROR, /**< An error occurred during fetch */
- LLCACHE_EVENT_PROGRESS, /**< Fetch progress update */
-
- LLCACHE_EVENT_REDIRECT /**< Fetch URL redirect occured */
-} llcache_event_type;
-
-/** Low-level cache events */
-typedef struct {
- llcache_event_type type; /**< Type of event */
- union {
- struct {
- const uint8_t *buf; /**< Buffer of data */
- size_t len; /**< Length of buffer, in bytes */
- } data; /**< Received data */
- const char *msg; /**< Error or progress message */
- struct {
- nsurl *from; /**< Redirect origin */
- nsurl *to; /**< Redirect target */
- } redirect; /**< Fetch URL redirect occured */
- } data; /**< Event data */
-} llcache_event;
-
-/**
- * Client callback for low-level cache events
- *
- * \param handle Handle for which event is issued
- * \param event Event data
- * \param pw Pointer to client-specific data
- * \return NSERROR_OK on success, appropriate error otherwise.
- */
-typedef nserror (*llcache_handle_callback)(llcache_handle *handle,
- const llcache_event *event, void *pw);
-
/** Flags for low-level cache object retrieval */
enum llcache_retrieve_flag {
/* Note: We're permitted a maximum of 16 flags which must reside in the
@@ -140,6 +101,58 @@ typedef struct {
*/
typedef nserror (*llcache_query_response)(bool proceed, void *cbpw);
+/** Low-level cache event types */
+typedef enum {
+ LLCACHE_EVENT_HAD_HEADERS, /**< Received all headers */
+ LLCACHE_EVENT_HAD_DATA, /**< Received some data */
+ LLCACHE_EVENT_DONE, /**< Finished fetching data */
+
+ LLCACHE_EVENT_ERROR, /**< An error occurred during fetch */
+ LLCACHE_EVENT_PROGRESS, /**< Fetch progress update */
+
+ LLCACHE_EVENT_QUERY, /**< Fetch has a query and is paused */
+ LLCACHE_EVENT_QUERY_FINISHED, /**< Fetch had a query, but it is now finished */
+
+ LLCACHE_EVENT_REDIRECT /**< Fetch URL redirect occured */
+} llcache_event_type;
+
+/**
+ * Low-level cache events.
+ *
+ * Lifetime of contained information is only for the duration of the event
+ * and must be copied if it is desirable to retain.
+ */
+typedef struct {
+ llcache_event_type type; /**< Type of event */
+ union {
+ struct {
+ const uint8_t *buf; /**< Buffer of data */
+ size_t len; /**< Length of buffer, in bytes */
+ } data; /**< Received data */
+ const char *msg; /**< Error or progress message */
+ struct {
+ nsurl *from; /**< Redirect origin */
+ nsurl *to; /**< Redirect target */
+ } redirect; /**< Fetch URL redirect occured */
+ struct {
+ llcache_query *query; /**< Query information */
+ llcache_query_response cb; /**< Response callback */
+ void *cb_pw; /**< Response callback private word */
+ } query; /**< Query event */
+ } data; /**< Event data */
+} llcache_event;
+
+/**
+ * Client callback for low-level cache events
+ *
+ * \param handle Handle for which event is issued
+ * \param event Event data
+ * \param pw Pointer to client-specific data
+ * \return NSERROR_OK on success, appropriate error otherwise.
+ */
+typedef nserror (*llcache_handle_callback)(llcache_handle *handle,
+ const llcache_event *event, void *pw);
+
/**
* Callback to handle fetch-related queries
*