summaryrefslogtreecommitdiff
path: root/content/content.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-02-28 19:58:08 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-02-28 19:58:08 +0000
commitabbf958b4cd9af05933f33a3bbf923d077099caa (patch)
tree56fa16432e02a1b7cc36ba0c6e6dc759dbf5535c /content/content.c
parent4a174fd6706497b41007ad3c862286c926ef88b6 (diff)
downloadnetsurf-abbf958b4cd9af05933f33a3bbf923d077099caa.tar.gz
netsurf-abbf958b4cd9af05933f33a3bbf923d077099caa.tar.bz2
Unlock the content when transitioning into the READY state.
svn path=/trunk/netsurf/; revision=11859
Diffstat (limited to 'content/content.c')
-rw-r--r--content/content.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/content/content.c b/content/content.c
index 35b6a2096..8db831255 100644
--- a/content/content.c
+++ b/content/content.c
@@ -688,24 +688,37 @@ void content_convert(struct content *c)
if (handler_map[c->type].convert) {
c->locked = true;
- if (!handler_map[c->type].convert(c)) {
+ if (handler_map[c->type].convert(c) == false) {
+ c->locked = false;
c->status = CONTENT_STATUS_ERROR;
}
- c->locked = false;
+ /* Conversion to the READY state will unlock the content */
} else {
content_set_ready(c);
content_set_done(c);
}
+
+ /* After conversion, the content must be in error or either the
+ * READY or DONE state and must not be locked */
+ assert(c->status == CONTENT_STATUS_READY ||
+ c->status == CONTENT_STATUS_DONE ||
+ c->status == CONTENT_STATUS_ERROR);
+ assert(c->locked == false);
}
/**
- * Put a content in status CONTENT_STATUS_READY.
+ * Put a content in status CONTENT_STATUS_READY and unlock the content.
*/
void content_set_ready(struct content *c)
{
union content_msg_data msg_data;
+ /* The content must be locked at this point, as it can only
+ * become READY after conversion. */
+ assert(c->locked);
+ c->locked = false;
+
c->status = CONTENT_STATUS_READY;
content_update_status(c);
content_broadcast(c, CONTENT_MSG_READY, msg_data);
@@ -743,7 +756,7 @@ void content__reformat(struct content *c, int width, int height)
assert(c != 0);
assert(c->status == CONTENT_STATUS_READY ||
c->status == CONTENT_STATUS_DONE);
- assert(!c->locked);
+ assert(c->locked == false);
LOG(("%p %s", c, llcache_handle_get_url(c->llcache)));
c->locked = true;
c->available_width = width;
@@ -765,7 +778,7 @@ void content_destroy(struct content *c)
{
assert(c);
LOG(("content %p %s", c, llcache_handle_get_url(c->llcache)));
- assert(!c->locked);
+ assert(c->locked == false);
if (c->type < HANDLER_MAP_COUNT && handler_map[c->type].destroy)
handler_map[c->type].destroy(c);