From: Prathmesh Date: Fri, 25 May 2018 10:03:22 +0000 (+0530) Subject: Fix application launch issue. X-Git-Tag: submit/tizen/20180706.010002~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=60a66619fd827b006d2f09d8d2f8f74498220cfd;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Fix application launch issue. Added a default timer in case if the Rendered is not called from engine. Show window on timer fired Ref Patches:http://slp-info.sec.samsung.net/gerrit/#/c/3105521 http://slp-info.sec.samsung.net/gerrit/#/c/3101926 Change-Id: I28dc0192acee6ed3dbb6686aaa668552ddde2835 Signed-off-by: Prathmesh --- diff --git a/common/app_control.h b/common/app_control.h index 573d24aaf..e0f5a4c6e 100644 --- a/common/app_control.h +++ b/common/app_control.h @@ -57,8 +57,8 @@ class AppControl { bool LaunchRequest(); private: - app_control_h app_control_; bundle* app_control_bundle_; + app_control_h app_control_; }; } // namespace common diff --git a/runtime/browser/ui_runtime.cc b/runtime/browser/ui_runtime.cc index 7a6188f40..bb0e11ae6 100755 --- a/runtime/browser/ui_runtime.cc +++ b/runtime/browser/ui_runtime.cc @@ -135,6 +135,7 @@ bool UiRuntime::OnCreate() { setlocale(LC_ALL, ""); bindtextdomain(kTextDomainRuntime, kTextLocalePath); + application_->SetTimeoutFirstFrameDelay(); return true; } diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index cfe9b0c3a..9039ca724 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -61,6 +61,7 @@ #define SESSION_COUNTER_INTERVAL 0.1 #define MAIN_LOOP_INTERVAL 1 +static const float FirstFrameDelayWaitTime = 2.0f; using namespace extensions; namespace runtime { @@ -121,7 +122,7 @@ const char* kLocationPrivilege = "http://tizen.org/privilege/location"; const char* kRecordPrivilege = "http://tizen.org/privilege/recorder"; const char* kStoragePrivilege = "http://tizen.org/privilege/unlimitedstorage"; const char* kUsermediaPrivilege = "http://tizen.org/privilege/mediacapture"; -const char* kNotiIconFile = "noti_icon.png"; +//const char* kNotiIconFile = "noti_icon.png"; const char* kFileScheme = "file://"; const char* kVisibilitySuspendFeature = "visibility,suspend"; @@ -297,13 +298,15 @@ WebApplication::WebApplication( lang_changed_mode_(false), is_terminate_called_(false), is_close_page_called_(false), + is_window_inactive_(false), ewk_context_( ewk_context_new_with_injected_bundle_path(INJECTED_BUNDLE_PATH)), has_ownership_of_ewk_context_(true), window_(window), appid_(app_data->app_id()), app_data_(app_data), - locale_manager_(new common::LocaleManager()) { + locale_manager_(new common::LocaleManager()), + firstframe_delay_timer_(NULL) { Initialize(); } @@ -317,12 +320,14 @@ WebApplication::WebApplication( lang_changed_mode_(false), is_terminate_called_(false), is_close_page_called_(false), + is_window_inactive_(false), ewk_context_(context), has_ownership_of_ewk_context_(false), window_(window), appid_(app_data->app_id()), app_data_(app_data), - locale_manager_(new common::LocaleManager()) { + locale_manager_(new common::LocaleManager()), + firstframe_delay_timer_(NULL) { Initialize(); } @@ -647,6 +652,7 @@ void WebApplication::Resume() { if (view_stack_.size() > 0 && view_stack_.front() != NULL) view_stack_.front()->SetVisibility(true); + is_window_inactive_ = false; if (app_data_->setting_info() != NULL && app_data_->setting_info()->background_support_enabled()) { return; @@ -662,6 +668,7 @@ void WebApplication::Suspend() { if (view_stack_.size() > 0 && view_stack_.front() != NULL) view_stack_.front()->SetVisibility(false); + is_window_inactive_ = true; if (app_data_->setting_info() != NULL && app_data_->setting_info()->background_support_enabled()) { LOGGER(DEBUG) << "gone background (backgroud support enabed)"; @@ -675,6 +682,7 @@ void WebApplication::Suspend() { } void WebApplication::Terminate() { + is_window_inactive_ = false; // Just process closing page once. if (is_terminate_called_ || is_close_page_called_) return; @@ -704,6 +712,7 @@ void WebApplication::ProcessClosingPage() { ecore_main_loop_begin(); ecore_timer_del(main_loop.timer); ecore_timer_del(session_counter.timer); + UnsetTimeout(); } void WebApplication::ClosePage() { @@ -1206,8 +1215,12 @@ void WebApplication::OnRendered(WebView* view) { LOGGER(DEBUG) << "Rendered"; splash_screen_->HideSplashScreen(SplashScreen::HideReason::RENDERED); + if (firstframe_delay_timer_) { + UnsetTimeout(); + } + // Do not show(), active() for language change - if(lang_changed_mode_ == false){ + if(lang_changed_mode_ == false && is_window_inactive_ == false) { // Show window after frame rendered. if (common::getProfile() == common::kPROFILE_MOBILE) { if (common::utils::StartsWith(view->GetUrl(), kFileScheme)) { @@ -1519,4 +1532,31 @@ void WebApplication::OnUsermediaPermissionRequest( popup->Show(); } +void WebApplication::SetTimeoutFirstFrameDelay() { + LOGGER(DEBUG); + firstframe_delay_timer_ = ecore_timer_add( + FirstFrameDelayWaitTime, + FirstFrameDelayTimerCallback, this); +} + +Eina_Bool WebApplication::FirstFrameDelayTimerCallback(void* data) { + LOGGER(DEBUG) << "FrameRendered not obtained from engine. Show window"; + WebApplication* This = static_cast(data); + /* Do not show(), active() when window is already in background */ + if(This->is_window_inactive_ == false) { + This->window_->Show(); + This->window_->Active(); + } + This->firstframe_delay_timer_ = NULL; + return ECORE_CALLBACK_CANCEL; +} + +void WebApplication::UnsetTimeout() { + LOGGER(DEBUG); + if (firstframe_delay_timer_) { + ecore_timer_del(firstframe_delay_timer_); + firstframe_delay_timer_ = NULL; + } +} + } // namespace runtime diff --git a/runtime/browser/web_application.h b/runtime/browser/web_application.h index 99e56d06e..a724a0902 100755 --- a/runtime/browser/web_application.h +++ b/runtime/browser/web_application.h @@ -60,6 +60,11 @@ class WebApplication : public WebView::EventListener { std::string data_path() const { return app_data_path_; } bool launched() const { return launched_; } std::list view_stack() const { return view_stack_; } + /* + * @function SetTimeoutFirstFrameDelay + * @desc Sets a fixed timer of 2 sec from the app create time + */ + void SetTimeoutFirstFrameDelay(); virtual void OnCreatedNewWebView(WebView* view, WebView* new_view); virtual void OnClosedWebView(WebView* view); @@ -131,12 +136,16 @@ class WebApplication : public WebView::EventListener { bool tizenWebKitCompatibilityEnabled() const { return (m_major && m_major < 3); } } m_tizenCompatibilitySettings; + static Eina_Bool FirstFrameDelayTimerCallback(void* data); + void UnsetTimeout(); + bool launched_; bool debug_mode_; bool verbose_mode_; bool lang_changed_mode_; bool is_terminate_called_; bool is_close_page_called_; + bool is_window_inactive_; Ewk_Context* ewk_context_; bool has_ownership_of_ewk_context_; NativeWindow* window_; @@ -151,6 +160,7 @@ class WebApplication : public WebView::EventListener { std::string csp_rule_; std::string csp_report_rule_; VCWebView* vc_webview_; + Ecore_Timer* firstframe_delay_timer_; }; } // namespace runtime