Registry: implement registry

Make GET_REGISTRY method to create a registry resource, send global
added and removed to this resource.
Use map for storing proxies and resources.
This commit is contained in:
Wim Taymans 2016-11-30 19:09:09 +01:00
parent 3dada4731c
commit 7c29209023
15 changed files with 221 additions and 59 deletions

View file

@ -51,7 +51,7 @@ pinos_client_new (PinosCore *core,
this->core = core;
this->properties = properties;
spa_list_init (&this->resource_list);
pinos_map_init (&this->objects, 64);
pinos_signal_init (&this->destroy_signal);
spa_list_insert (core->client_list.prev, &this->link);
@ -80,6 +80,13 @@ sync_destroy (void *object,
free (impl);
}
static void
destroy_resource (void *object,
void *data)
{
pinos_resource_destroy (object);
}
/**
* pinos_client_destroy:
* @client: a #PinosClient
@ -89,13 +96,10 @@ sync_destroy (void *object,
void
pinos_client_destroy (PinosClient * client)
{
PinosResource *resource, *tmp;
pinos_log_debug ("client %p: destroy", client);
pinos_signal_emit (&client->destroy_signal, client);
spa_list_for_each_safe (resource, tmp, &client->resource_list, link)
pinos_resource_destroy (resource);
pinos_map_for_each (&client->objects, destroy_resource, client);
pinos_global_destroy (client->global);
spa_list_remove (&client->link);