Modified flushing memory logic 94/184494/3
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 18 Jul 2018 08:54:49 +0000 (17:54 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 18 Jul 2018 10:37:36 +0000 (19:37 +0900)
elm_cache_all_flush() is separated from appcore_base_flush_memory().
This patch adds trim_memory() callback function type to add entry point.

Change-Id: Id05f297cb76b2dcd2009dd35efbdfa5633e8f377
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
include/watch_base.h
src/base/watch_base.c
src/efl_base/watch_app_main.c

index 96414b1..22bed01 100755 (executable)
@@ -41,6 +41,7 @@ typedef void (*watch_base_init_cb)(int argc, char **argv, void *data);
 typedef void (*watch_base_finish_cb)(void);
 typedef void (*watch_base_run_cb)(void *data);
 typedef void (*watch_base_exit_cb)(void *data);
+typedef void (*watch_base_trim_memory_cb)(void *data);
 
 typedef struct {
        watch_base_create_cb create;
@@ -56,6 +57,7 @@ typedef struct {
        watch_base_finish_cb finish;
        watch_base_run_cb run;
        watch_base_exit_cb exit;
+       watch_base_trim_memory_cb trim_memory;
 } watch_base_ops;
 
 int watch_base_add_event_handler(app_event_handler_h *handler, app_event_type_e event_type, app_event_cb callback, void *user_data);
@@ -83,6 +85,7 @@ void watch_base_on_pause(void);
 void watch_base_on_resume(void);
 void watch_base_on_preresume(void);
 void watch_base_on_terminate(void);
+void watch_base_on_trim_memory(void);
 watch_base_ops watch_base_get_default_ops(void);
 
 typedef enum {
index ba0758e..fda3db5 100755 (executable)
@@ -898,6 +898,16 @@ static void __on_terminate(void *user_data)
        watch_base_on_terminate();
 }
 
+EXPORT_API void watch_base_on_trim_memory(void)
+{
+       appcore_ui_base_on_trim_memory();
+}
+
+static void __on_trim_memory(void *user_data)
+{
+       watch_base_on_trim_memory();
+}
+
 EXPORT_API watch_base_ops watch_base_get_default_ops(void)
 {
        watch_base_ops ops;
@@ -915,6 +925,7 @@ EXPORT_API watch_base_ops watch_base_get_default_ops(void)
        ops.finish = NULL;
        ops.run = NULL;
        ops.exit = NULL;
+       ops.trim_memory = __on_trim_memory;
 
        return ops;
 }
index d4d893f..c3c3529 100755 (executable)
@@ -134,6 +134,13 @@ static void __on_ambient_changed(bool ambient_mode, void *user_data)
        }
 }
 
+static void __on_trim_memory(void *user_data)
+{
+       _D("Trim memory");
+       elm_cache_all_flush();
+       watch_base_on_trim_memory();
+}
+
 EXPORT_API int watch_app_main(int argc, char **argv,
                watch_app_lifecycle_callback_s *callback, void *user_data)
 {
@@ -162,6 +169,7 @@ EXPORT_API int watch_app_main(int argc, char **argv,
        ops.finish = __on_finish;
        ops.run = __on_run;
        ops.exit = __on_exit;
+       ops.trim_memory = __on_trim_memory;
 
        __context.callback = *callback;
        __context.data = user_data;