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
This commit is contained in:
George Kiagiadakis
2022-11-29 20:08:13 +02:00
committed by Julian Bouzas
parent 5a435fae11
commit 3a23fb451a
15 changed files with 1019 additions and 519 deletions

View File

@@ -191,24 +191,11 @@ local Feature = {
},
}
local HookPriority = {
LOWEST = -500,
ULTRA_LOW = -300,
VERY_LOW = -200,
LOW = -100,
NORMAL = 0,
HIGH = 100,
VERY_HIGH = 200,
ULTRA_HIGH = 300,
HIGHEST = 500,
}
SANDBOX_EXPORT = {
Debug = Debug,
Id = Id,
Features = Features,
Feature = Feature,
HookPriority = HookPriority,
GLib = GLib,
I18n = I18n,
Log = WpLog,