Files
wireplumber/lib/wp/event-dispatcher.h
George Kiagiadakis 3a23fb451a event-dispatcher: refactor to use before/after dependencies on hooks
* Remove entirely the hook priority numbers and use before/after dependencies
* Split the WpEvent code out of WpEventDispatcher
* Add methods on WpEvent to interface with it from the WpEventDispatcher.
  As a bonus, we can now also implement tooling to inspect which hooks would
  in theory run for an event and write tests around that
* Removed some internal debugging facilities and log calls, will redo it later.
* Using spa_list now for the list of hooks, to reduce the number of allocations
  happening in the "hook collection" algorithm
* Switched some internal data to use g_new0 instead of g_slice_new0
* Added g_free to free WpEvent structures... surprisingly, we were leaking them
  before
2023-04-17 07:48:18 -04:00

49 lines
1.2 KiB
C

/* WirePlumber
*
* Copyright © 2022 Collabora Ltd.
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
*
* SPDX-License-Identifier: MIT
*/
#ifndef __WIREPLUMBER_EVENT_DISPATCHER_H__
#define __WIREPLUMBER_EVENT_DISPATCHER_H__
#include "core.h"
#include "event.h"
#include "event-hook.h"
G_BEGIN_DECLS
/*! \defgroup wpeventdispatcher WpEventDispatcher */
/*!
* \struct WpEventDispatcher
*
* The event dispatcher holds all the events and hooks and dispatches them. It orchestras the show on event stack.
*/
#define WP_TYPE_EVENT_DISPATCHER (wp_event_dispatcher_get_type ())
WP_API
G_DECLARE_FINAL_TYPE (WpEventDispatcher, wp_event_dispatcher,
WP, EVENT_DISPATCHER, GObject)
WP_API
WpEventDispatcher * wp_event_dispatcher_get_instance (WpCore * core);
WP_API
void wp_event_dispatcher_push_event (WpEventDispatcher * self, WpEvent * event);
WP_API
void wp_event_dispatcher_register_hook (WpEventDispatcher * self,
WpEventHook * hook);
WP_API
void wp_event_dispatcher_unregister_hook (WpEventDispatcher * self,
WpEventHook * hook);
WP_API
WpIterator * wp_event_dispatcher_new_hooks_iterator (WpEventDispatcher * self);
G_END_DECLS
#endif