void ImeRuntime::OnTerminate() {
LOGGER(DEBUG) << "ime_app_terminate";
+ ClosePageFromOnTerminate(application_);
}
void ImeRuntime::OnShow(int context_id, ime_context_h context) {
namespace runtime {
+bool Runtime::is_on_terminate_called = false;
+
Runtime::~Runtime() {
}
}
}
+void Runtime::ClosePageFromOnTerminate(WebApplication* app) {
+ if (app) {
+ std::list<WebView*> vstack = app->view_stack();
+ auto it = vstack.begin();
+ if (it != vstack.end()) {
+ Runtime::is_on_terminate_called = true;
+ for (; it != vstack.end(); ++it) {
+ vstack.front()->SetVisibility(false);
+ ewk_view_page_close((*it)->evas_object());
+ }
+ }
+ }
+}
} // namespace runtime
#include <string>
#include "common/application_data.h"
+#include "runtime/browser/web_application.h"
namespace runtime {
virtual int Exec(int argc, char* argv[]) = 0;
+ static bool is_on_terminate_called;
static std::unique_ptr<Runtime> MakeRuntime(
common::ApplicationData* app_data);
+
+ protected:
+ void ClosePageFromOnTerminate(WebApplication* app);
};
} // namespace runtime
#include "runtime/browser/prelauncher.h"
#include "runtime/browser/preload_manager.h"
-bool g_prelaunch = false;
+#include "runtime/browser/ui_runtime.h"
-#ifdef IME_FEATURE_SUPPORT
-static Ecore_Timer* timeout = NULL;
+bool g_prelaunch = false;
-static Eina_Bool terminateDelayCallback(void* data) {
- timeout = NULL;
- ecore_main_loop_quit();
- return ECORE_CALLBACK_CANCEL;
-}
-#endif
#ifdef WATCH_FACE_FEATURE_SUPPORT
static int setWatchEnv(int argc, char **argv) {
bundle *kb = NULL;
std::unique_ptr<runtime::Runtime> runtime =
runtime::Runtime::MakeRuntime(appdata);
ret = runtime->Exec(argc, argv);
+ if (runtime->is_on_terminate_called) {
+ ecore_main_loop_begin();
+ }
runtime.reset();
}
-#ifdef IME_FEATURE_SUPPORT
- if (appdata->app_type() == common::ApplicationData::IME) {
- timeout = ecore_timer_add(0.5, terminateDelayCallback, NULL);
- // This timer is added because of deadlock issue.
- // If default keyboard is switched from webapp keyboard to tizen keyboard
- // before webapp keyboard is completely loaded, main loop waits
- // until webview is closed where webview is waiting to finish load.
- // This timer delays main loop shutdown until webview load is finished.
- // FIXME: http://suprem.sec.samsung.net/jira/browse/TSAM-11361
- ecore_main_loop_begin();
- }
-#endif
ewk_shutdown();
elm_shutdown();
elm_exit();
}
void UiRuntime::OnTerminate() {
- application_.reset();
- native_window_.reset();
+ ClosePageFromOnTerminate(application_.get());
}
void UiRuntime::OnPause() {
}
void WatchRuntime::OnTerminate() {
- if (application_) {
- delete application_;
- application_ = nullptr;
- }
- if (native_window_) {
- delete native_window_;
- native_window_ = nullptr;
- }
+ ClosePageFromOnTerminate(application_);
}
void WatchRuntime::OnPause() {
#include "common/application_data.h"
#include "runtime/browser/runtime.h"
#include "runtime/browser/native_window.h"
-#include "runtime/browser/web_application.h"
namespace runtime {
#include "runtime/browser/vibration_manager.h"
#include "runtime/browser/web_view.h"
#include "runtime/browser/splash_screen.h"
+#include "runtime/browser/ui_runtime.h"
#include "extensions/common/xwalk_extension_server.h"
#ifndef INJECTED_BUNDLE_PATH
}
void WebApplication::OnClosedWebView(WebView* view) {
- is_terminated_by_callback_ = true;
- RemoveWebViewFromStack(view);
+ is_terminated_by_callback_ = true;
+ RemoveWebViewFromStack(view);
+
+ if (runtime::Runtime::is_on_terminate_called) {
+ ecore_main_loop_quit();
+ }
}
void WebApplication::OnReceivedWrtMessage(WebView* /*view*/,