Commit 9f71a4ad authored by Marius Vlad's avatar Marius Vlad

weston-log: Introduce subscribe functionality

As described in e10c9f89: "weston-debug: Introduce...", the
subscriber object need further functionality to make use of it.

Current form of the weston-debug protocol would not need this, as it
creates underneath a new subscriber each time a client connects and
subscriptions are created/destroyed automatically with the help of
wayland protocol. For other types of streams, we require to manually
create a subscriber and to subscribe to log scopes.

This patch introduces the ability to create subscriptions, and
implicitly to subscribe to (previously created) scopes.

In the event the scope(s) are not created we temporary store the
subscription as a pending one: a subscription for which a scope doesn't
exist at the time of the subscription. When the scope for which the
subscription has been created we take care to create the subscription as
well.

While at it the documentation bits are modified accommodate the subscribe
method and its further functionality.

Lastly, it removes an unlikely case when a scope is not created so we
avoid any kind of dandling (pending) subscription in case there is
subscription to it. We can only do something about in the destroy part
of the scope.
Signed-off-by: Marius Vlad's avatarMarius Vlad <marius.vlad@collabora.com>
Suggested-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
parent c901e891
......@@ -37,6 +37,7 @@ extern "C" {
struct weston_compositor;
struct weston_log_context;
struct wl_display;
struct weston_log_subscriber;
void
weston_compositor_enable_debug_protocol(struct weston_compositor *);
......@@ -90,6 +91,11 @@ char *
weston_log_scope_timestamp(struct weston_log_scope *scope,
char *buf, size_t len);
void
weston_log_subscribe(struct weston_log_context *log_ctx,
struct weston_log_subscriber *subscriber,
const char *scope_name);
#ifdef __cplusplus
}
#endif
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment