summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-06-16 16:42:22 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-06-22 14:39:33 -0700
commitad7c9b5c58fb6e6bfcf53455db1cf96a360ca68f (patch)
tree4258b4bd80d3220a9cefb99cc4cdd34d164ed2c9
parentfc1271d17837297d0a53ac1265fc639f2b3ccfc6 (diff)
eio: instantiate some default Efl.Io.Manager and an Efl.Uri.Mapper for files.devs/cedric/uri
-rw-r--r--src/lib/eio/eio_main.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/eio/eio_main.c b/src/lib/eio/eio_main.c
index de050f2a2f..1e9b5d288c 100644
--- a/src/lib/eio/eio_main.c
+++ b/src/lib/eio/eio_main.c
@@ -57,6 +57,10 @@ static Eina_Lock memory_pool_mutex;
57static Eina_Condition memory_pool_cond; 57static Eina_Condition memory_pool_cond;
58static Eina_Bool memory_pool_suspended = 1; 58static Eina_Bool memory_pool_suspended = 1;
59static Efl_Io_Manager *io_manager = NULL; 59static Efl_Io_Manager *io_manager = NULL;
60static Efl_Uri_Mapper *file_mapper = NULL;
61
62// Internal API from ecore to only be used here
63EAPI void efl_uri_manager_default_set(Efl_Uri_Manager *obj, Efl_Uri_Mapper *def);
60 64
61static void * 65static void *
62_eio_pool_malloc(Eio_Alloc_Pool *pool) 66_eio_pool_malloc(Eio_Alloc_Pool *pool)
@@ -274,6 +278,8 @@ eio_file_unregister(Eio_File *common)
274EAPI int 278EAPI int
275eio_init(void) 279eio_init(void)
276{ 280{
281 Efl_Uri_Manager *uri_manager;
282
277 if (++_eio_init_count != 1) 283 if (++_eio_init_count != 1)
278 return _eio_init_count; 284 return _eio_init_count;
279 285
@@ -321,6 +327,12 @@ eio_init(void)
321 io_manager = eo_add(EFL_IO_MANAGER_CLASS, ecore_main_loop_get()); 327 io_manager = eo_add(EFL_IO_MANAGER_CLASS, ecore_main_loop_get());
322 efl_loop_register(ecore_main_loop_get(), EFL_IO_MANAGER_CLASS, io_manager); 328 efl_loop_register(ecore_main_loop_get(), EFL_IO_MANAGER_CLASS, io_manager);
323 329
330 // Add default URI mapper for file (serving also "file://").
331 file_mapper = eo_add(EFL_URI_MAPPER_FILE_CLASS, io_manager);
332 uri_manager = eo_provider_find(ecore_main_loop_get(), EFL_URI_MANAGER_CLASS);
333 efl_uri_manager_register_mapper(uri_manager, "file", file_mapper);
334 efl_uri_manager_default_set(uri_manager, file_mapper);
335
324 eina_log_timing(_eio_log_dom_global, 336 eina_log_timing(_eio_log_dom_global,
325 EINA_LOG_STATE_STOP, 337 EINA_LOG_STATE_STOP,
326 EINA_LOG_STATE_INIT); 338 EINA_LOG_STATE_INIT);
@@ -357,6 +369,11 @@ eio_shutdown(void)
357 EINA_LOG_STATE_START, 369 EINA_LOG_STATE_START,
358 EINA_LOG_STATE_SHUTDOWN); 370 EINA_LOG_STATE_SHUTDOWN);
359 371
372 // Right now URI manager does hold a reference on the file_mapper
373 // We need to unregister it to be able to properly delete it.
374 efl_uri_manager_unregister_mapper(eo_provider_find(ecore_main_loop_get(), EFL_URI_MANAGER_CLASS),
375 "file", file_mapper);
376 eo_del(file_mapper);
360 eo_del(io_manager); 377 eo_del(io_manager);
361 io_manager = NULL; 378 io_manager = NULL;
362 379