Delayed load module added 21/71221/3
authorJunghwan Choi <jhhh.choi@samsung.com>
Tue, 24 May 2016 12:22:44 +0000 (21:22 +0900)
committerJunghwan Choi <jhhh.choi@samsung.com>
Wed, 25 May 2016 06:08:27 +0000 (15:08 +0900)
Change-Id: I3a29a6bb8b8fc61b0c416fc5bd020b01d8fa24e2
Signed-off-by: Junghwan Choi <jhhh.choi@samsung.com>
src/bin/e_config.c
src/bin/e_config.h
src/bin/e_module.c

index bfefc5b..1dc9bcc 100644 (file)
@@ -218,6 +218,7 @@ _e_config_edd_init(Eina_Bool old)
    E_CONFIG_VAL(D, T, comp_canvas_bg.b, UCHAR);
    E_CONFIG_VAL(D, T, comp_canvas_bg.a, UCHAR);
    E_CONFIG_VAL(D, T, comp_canvas_bg.opmode, INT);
+   E_CONFIG_VAL(D, T, delayed_load_idle_count, INT);
 }
 
 /* externally accessible functions */
@@ -394,6 +395,7 @@ e_config_load(void)
    E_CONFIG_LIMIT(e_config->comp_canvas_bg.b, 0, 255);
    E_CONFIG_LIMIT(e_config->comp_canvas_bg.a, 0, 255);
    E_CONFIG_LIMIT(e_config->comp_canvas_bg.opmode, 0, 11);
+   E_CONFIG_LIMIT(e_config->delayed_load_idle_count, 0, 100);
 }
 
 E_API int
index e065a31..da50b4a 100644 (file)
@@ -160,6 +160,7 @@ struct _E_Config
       unsigned char r, g, b, a;
       int opmode;
    } comp_canvas_bg;
+   int delayed_load_idle_count;
 };
 
 struct _E_Config_Desklock_Background
index 52d8212..bcefe11 100644 (file)
@@ -14,6 +14,7 @@ static void _e_module_dialog_disable_create(const char *title, const char *body,
 static void _e_module_cb_dialog_disable(void *data, E_Dialog *dia);
 static void _e_module_event_update_free(void *data, void *event);
 static int  _e_module_sort_priority(const void *d1, const void *d2);
+static Eina_Bool _e_module_cb_idler(void *data);
 
 /* local subsystem globals */
 static Eina_List *_e_modules = NULL;
@@ -26,6 +27,9 @@ static Eina_List *_e_module_path_lists = NULL;
 static Eina_List *handlers = NULL;
 static Eina_Hash *_e_module_path_hash = NULL;
 
+static Ecore_Idle_Enterer *_e_module_idler = NULL;
+static int _e_module_delayed_load_idle_cnt = 0;
+
 E_API int E_EVENT_MODULE_UPDATE = 0;
 E_API int E_EVENT_MODULE_INIT_END = 0;
 E_API int E_EVENT_MODULE_DEFER_JOB = 0;
@@ -245,7 +249,17 @@ e_module_all_load(void)
              free(em);
              continue;
           }
-        if (em->enabled)
+
+        if ((em->delayed) && (em->enabled))
+          {
+             if (!_e_module_idler)
+               _e_module_idler = ecore_idle_enterer_add(_e_module_cb_idler, NULL);
+             _e_modules_delayed =
+                eina_list_append(_e_modules_delayed,
+                                 eina_stringshare_add(em->name));
+             PRCTL("[Winsys] Delayled module list added: %s", em->name);
+          }
+        else if (em->enabled)
           {
              E_Module *m;
 
@@ -816,3 +830,45 @@ _e_module_event_update_free(void *data EINA_UNUSED, void *event)
    eina_stringshare_del(ev->name);
    E_FREE(ev);
 }
+
+static Eina_Bool
+_e_module_cb_idler(void *data EINA_UNUSED)
+{
+   if (_e_module_delayed_load_idle_cnt < e_config->delayed_load_idle_count)
+     {
+        PRCTL("[Winsys] ::: delayed :::  _e_module_cb_idler enter [%d]", _e_module_delayed_load_idle_cnt);
+        _e_module_delayed_load_idle_cnt++;
+
+        return ECORE_CALLBACK_PASS_ON;
+     }
+
+   if (_e_modules_delayed)
+     {
+        const char *name;
+        E_Module *m = NULL;
+
+        name = eina_list_data_get(_e_modules_delayed);
+        _e_modules_delayed =
+           eina_list_remove_list(_e_modules_delayed, _e_modules_delayed);
+
+        if (name) m = e_module_new(name);
+        if (m)
+          {
+             PRCTL("[Winsys] ::: delayed ::: start of Loading Delayed Module %s", name ? name : "NONAME");
+             e_module_enable(m);
+             PRCTL("[Winsys] ::: delayed ::: end of Loading Delayed Module %s", name ? name : "NONAME");
+          }
+        eina_stringshare_del(name);
+     }
+   if (_e_modules_delayed)
+     {
+        e_util_wakeup();
+        return ECORE_CALLBACK_PASS_ON;
+     }
+
+   ecore_event_add(E_EVENT_MODULE_INIT_END, NULL, NULL, NULL);
+
+   _e_module_idler = NULL;
+   return ECORE_CALLBACK_DONE;
+}
+