r10079 jmb - in /branches/jmb/new-cache/content: hlcache.c hlcache.h

netsurf at semichrome.net netsurf at semichrome.net
Thu Feb 25 00:46:17 GMT 2010


Author: jmb
Date: Wed Feb 24 18:46:17 2010
New Revision: 10079

URL: http://source.netsurf-browser.org?rev=10079&view=rev
Log:
Revert r10072

Modified:
    branches/jmb/new-cache/content/hlcache.c
    branches/jmb/new-cache/content/hlcache.h

Modified: branches/jmb/new-cache/content/hlcache.c
URL: http://source.netsurf-browser.org/branches/jmb/new-cache/content/hlcache.c?rev=10079&r1=10078&r2=10079&view=diff
==============================================================================
--- branches/jmb/new-cache/content/hlcache.c (original)
+++ branches/jmb/new-cache/content/hlcache.c Wed Feb 24 18:46:17 2010
@@ -179,6 +179,29 @@
 	/** \todo Provide hlcache_poll() to perform cache maintenance */
 
 	return NSERROR_OK;
+}
+
+/**
+ * Retrieve a content object from a cache handle
+ *
+ * \param handle  Cache handle to dereference
+ * \return Pointer to content object, or NULL if there is none
+ *
+ * \todo This may not be correct. Ideally, the client should never need to 
+ * directly access a content object. It may, therefore, be better to provide a 
+ * bunch of veneers here that take a hlcache_handle and invoke the 
+ * corresponding content_ API. If there's no content object associated with the
+ * hlcache_handle (e.g. because the source data is still being fetched, so it 
+ * doesn't exist yet), then these veneers would behave as a NOP. The important 
+ * thing being that the client need not care about this possibility and can 
+ * just call the functions with impugnity.
+ */
+struct content *hlcache_handle_get_content(const hlcache_handle *handle)
+{
+	if (handle->entry != NULL)
+		return handle->entry->content;
+
+	return NULL;
 }
 
 /******************************************************************************

Modified: branches/jmb/new-cache/content/hlcache.h
URL: http://source.netsurf-browser.org/branches/jmb/new-cache/content/hlcache.h?rev=10079&r1=10078&r2=10079&view=diff
==============================================================================
--- branches/jmb/new-cache/content/hlcache.h (original)
+++ branches/jmb/new-cache/content/hlcache.h Wed Feb 24 18:46:17 2010
@@ -94,4 +94,21 @@
  */
 nserror hlcache_handle_release(hlcache_handle *handle);
 
+/**
+ * Retrieve a content object from a cache handle
+ *
+ * \param handle  Cache handle to dereference
+ * \return Pointer to content object, or NULL if there is none
+ *
+ * \todo This may not be correct. Ideally, the client should never need to 
+ * directly access a content object. It may, therefore, be better to provide a 
+ * bunch of veneers here that take a hlcache_handle and invoke the 
+ * corresponding content_ API. If there's no content object associated with the
+ * hlcache_handle (e.g. because the source data is still being fetched, so it 
+ * doesn't exist yet), then these veneers would behave as a NOP. The important 
+ * thing being that the client need not care about this possibility and can 
+ * just call the functions with impugnity.
+ */
+struct content *hlcache_handle_get_content(const hlcache_handle *handle);
+
 #endif




More information about the netsurf-commits mailing list