mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 12:12:35 +03:00
Introduce content_set_ready.
Make content_convert emit events only if content is in appropriate state. Remove no-longer-relevant assertion from content_convert. svn path=/trunk/netsurf/; revision=10330
This commit is contained in:
parent
b2124867db
commit
4a4cc0d1bc
@ -646,8 +646,6 @@ void content_update_status(struct content *c)
|
|||||||
|
|
||||||
void content_convert(struct content *c)
|
void content_convert(struct content *c)
|
||||||
{
|
{
|
||||||
union content_msg_data msg_data;
|
|
||||||
|
|
||||||
assert(c);
|
assert(c);
|
||||||
assert(c->type < HANDLER_MAP_COUNT);
|
assert(c->type < HANDLER_MAP_COUNT);
|
||||||
assert(c->status == CONTENT_STATUS_LOADING);
|
assert(c->status == CONTENT_STATUS_LOADING);
|
||||||
@ -661,21 +659,30 @@ void content_convert(struct content *c)
|
|||||||
if (handler_map[c->type].convert) {
|
if (handler_map[c->type].convert) {
|
||||||
if (!handler_map[c->type].convert(c)) {
|
if (!handler_map[c->type].convert(c)) {
|
||||||
c->status = CONTENT_STATUS_ERROR;
|
c->status = CONTENT_STATUS_ERROR;
|
||||||
c->locked = false;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
c->status = CONTENT_STATUS_DONE;
|
c->status = CONTENT_STATUS_DONE;
|
||||||
}
|
}
|
||||||
c->locked = false;
|
c->locked = false;
|
||||||
|
|
||||||
assert(c->status == CONTENT_STATUS_READY ||
|
if (c->status == CONTENT_STATUS_READY)
|
||||||
c->status == CONTENT_STATUS_DONE);
|
content_set_ready(c);
|
||||||
content_broadcast(c, CONTENT_MSG_READY, msg_data);
|
|
||||||
if (c->status == CONTENT_STATUS_DONE)
|
if (c->status == CONTENT_STATUS_DONE)
|
||||||
content_set_done(c);
|
content_set_done(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put a content in status CONTENT_STATUS_READY.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void content_set_ready(struct content *c)
|
||||||
|
{
|
||||||
|
union content_msg_data msg_data;
|
||||||
|
|
||||||
|
c->status = CONTENT_STATUS_READY;
|
||||||
|
content_update_status(c);
|
||||||
|
content_broadcast(c, CONTENT_MSG_READY, msg_data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a content in status CONTENT_STATUS_DONE.
|
* Put a content in status CONTENT_STATUS_DONE.
|
||||||
|
@ -195,6 +195,7 @@ struct content {
|
|||||||
extern const char * const content_type_name[];
|
extern const char * const content_type_name[];
|
||||||
extern const char * const content_status_name[];
|
extern const char * const content_status_name[];
|
||||||
|
|
||||||
|
void content_set_ready(struct content *c);
|
||||||
void content_set_done(struct content *c);
|
void content_set_done(struct content *c);
|
||||||
void content_set_status(struct content *c, const char *status_message, ...);
|
void content_set_status(struct content *c, const char *status_message, ...);
|
||||||
void content_broadcast(struct content *c, content_msg msg,
|
void content_broadcast(struct content *c, content_msg msg,
|
||||||
|
Loading…
Reference in New Issue
Block a user