X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fbase%2Fappcore_base.c;h=dfc6f2cbf77b6b22c6a01f0e05e205036793befd;hb=b13f41eefaf31996861cefad8c447382e6ee8bc6;hp=1754f0757f20ce5f18c093c7c28c6b8f13391f11;hpb=d9a549ddfd31da0c13685ab2cf1f9dff9487c94d;p=platform%2Fcore%2Fappfw%2Fapp-core.git diff --git a/src/base/appcore_base.c b/src/base/appcore_base.c index 1754f07..dfc6f2c 100644 --- a/src/base/appcore_base.c +++ b/src/base/appcore_base.c @@ -791,7 +791,9 @@ static gboolean __flush_memory(gpointer data) { int suspend = APPCORE_BASE_SUSPENDED_STATE_WILL_ENTER_SUSPEND; - appcore_base_flush_memory(); + if (__context.ops.trim_memory) + __context.ops.trim_memory(__context.data); + __context.tid = 0; if (!__context.allowed_bg && !__context.suspended_state) { @@ -1139,19 +1141,9 @@ EXPORT_API void appcore_base_fini(void) EXPORT_API int appcore_base_flush_memory(void) { - int (*sqlite3_free_heap_memory)(int); - void (*elm_free_all_cache)(void); + if (__context.ops.trim_memory) + __context.ops.trim_memory(__context.data); - elm_free_all_cache = dlsym(RTLD_DEFAULT, "elm_cache_all_flush"); - if (elm_free_all_cache) - elm_free_all_cache(); - - sqlite3_free_heap_memory = dlsym(RTLD_DEFAULT, - "sqlite3_release_memory"); - if (sqlite3_free_heap_memory) - sqlite3_free_heap_memory(SQLITE_FLUSH_MAX); - - malloc_trim(0); return 0; } @@ -1303,6 +1295,20 @@ EXPORT_API void appcore_base_on_unset_event(enum appcore_base_event event) } } +EXPORT_API int appcore_base_on_trim_memory(void) +{ + int (*sqlite3_free_heap_memory)(int); + + sqlite3_free_heap_memory = dlsym(RTLD_DEFAULT, + "sqlite3_release_memory"); + if (sqlite3_free_heap_memory) + sqlite3_free_heap_memory(SQLITE_FLUSH_MAX); + + malloc_trim(0); + + return 0; +} + EXPORT_API appcore_base_event_h appcore_base_add_event(enum appcore_base_event event, appcore_base_event_cb cb, void *data) { @@ -1421,12 +1427,17 @@ static int __on_set_i18n(void *data) static void __on_set_event(enum appcore_base_event event, void *data) { - return appcore_base_on_set_event(event); + appcore_base_on_set_event(event); } static void __on_unset_event(enum appcore_base_event event, void *data) { - return appcore_base_on_unset_event(event); + appcore_base_on_unset_event(event); +} + +static void __on_trim_memory(void *data) +{ + appcore_base_on_trim_memory(); } EXPORT_API appcore_base_ops appcore_base_get_default_ops(void) @@ -1444,6 +1455,7 @@ EXPORT_API appcore_base_ops appcore_base_get_default_ops(void) ops.exit = NULL; ops.set_event = __on_set_event; ops.unset_event = __on_unset_event; + ops.trim_memory = __on_trim_memory; return ops; }