#define MAIN_LOOP_INTERVAL 1
static const float FirstFrameDelayWaitTime = 2.0f;
+// keeps tracks of the added idlers
+int idler_count = 0;
+// Identifies the last idler
+bool idler_exit_loop = false;
+
using namespace extensions;
namespace runtime {
}
void WebApplication::Exit() {
+ // loop begin is called only when app is terminated from platform.
+ // So do not stop the loop here. Loop needs to be stopped when the
+ // last view is completely deleted.
+ // App loop exit is not required in case platform triggers the app
+ // exit
if (!is_terminate_called_)
- ecore_main_loop_quit();
+ return;
switch (app_data_->app_type()) {
case common::ApplicationData::AppType::UI:
#if !defined(TIZEN_PRODUCT_TV)
// Hide the window object for preventing the white screen
// during termination of web application.
- evas_object_hide(window_->evas_object());
+ window_->InActive();
Exit();
#endif
+ if (!is_terminate_called_) {
+ idler_exit_loop = true;
+ }
} else if (current != view_stack_.front()) {
view_stack_.front()->SetVisibility(true);
window_->SetContent(view_stack_.front()->evas_object());
vc_webview_->vc_webview_set_view(view_stack_.front()->evas_object());
}
+ // Increment idler count. Will be decremented
+ // when idler is executed
+ idler_count++;
// Delete after the callback context(for ewk view) was not used
ecore_idler_add([](void* view) {
WebView* obj = static_cast<WebView*>(view);
delete obj;
+ idler_count--;
+ if (idler_count == 0 && idler_exit_loop) {
+ LOGGER(DEBUG) << "Quit Loop on idler done";
+ // Quit the loop created by crosswalk during close
+ // page after making sure this is the last idler that
+ // is called
+ ecore_main_loop_quit();
+ }
return EINA_FALSE;
},
view);