diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-08 09:34:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-08 09:34:06 +0300 |
commit | 6feb6235e1b4813763ee2852ecae1b03b08327f3 (patch) | |
tree | 0e85967aa5844d3b3da4c5fba1f9a6cca4dc8d31 | |
parent | 6f57d12e2e4a7d0e094bdfeb56cadd752fbe6207 (diff) |
WM: log message bus operations
5 files changed, 43 insertions, 4 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index ffd2a036ffb..825948a13a9 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -720,6 +720,8 @@ extern struct CLG_LogRef *WM_LOG_HANDLERS; extern struct CLG_LogRef *WM_LOG_EVENTS; extern struct CLG_LogRef *WM_LOG_KEYMAPS; extern struct CLG_LogRef *WM_LOG_TOOLS; +extern struct CLG_LogRef *WM_LOG_MSGBUS_PUB; +extern struct CLG_LogRef *WM_LOG_MSGBUS_SUB; #ifdef __cplusplus diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 1f17efa0845..9017f21504d 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -137,6 +137,8 @@ CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_HANDLERS, "wm.handler"); CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_EVENTS, "wm.event"); CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_KEYMAPS, "wm.keymap"); CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_TOOLS, "wm.tool"); +CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_MSGBUS_PUB, "wm.msgbus.pub"); +CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_MSGBUS_SUB, "wm.msgbus.sub"); static void wm_init_reports(bContext *C) { diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus.c b/source/blender/windowmanager/message_bus/intern/wm_message_bus.c index 06a9c2de69b..63a897b2faf 100644 --- a/source/blender/windowmanager/message_bus/intern/wm_message_bus.c +++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus.c @@ -24,6 +24,10 @@ #include <string.h> +#include "CLG_log.h" + +#include "MEM_guardedalloc.h" + #include "BLI_utildefines.h" #include "BLI_listbase.h" @@ -31,8 +35,6 @@ #include "WM_types.h" -#include "MEM_guardedalloc.h" - #include "message_bus/wm_message_bus.h" #include "message_bus/intern/wm_message_bus_intern.h" @@ -194,6 +196,12 @@ wmMsgSubscribeKey *WM_msg_subscribe_with_key( void WM_msg_publish_with_key(struct wmMsgBus *mbus, wmMsgSubscribeKey *msg_key) { + CLOG_INFO( + WM_LOG_MSGBUS_SUB, 2, + "tagging subscribers: (ptr=%p, len=%d)", + msg_key, BLI_listbase_count(&msg_key->values) + ); + for (wmMsgSubscribeValueLink *msg_lnk = msg_key->values.first; msg_lnk; msg_lnk = msg_lnk->next) { if (false) { /* make an option? */ msg_lnk->params.notify(NULL, msg_key, &msg_lnk->params); diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c b/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c index 67b96f3d8b3..619777fc671 100644 --- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c +++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c @@ -24,6 +24,10 @@ #include <stdio.h> + +#include "CLG_log.h" +#include "MEM_guardedalloc.h" + #include "DNA_ID.h" #include "BLI_utildefines.h" @@ -36,7 +40,6 @@ #include "RNA_access.h" -#include "MEM_guardedalloc.h" /* -------------------------------------------------------------------------- */ @@ -207,6 +210,15 @@ void WM_msg_publish_rna_params(struct wmMsgBus *mbus, const wmMsgParams_RNA *msg { wmMsgSubscribeKey_RNA *key; + const char *none = "<none>"; + CLOG_INFO( + WM_LOG_MSGBUS_PUB, 2, + "rna(id='%s', %s.%s)", + msg_key_params->ptr.id.data ? ((ID *)msg_key_params->ptr.id.data)->name : none, + msg_key_params->ptr.type ? RNA_struct_identifier(msg_key_params->ptr.type) : none, + msg_key_params->prop ? RNA_property_identifier((PropertyRNA *)msg_key_params->prop) : none + ); + if ((key = WM_msg_lookup_rna(mbus, msg_key_params))) { WM_msg_publish_with_key(mbus, &key->head); } @@ -261,6 +273,16 @@ void WM_msg_subscribe_rna_params( /* for lookup */ msg_key_test.msg.params = *msg_key_params; + const char *none = "<none>"; + CLOG_INFO( + WM_LOG_MSGBUS_SUB, 3, + "rna(id='%s', %s.%s, info='%s')", + msg_key_params->ptr.id.data ? ((ID *)msg_key_params->ptr.id.data)->name : none, + msg_key_params->ptr.type ? RNA_struct_identifier(msg_key_params->ptr.type) : none, + msg_key_params->prop ? RNA_property_identifier((PropertyRNA *)msg_key_params->prop) : none, + id_repr + ); + wmMsgSubscribeKey_RNA *msg_key = (wmMsgSubscribeKey_RNA *)WM_msg_subscribe_with_key( mbus, &msg_key_test.head, msg_val_params); diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c b/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c index da98cb75162..64894ae164d 100644 --- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c +++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c @@ -24,6 +24,10 @@ #include <stdio.h> +#include "CLG_log.h" + +#include "MEM_guardedalloc.h" + #include "BLI_utildefines.h" #include "BLI_ghash.h" #include "BLI_listbase.h" @@ -32,7 +36,6 @@ #include "WM_message.h" #include "message_bus/intern/wm_message_bus_intern.h" -#include "MEM_guardedalloc.h" /* -------------------------------------------------------------------------- */ @@ -98,6 +101,8 @@ wmMsgSubscribeKey_Static *WM_msg_lookup_static(struct wmMsgBus *mbus, const wmMs void WM_msg_publish_static_params(struct wmMsgBus *mbus, const wmMsgParams_Static *msg_key_params) { + CLOG_INFO(WM_LOG_MSGBUS_PUB, 2, "static(event=%d)", msg_key_params->event); + wmMsgSubscribeKey_Static *key = WM_msg_lookup_static(mbus, msg_key_params); if (key) { WM_msg_publish_with_key(mbus, &key->head); |