From: Youngsoo Choi Date: Wed, 18 Jan 2017 05:29:29 +0000 (+0900) Subject: Refactor call of terminator X-Git-Tag: submit/tizen_3.0/20170201.125229~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d7b1a1caa77d6a1d56089a01e6b0930472bcfaec;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Refactor call of terminator The terminator has been registered by Runtime. It makes a dependency from WebApplication to Runtime and does not assure the existence of the Runtime instance. Bug: DF170116-01203 Url: http://suprem.sec.samsung.net/jira/browse/TWF-2805 Change-Id: I700bddab8fb392dca131ab5d3a913ed63e45b792 Signed-off-by: Youngsoo Choi --- diff --git a/runtime/browser/ui_runtime.cc b/runtime/browser/ui_runtime.cc index 41fa8d9cd..7a6188f40 100755 --- a/runtime/browser/ui_runtime.cc +++ b/runtime/browser/ui_runtime.cc @@ -107,10 +107,7 @@ void UiRuntime::ResetWebApplication(NativeWindow::Type windowType) { app_data_, context_)); LOGGER(DEBUG) << "runtime.cc created web application"; - application_->set_terminator([](){ ui_app_exit(); }); - LOGGER(DEBUG) << "runtime.cc ResetWebApplication() finished"; - STEP_PROFILE_END("Runtime ResetWebApplication"); } diff --git a/runtime/browser/watch_runtime.cc b/runtime/browser/watch_runtime.cc index f166e7205..4ec298b67 100644 --- a/runtime/browser/watch_runtime.cc +++ b/runtime/browser/watch_runtime.cc @@ -90,7 +90,6 @@ bool WatchRuntime::OnCreate() { STEP_PROFILE_START("WebApplication Create"); application_ = new WebApplication(native_window_, app_data_); STEP_PROFILE_END("WebApplication Create"); - application_->set_terminator([](){ watch_app_exit(); }); setlocale(LC_ALL, ""); bindtextdomain(kTextDomainRuntime, kTextLocalePath); diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index dd6383ee6..5ffaa5c7d 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -301,8 +301,7 @@ WebApplication::WebApplication( window_(window), appid_(app_data->app_id()), app_data_(app_data), - locale_manager_(new common::LocaleManager()), - terminator_(NULL) { + locale_manager_(new common::LocaleManager()) { Initialize(); } @@ -320,8 +319,7 @@ WebApplication::WebApplication( window_(window), appid_(app_data->app_id()), app_data_(app_data), - locale_manager_(new common::LocaleManager()), - terminator_(NULL) { + locale_manager_(new common::LocaleManager()) { Initialize(); } @@ -706,12 +704,20 @@ void WebApplication::Exit() { if (!is_terminate_called_) ecore_main_loop_quit(); - if (terminator_) { - LOGGER(DEBUG) << "terminator_"; - terminator_(); - } else { - LOGGER(ERROR) << "There's no registered terminator."; - elm_exit(); + switch (app_data_->app_type()) { + case common::ApplicationData::AppType::UI: + LOGGER(ERROR) << "app_ui_exit"; + ui_app_exit(); + break; +#ifdef WATCH_FACE_FEATURE_SUPPORT + case common::ApplicationData::AppType::WATCH: + LOGGER(ERROR) << "watch_ui_exit"; + watch_app_exit(); + break; +#endif + default: + LOGGER(ERROR) << "default terminator"; + elm_exit(); } } diff --git a/runtime/browser/web_application.h b/runtime/browser/web_application.h index f35fd04cf..20d9082b4 100755 --- a/runtime/browser/web_application.h +++ b/runtime/browser/web_application.h @@ -57,9 +57,6 @@ class WebApplication : public WebView::EventListener { void ProcessClosingPage(); std::string data_path() const { return app_data_path_; } - void set_terminator(std::function terminator) { - terminator_ = terminator; - } bool launched() const { return launched_; } std::list view_stack() const { return view_stack_; } @@ -152,7 +149,6 @@ class WebApplication : public WebView::EventListener { std::unique_ptr splash_screen_; std::unique_ptr locale_manager_; std::unique_ptr resource_manager_; - std::function terminator_; int security_model_version_; std::string csp_rule_; std::string csp_report_rule_;