Improve debug output so that content usage may be traced

svn path=/trunk/netsurf/; revision=3210
This commit is contained in:
John Mark Bell 2007-03-18 17:04:18 +00:00
parent 6d0795b923
commit 0d750eac73
1 changed files with 17 additions and 9 deletions

View File

@ -347,10 +347,13 @@ struct content * content_create(const char *url)
{ {
struct content *c; struct content *c;
struct content_user *user_sentinel; struct content_user *user_sentinel;
LOG(("url %s", url));
c = talloc(0, struct content); c = talloc(0, struct content);
if (!c) if (!c)
return 0; return 0;
LOG(("url %s -> %p", url, c));
user_sentinel = talloc(c, struct content_user); user_sentinel = talloc(c, struct content_user);
if (!user_sentinel) { if (!user_sentinel) {
talloc_free(c); talloc_free(c);
@ -528,7 +531,7 @@ bool content_set_type(struct content *c, content_type type,
assert(c->status == CONTENT_STATUS_TYPE_UNKNOWN); assert(c->status == CONTENT_STATUS_TYPE_UNKNOWN);
assert(type < CONTENT_UNKNOWN); assert(type < CONTENT_UNKNOWN);
LOG(("content %s, type %i", c->url, type)); LOG(("content %s (%p), type %i", c->url, c, type));
c->mime_type = talloc_strdup(c, mime_type); c->mime_type = talloc_strdup(c, mime_type);
if (!c->mime_type) { if (!c->mime_type) {
@ -721,7 +724,7 @@ void content_convert(struct content *c, int width, int height)
assert(c->type < HANDLER_MAP_COUNT); assert(c->type < HANDLER_MAP_COUNT);
assert(c->status == CONTENT_STATUS_LOADING); assert(c->status == CONTENT_STATUS_LOADING);
assert(!c->locked); assert(!c->locked);
LOG(("content %s", c->url)); LOG(("content %s (%p)", c->url, c));
if (c->source_allocated != c->source_size) { if (c->source_allocated != c->source_size) {
source_data = talloc_realloc(c, c->source_data, char, source_data = talloc_realloc(c, c->source_data, char,
@ -781,6 +784,7 @@ void content_reformat(struct content *c, int width, int height)
assert(c->status == CONTENT_STATUS_READY || assert(c->status == CONTENT_STATUS_READY ||
c->status == CONTENT_STATUS_DONE); c->status == CONTENT_STATUS_DONE);
assert(!c->locked); assert(!c->locked);
LOG(("%p %s", c, c->url));
c->locked = true; c->locked = true;
c->available_width = width; c->available_width = width;
if (handler_map[c->type].reformat) { if (handler_map[c->type].reformat) {
@ -943,6 +947,7 @@ bool content_redraw(struct content *c, int x, int y,
float scale, unsigned long background_colour) float scale, unsigned long background_colour)
{ {
assert(c != 0); assert(c != 0);
LOG(("%p %s", c, c->url));
if (c->locked) if (c->locked)
/* not safe to attempt redraw */ /* not safe to attempt redraw */
return true; return true;
@ -971,6 +976,8 @@ bool content_redraw_tiled(struct content *c, int x, int y,
assert(c != 0); assert(c != 0);
LOG(("%p %s", c, c->url));
if (c->locked) if (c->locked)
/* not safe to attempt redraw */ /* not safe to attempt redraw */
return true; return true;
@ -1036,8 +1043,8 @@ bool content_add_user(struct content *c,
{ {
struct content_user *user; struct content_user *user;
LOG(("content %s, user %p 0x%" PRIxPTR " 0x%" PRIxPTR, LOG(("content %s (%p), user %p 0x%" PRIxPTR " 0x%" PRIxPTR,
c->url, callback, p1, p2)); c->url, c, callback, p1, p2));
user = talloc(c, struct content_user); user = talloc(c, struct content_user);
if (!user) if (!user)
return false; return false;
@ -1088,8 +1095,8 @@ void content_remove_user(struct content *c,
intptr_t p1, intptr_t p2) intptr_t p1, intptr_t p2)
{ {
struct content_user *user, *next; struct content_user *user, *next;
LOG(("content %s, user %p 0x%" PRIxPTR " 0x%" PRIxPTR, LOG(("content %s (%p), user %p 0x%" PRIxPTR " 0x%" PRIxPTR,
c->url, callback, p1, p2)); c->url, c, callback, p1, p2));
/* user_list starts with a sentinel */ /* user_list starts with a sentinel */
for (user = c->user_list; user->next != 0 && for (user = c->user_list; user->next != 0 &&
@ -1117,6 +1124,7 @@ void content_broadcast(struct content *c, content_msg msg,
{ {
struct content_user *user, *next; struct content_user *user, *next;
assert(c); assert(c);
LOG(("%p %s -> %d", c, c->url, msg));
for (user = c->user_list->next; user != 0; user = next) { for (user = c->user_list->next; user != 0; user = next) {
next = user->next; /* user may be destroyed during callback */ next = user->next; /* user may be destroyed during callback */
if (user->callback != 0) if (user->callback != 0)
@ -1202,7 +1210,7 @@ void content_open(struct content *c, struct browser_window *bw,
{ {
assert(c != 0); assert(c != 0);
assert(c->type < CONTENT_UNKNOWN); assert(c->type < CONTENT_UNKNOWN);
LOG(("content %s", c->url)); LOG(("content %p %s", c, c->url));
if (handler_map[c->type].open) if (handler_map[c->type].open)
handler_map[c->type].open(c, bw, page, index, box, params); handler_map[c->type].open(c, bw, page, index, box, params);
} }
@ -1218,7 +1226,7 @@ void content_close(struct content *c)
{ {
assert(c != 0); assert(c != 0);
assert(c->type < CONTENT_UNKNOWN); assert(c->type < CONTENT_UNKNOWN);
LOG(("content %s", c->url)); LOG(("content %p %s", c, c->url));
if (handler_map[c->type].close) if (handler_map[c->type].close)
handler_map[c->type].close(c); handler_map[c->type].close(c);
} }