Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/e94fe1632e743cd75f588b3a031288b92e3ecb3a
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/e94fe1632e743cd75f588b3a031288b92e3ecb3a
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/e94fe1632e743cd75f588b3a031288b92e3ecb3a

The branch, master has been updated
       via  e94fe1632e743cd75f588b3a031288b92e3ecb3a (commit)
      from  d70beb28db6f978ae9fc674640f3101e20c05bb8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=e94fe1632e743cd75f588b3a031288b92e3ecb3a
commit e94fe1632e743cd75f588b3a031288b92e3ecb3a
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    Content API: Avoid content message copy in content user callback.

diff --git a/content/content.c b/content/content.c
index b53d2cb..45a4016 100644
--- a/content/content.c
+++ b/content/content.c
@@ -643,9 +643,13 @@ bool content_scaled_redraw(struct hlcache_handle *h,
  * called with the content.
  */
 
-bool content_add_user(struct content *c,
-               void (*callback)(struct content *c, content_msg msg,
-                       union content_msg_data data, void *pw),
+bool content_add_user(
+               struct content *c,
+               void (*callback)(
+                               struct content *c,
+                               content_msg msg,
+                               const union content_msg_data *data,
+                               void *pw),
                void *pw)
 {
        struct content_user *user;
@@ -673,9 +677,13 @@ bool content_add_user(struct content *c,
  * content_add_user().
  */
 
-void content_remove_user(struct content *c,
-               void (*callback)(struct content *c, content_msg msg,
-                       union content_msg_data data, void *pw),
+void content_remove_user(
+               struct content *c,
+               void (*callback)(
+                               struct content *c,
+                               content_msg msg,
+                               const union content_msg_data *data,
+                               void *pw),
                void *pw)
 {
        struct content_user *user, *next;
@@ -753,17 +761,13 @@ void content_broadcast(struct content *c, content_msg msg,
                const union content_msg_data *data)
 {
        struct content_user *user, *next;
-       union content_msg_data d = { 0 };
        assert(c);
 
-       if (data != NULL) {
-               d = *data;
-       }
 //     LOG("%p -> msg:%d", c, msg);
        for (user = c->user_list->next; user != 0; user = next) {
                next = user->next;  /* user may be destroyed during callback */
                if (user->callback != 0)
-                       user->callback(c, msg, d, user->pw);
+                       user->callback(c, msg, data, user->pw);
        }
 }
 
@@ -779,8 +783,10 @@ void content_broadcast_errorcode(struct content *c, 
nserror errorcode)
 
        for (user = c->user_list->next; user != 0; user = next) {
                next = user->next;  /* user may be destroyed during callback */
-               if (user->callback != 0)
-                       user->callback(c, CONTENT_MSG_ERRORCODE, data, 
user->pw);
+               if (user->callback != 0) {
+                       user->callback(c, CONTENT_MSG_ERRORCODE,
+                                       &data, user->pw);
+               }
        }
 }
 
diff --git a/content/content.h b/content/content.h
index 308b211..e555df2 100644
--- a/content/content.h
+++ b/content/content.h
@@ -200,10 +200,24 @@ union content_msg_data {
 void content_destroy(struct content *c);
 
 
-bool content_add_user(struct content *h, void (*callback)(struct content *c, 
content_msg msg, union content_msg_data data, void *pw), void *pw);
-
-
-void content_remove_user(struct content *c, void (*callback)(struct content 
*c, content_msg msg, union content_msg_data data, void *pw), void *pw);
+bool content_add_user(
+               struct content *h,
+               void (*callback)(
+                               struct content *c,
+                               content_msg msg,
+                               const union content_msg_data *data,
+                               void *pw),
+               void *pw);
+
+
+void content_remove_user(
+               struct content *c,
+               void (*callback)(
+                               struct content *c,
+                               content_msg msg,
+                               const union content_msg_data *data,
+                               void *pw),
+               void *pw);
 
 
 uint32_t content_count_users(struct content *c);
diff --git a/content/content_protected.h b/content/content_protected.h
index fe4fcda..21b73a6 100644
--- a/content/content_protected.h
+++ b/content/content_protected.h
@@ -92,8 +92,11 @@ struct content_handler {
 /** Linked list of users of a content. */
 struct content_user
 {
-       void (*callback)(struct content *c, content_msg msg,
-                       union content_msg_data data, void *pw);
+       void (*callback)(
+                       struct content *c,
+                       content_msg msg,
+                       const union content_msg_data *data,
+                       void *pw);
        void *pw;
 
        struct content_user *next;
diff --git a/content/hlcache.c b/content/hlcache.c
index 731c0bb..38a83ea 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -179,14 +179,16 @@ static bool hlcache_type_is_acceptable(lwc_string 
*mime_type,
  * \param pw   Pointer to private data (hlcache_handle)
  */
 static void hlcache_content_callback(struct content *c, content_msg msg,
-               union content_msg_data data, void *pw)
+               const union content_msg_data *data, void *pw)
 {
        hlcache_handle *handle = pw;
-       hlcache_event event;
+       hlcache_event event = { 0 };
        nserror error = NSERROR_OK;
 
        event.type = msg;
-       event.data = data;
+       if (data != NULL) {
+               event.data = *data;
+       }
 
        if (handle->cb != NULL)
                error = handle->cb(handle, &event, handle->pw);


-----------------------------------------------------------------------

Summary of changes:
 content/content.c           |   32 +++++++++++++++++++-------------
 content/content.h           |   22 ++++++++++++++++++----
 content/content_protected.h |    7 +++++--
 content/hlcache.c           |    8 +++++---
 4 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/content/content.c b/content/content.c
index b53d2cb..45a4016 100644
--- a/content/content.c
+++ b/content/content.c
@@ -643,9 +643,13 @@ bool content_scaled_redraw(struct hlcache_handle *h,
  * called with the content.
  */
 
-bool content_add_user(struct content *c,
-               void (*callback)(struct content *c, content_msg msg,
-                       union content_msg_data data, void *pw),
+bool content_add_user(
+               struct content *c,
+               void (*callback)(
+                               struct content *c,
+                               content_msg msg,
+                               const union content_msg_data *data,
+                               void *pw),
                void *pw)
 {
        struct content_user *user;
@@ -673,9 +677,13 @@ bool content_add_user(struct content *c,
  * content_add_user().
  */
 
-void content_remove_user(struct content *c,
-               void (*callback)(struct content *c, content_msg msg,
-                       union content_msg_data data, void *pw),
+void content_remove_user(
+               struct content *c,
+               void (*callback)(
+                               struct content *c,
+                               content_msg msg,
+                               const union content_msg_data *data,
+                               void *pw),
                void *pw)
 {
        struct content_user *user, *next;
@@ -753,17 +761,13 @@ void content_broadcast(struct content *c, content_msg msg,
                const union content_msg_data *data)
 {
        struct content_user *user, *next;
-       union content_msg_data d = { 0 };
        assert(c);
 
-       if (data != NULL) {
-               d = *data;
-       }
 //     LOG("%p -> msg:%d", c, msg);
        for (user = c->user_list->next; user != 0; user = next) {
                next = user->next;  /* user may be destroyed during callback */
                if (user->callback != 0)
-                       user->callback(c, msg, d, user->pw);
+                       user->callback(c, msg, data, user->pw);
        }
 }
 
@@ -779,8 +783,10 @@ void content_broadcast_errorcode(struct content *c, 
nserror errorcode)
 
        for (user = c->user_list->next; user != 0; user = next) {
                next = user->next;  /* user may be destroyed during callback */
-               if (user->callback != 0)
-                       user->callback(c, CONTENT_MSG_ERRORCODE, data, 
user->pw);
+               if (user->callback != 0) {
+                       user->callback(c, CONTENT_MSG_ERRORCODE,
+                                       &data, user->pw);
+               }
        }
 }
 
diff --git a/content/content.h b/content/content.h
index 308b211..e555df2 100644
--- a/content/content.h
+++ b/content/content.h
@@ -200,10 +200,24 @@ union content_msg_data {
 void content_destroy(struct content *c);
 
 
-bool content_add_user(struct content *h, void (*callback)(struct content *c, 
content_msg msg, union content_msg_data data, void *pw), void *pw);
-
-
-void content_remove_user(struct content *c, void (*callback)(struct content 
*c, content_msg msg, union content_msg_data data, void *pw), void *pw);
+bool content_add_user(
+               struct content *h,
+               void (*callback)(
+                               struct content *c,
+                               content_msg msg,
+                               const union content_msg_data *data,
+                               void *pw),
+               void *pw);
+
+
+void content_remove_user(
+               struct content *c,
+               void (*callback)(
+                               struct content *c,
+                               content_msg msg,
+                               const union content_msg_data *data,
+                               void *pw),
+               void *pw);
 
 
 uint32_t content_count_users(struct content *c);
diff --git a/content/content_protected.h b/content/content_protected.h
index fe4fcda..21b73a6 100644
--- a/content/content_protected.h
+++ b/content/content_protected.h
@@ -92,8 +92,11 @@ struct content_handler {
 /** Linked list of users of a content. */
 struct content_user
 {
-       void (*callback)(struct content *c, content_msg msg,
-                       union content_msg_data data, void *pw);
+       void (*callback)(
+                       struct content *c,
+                       content_msg msg,
+                       const union content_msg_data *data,
+                       void *pw);
        void *pw;
 
        struct content_user *next;
diff --git a/content/hlcache.c b/content/hlcache.c
index 731c0bb..38a83ea 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -179,14 +179,16 @@ static bool hlcache_type_is_acceptable(lwc_string 
*mime_type,
  * \param pw   Pointer to private data (hlcache_handle)
  */
 static void hlcache_content_callback(struct content *c, content_msg msg,
-               union content_msg_data data, void *pw)
+               const union content_msg_data *data, void *pw)
 {
        hlcache_handle *handle = pw;
-       hlcache_event event;
+       hlcache_event event = { 0 };
        nserror error = NSERROR_OK;
 
        event.type = msg;
-       event.data = data;
+       if (data != NULL) {
+               event.data = *data;
+       }
 
        if (handle->cb != NULL)
                error = handle->cb(handle, &event, handle->pw);


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to