diff --git a/amiga/icon.c b/amiga/icon.c index d31091489..57827adeb 100644 --- a/amiga/icon.c +++ b/amiga/icon.c @@ -160,7 +160,8 @@ bool amiga_icon_convert(struct content *c) c->height = height; bitmap_modified(c->bitmap); - c->status = CONTENT_STATUS_DONE; + content_set_ready(c); + content_set_done(c); content_set_status(c, ""); if(dobj) FreeDiskObject(dobj); diff --git a/content/content.c b/content/content.c index 60996f6a0..35b6a2096 100644 --- a/content/content.c +++ b/content/content.c @@ -686,19 +686,13 @@ void content_convert(struct content *c) LOG(("content %s (%p)", llcache_handle_get_url(c->llcache), c)); - c->locked = true; if (handler_map[c->type].convert) { + c->locked = true; if (!handler_map[c->type].convert(c)) { c->status = CONTENT_STATUS_ERROR; } + c->locked = false; } else { - c->status = CONTENT_STATUS_DONE; - } - c->locked = false; - - if (c->status == CONTENT_STATUS_READY) - content_set_ready(c); - if (c->status == CONTENT_STATUS_DONE) { content_set_ready(c); content_set_done(c); } diff --git a/css/css.c b/css/css.c index 0964869a2..ffae4db38 100644 --- a/css/css.c +++ b/css/css.c @@ -32,6 +32,9 @@ #include "utils/log.h" #include "utils/messages.h" +/* Define to trace import fetches */ +#undef NSCSS_IMPORT_TRACE + /** * Context for import fetches */ @@ -370,14 +373,8 @@ void nscss_content_done(struct content_css_data *css, void *pw) } /* Finally, catch the content's users up with reality */ - if (css->import_count == 0) { - /* No imports? Ok, so we've not returned from nscss_convert yet. - * Just set the status, as content_convert will notify users */ - c->status = CONTENT_STATUS_DONE; - } else { - content_set_ready(c); - content_set_done(c); - } + content_set_ready(c); + content_set_done(c); } /***************************************************************************** @@ -447,6 +444,12 @@ css_error nscss_handle_import(void *pw, css_stylesheet *parent, return CSS_NOMEM; } +#ifdef NSCSS_IMPORT_TRACE + LOG(("Import %d '%s' -> (handle: %p ctx: %p)", + c->import_count, lwc_string_data(url), + c->imports[c->import_count].c, ctx)); +#endif + c->import_count++; return CSS_OK; @@ -466,6 +469,10 @@ nserror nscss_import(hlcache_handle *handle, nscss_import_ctx *ctx = pw; css_error error = CSS_OK; +#ifdef NSCSS_IMPORT_TRACE + LOG(("Event %d for %p (%p)", event->type, handle, ctx)); +#endif + assert(ctx->css->imports[ctx->index].c == handle); switch (event->type) { @@ -510,6 +517,10 @@ css_error nscss_import_complete(nscss_import_ctx *ctx) if (ctx->css->next_to_register == ctx->index) error = nscss_register_imports(ctx->css); +#ifdef NSCSS_IMPORT_TRACE + LOG(("Destroying import context %p for %d", ctx, ctx->index)); +#endif + /* No longer need import context */ free(ctx); diff --git a/image/bmp.c b/image/bmp.c index f40cfb06c..1e8ec5be9 100644 --- a/image/bmp.c +++ b/image/bmp.c @@ -108,7 +108,9 @@ bool nsbmp_convert(struct content *c) /* exit as a success */ c->bitmap = bmp->bitmap; bitmap_modified(c->bitmap); - c->status = CONTENT_STATUS_DONE; + + content_set_ready(c); + content_set_done(c); /* Done: update status bar */ content_set_status(c, ""); diff --git a/image/gif.c b/image/gif.c index 94cba25f1..8afe79485 100644 --- a/image/gif.c +++ b/image/gif.c @@ -138,7 +138,8 @@ bool nsgif_convert(struct content *c) /* Exit as a success */ c->bitmap = gif->frame_image; - c->status = CONTENT_STATUS_DONE; + content_set_ready(c); + content_set_done(c); /* Done: update status bar */ content_set_status(c, ""); return true; diff --git a/image/ico.c b/image/ico.c index f147bad08..a753f470b 100644 --- a/image/ico.c +++ b/image/ico.c @@ -97,7 +97,9 @@ bool nsico_convert(struct content *c) assert(bmp); c->bitmap = bmp->bitmap; bitmap_modified(c->bitmap); - c->status = CONTENT_STATUS_DONE; + + content_set_ready(c); + content_set_done(c); /* Done: update status bar */ content_set_status(c, ""); diff --git a/image/jpeg.c b/image/jpeg.c index 4d7aa32f7..7ef621121 100644 --- a/image/jpeg.c +++ b/image/jpeg.c @@ -167,7 +167,8 @@ bool nsjpeg_convert(struct content *c) width, height, size); content__set_title(c, title); c->size += height * rowstride; - c->status = CONTENT_STATUS_DONE; + content_set_ready(c); + content_set_done(c); /* Done: update status bar */ content_set_status(c, ""); return true; diff --git a/image/mng.c b/image/mng.c index 4ebba304d..1674dd033 100644 --- a/image/mng.c +++ b/image/mng.c @@ -330,7 +330,8 @@ bool nsmng_convert(struct content *c) content__set_title(c, title); c->size += c->width * c->height * 4; - c->status = CONTENT_STATUS_DONE; + content_set_ready(c); + content_set_done(c); /* Done: update status bar */ content_set_status(c, ""); diff --git a/image/nssprite.c b/image/nssprite.c index 7bff6e0f7..a0ad8678c 100644 --- a/image/nssprite.c +++ b/image/nssprite.c @@ -112,7 +112,9 @@ bool nssprite_convert(struct content *c) c->width = sprite->width; c->height = sprite->height; bitmap_modified(c->bitmap); - c->status = CONTENT_STATUS_DONE; + + content_set_ready(c); + content_set_done(c); return true; } diff --git a/image/png.c b/image/png.c index cbad15029..159019996 100644 --- a/image/png.c +++ b/image/png.c @@ -289,7 +289,8 @@ bool nspng_convert(struct content *c) c->bitmap = c->data.png.bitmap; bitmap_set_opaque(c->bitmap, bitmap_test_opaque(c->bitmap)); bitmap_modified(c->bitmap); - c->status = CONTENT_STATUS_DONE; + content_set_ready(c); + content_set_done(c); content_set_status(c, ""); return true; diff --git a/image/rsvg.c b/image/rsvg.c index 7f88d82ad..cf3d5cea6 100644 --- a/image/rsvg.c +++ b/image/rsvg.c @@ -173,7 +173,8 @@ bool rsvg_convert(struct content *c) c->bitmap = d->bitmap; bitmap_modified(c->bitmap); - c->status = CONTENT_STATUS_DONE; + content_set_ready(c); + content_set_done(c); /* Done: update status bar */ content_set_status(c, ""); diff --git a/image/svg.c b/image/svg.c index 43675faae..a6cb06c2b 100644 --- a/image/svg.c +++ b/image/svg.c @@ -70,7 +70,8 @@ bool svg_convert(struct content *c) snprintf(c->title, 100, messages_get("svgTitle"), width, height, c->source_size);*/ //c->size += ?; - c->status = CONTENT_STATUS_DONE; + content_set_ready(c); + content_set_done(c); /* Done: update status bar */ content_set_status(c, ""); diff --git a/image/webp.c b/image/webp.c index e4375637f..449b069fb 100644 --- a/image/webp.c +++ b/image/webp.c @@ -107,7 +107,9 @@ bool webp_convert(struct content *c) content__set_title(c, title); bitmap_modified(c->bitmap); - c->status = CONTENT_STATUS_DONE; + + content_set_ready(c); + content_set_done(c); content_set_status(c, ""); return true; diff --git a/render/textplain.c b/render/textplain.c index 2a31c6272..0879841fe 100644 --- a/render/textplain.c +++ b/render/textplain.c @@ -301,7 +301,8 @@ bool textplain_convert(struct content *c) parserutils_inputstream_destroy(stream); c->data.textplain.inputstream = NULL; - c->status = CONTENT_STATUS_DONE; + content_set_ready(c); + content_set_done(c); content_set_status(c, messages_get("Done")); return true; diff --git a/riscos/artworks.c b/riscos/artworks.c index 318666bea..45bba1a13 100644 --- a/riscos/artworks.c +++ b/riscos/artworks.c @@ -202,7 +202,8 @@ bool artworks_convert(struct content *c) snprintf(title, sizeof(title), messages_get("ArtWorksTitle"), c->width, c->height, source_size); content__set_title(c, title); - c->status = CONTENT_STATUS_DONE; + content_set_ready(c); + content_set_done(c); /* Done: update status bar */ content_set_status(c, ""); return true; diff --git a/riscos/draw.c b/riscos/draw.c index b5c13d621..76bda452f 100644 --- a/riscos/draw.c +++ b/riscos/draw.c @@ -84,7 +84,8 @@ bool draw_convert(struct content *c) c->height, source_size); content__set_title(c, title); - c->status = CONTENT_STATUS_DONE; + content_set_ready(c); + content_set_done(c); /* Done: update status bar */ content_set_status(c, ""); return true; diff --git a/riscos/plugin.c b/riscos/plugin.c index 19fd2b806..25b2afe54 100644 --- a/riscos/plugin.c +++ b/riscos/plugin.c @@ -219,7 +219,9 @@ bool plugin_convert(struct content *c, int width, int height) c->width = width; c->height = height; - c->status = CONTENT_STATUS_DONE; + content_set_ready(c); + content_set_done(c); + return true; } diff --git a/riscos/sprite.c b/riscos/sprite.c index fbff2f885..55afa6f98 100644 --- a/riscos/sprite.c +++ b/riscos/sprite.c @@ -89,7 +89,8 @@ bool sprite_convert(struct content *c) snprintf(title, sizeof(title), messages_get("SpriteTitle"), c->width, c->height, source_size); content__set_title(c, title); - c->status = CONTENT_STATUS_DONE; + content_set_ready(c); + content_set_done(c); /* Done: update status bar */ content_set_status(c, ""); return true;