From 7584fad13ff5f760a294579fec4c0b1a18f74ceb Mon Sep 17 00:00:00 2001 From: mallikarjun82 Date: Tue, 3 Apr 2018 19:47:02 +0530 Subject: [PATCH 01/16] coverity error handling This patch initialized member variable in constructor. Coverity:111022 Change-Id: I299d16289809c9a743dee74d18d39e0dd80d56c3 Signed-off-by: mallikarjun82 --- common/application_data.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/common/application_data.cc b/common/application_data.cc index b25d347..a205ecc 100755 --- a/common/application_data.cc +++ b/common/application_data.cc @@ -45,6 +45,7 @@ const char* kWearableClockCategory = "http://tizen.org/category/wearable_clock"; ApplicationData::ApplicationData(const std::string& appid) : app_id_(appid), + app_type_(UI), loaded_(false) { SCOPE_PROFILE(); char* res_path = app_get_resource_path(); -- 2.7.4 From 44d9d87dfd3663d0e073a2ec461881382559da55 Mon Sep 17 00:00:00 2001 From: "surya.kumar7" Date: Fri, 6 Apr 2018 19:57:38 +0530 Subject: [PATCH 02/16] Coverity error handling This patch handles return value from sqlite3 function Coverity: 108596 Signed-off-by: surya.kumar7 Change-Id: I94b669d856bc0213274fc1d86857fd395bb846d6 --- common/app_db.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/app_db.cc b/common/app_db.cc index fa6a3c6..386b8da 100644 --- a/common/app_db.cc +++ b/common/app_db.cc @@ -218,7 +218,7 @@ void SqliteDB::Initialize() { sqldb_ = NULL; return; } - sqlite3_busy_handler(sqldb_, [](void *, int count) { + ret = sqlite3_busy_handler(sqldb_, [](void *, int count) { if (count < 5) { LOGGER(ERROR) << "App db was busy, Wait the lock count(" << count << ")"; usleep(100000*(count+1)); @@ -228,6 +228,9 @@ void SqliteDB::Initialize() { return 0; } }, NULL); + if (ret != SQLITE_OK) { + LOGGER(ERROR) << "Failed to register busy handler: " << sqlite3_errmsg(sqldb_); + } char *errmsg = NULL; ret = sqlite3_exec(sqldb_, kCreateDbQuery, NULL, NULL, &errmsg); -- 2.7.4 From 4654ffaebfa0be3a78c6d3177991ea7385d7dc31 Mon Sep 17 00:00:00 2001 From: "surya.kumar7" Date: Fri, 6 Apr 2018 20:25:47 +0530 Subject: [PATCH 03/16] Coverity error handling Terminate string tainted by fread Coverity: 110097 Change-Id: Icfd7798e775a4bd4db383173ce5bbaf033cf7d6c Signed-off-by: surya.kumar7 --- common/resource_manager.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/common/resource_manager.cc b/common/resource_manager.cc index 8881428..42327b9 100755 --- a/common/resource_manager.cc +++ b/common/resource_manager.cc @@ -645,6 +645,7 @@ std::string ResourceManager::DecryptResource(const std::string& path) { size_t read_size = fread(get_dec_size, 1, 4, src); + get_dec_size[read_size] = '\0'; if (0 != read_size) { unsigned int read_buf_size = 0; std::istringstream(std::string((char*)get_dec_size)) >> read_buf_size; -- 2.7.4 From 10e9a1af00023cd085d3c8794d9c8165ec53a9ba Mon Sep 17 00:00:00 2001 From: "surya.kumar7" Date: Fri, 6 Apr 2018 20:05:20 +0530 Subject: [PATCH 04/16] Coverity error handling Preload function is of type std::function and should not return a bool value Coverity: 108784 Change-Id: Ia4f7c601cf1692c347eab2d83f6936b497e14f70 Signed-off-by: surya.kumar7 --- runtime/browser/runtime_process.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/browser/runtime_process.cc b/runtime/browser/runtime_process.cc index e397c27..bd6b22b 100755 --- a/runtime/browser/runtime_process.cc +++ b/runtime/browser/runtime_process.cc @@ -154,7 +154,7 @@ int main(int argc, char* argv[]) { LOGGER(DEBUG) << "run with wrt-loader"; if (!ewk_init()) { LOGGER(ERROR) << "could not init ewk"; - return false; + return; } g_prelaunch = true; char* chromium_arg_options[] = { -- 2.7.4 From 49435ec874471be8e6888226e3a6305252895ae3 Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Mon, 16 Apr 2018 06:14:37 +0000 Subject: [PATCH 05/16] [M63] Remove the limit of chromium-efl version To be built with m63 chromium-efl, this removes the limit of chromium-efl version. Change-Id: Icd40b6f5eb2661539b9c67598ca59d736937ddd8 Signed-off-by: Youngsoo Choi --- packaging/crosswalk-tizen.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/crosswalk-tizen.spec b/packaging/crosswalk-tizen.spec index 0c24483..ef737f3 100755 --- a/packaging/crosswalk-tizen.spec +++ b/packaging/crosswalk-tizen.spec @@ -29,7 +29,7 @@ BuildRequires: pkgconfig(capi-appfw-package-manager) BuildRequires: pkgconfig(capi-system-system-settings) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(capi-ui-efl-util) -BuildRequires: pkgconfig(chromium-efl) >= 56.0.0, pkgconfig(chromium-efl) < 57.0.0 +BuildRequires: pkgconfig(chromium-efl) >= 56.0.0 BuildRequires: pkgconfig(cynara-client) BuildRequires: pkgconfig(capi-system-device) BuildRequires: pkgconfig(dlog) -- 2.7.4 From b18a93c2ef8efec5b6a62730279c747632c49521 Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Mon, 2 Apr 2018 01:52:13 -0700 Subject: [PATCH 06/16] [M63] Switch deprecated ForceSet with DefineOwnProperty ForceSet has been deprecated in v8 version 6.3.292. So, this switches the ForceSet with DefineOwnProperty. Change-Id: Ied9dcf71ec447b9a1dcd15c4b6ab6ed8420a20d6 Signed-off-by: Youngsoo Choi --- extensions/renderer/xwalk_module_system.cc | 2 +- extensions/renderer/xwalk_v8tools_module.cc | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/extensions/renderer/xwalk_module_system.cc b/extensions/renderer/xwalk_module_system.cc index 2218188..e2d1a9a 100755 --- a/extensions/renderer/xwalk_module_system.cc +++ b/extensions/renderer/xwalk_module_system.cc @@ -516,7 +516,7 @@ void XWalkModuleSystem::EnsureExtensionNamespaceIsReadOnly( v8::Handle v8_extension_name( v8::String::NewFromUtf8(context->GetIsolate(), basename.c_str())); - value.As()->ForceSet( + value.As()->DefineOwnProperty(context, v8_extension_name, value.As()->Get(v8_extension_name), v8::ReadOnly); } diff --git a/extensions/renderer/xwalk_v8tools_module.cc b/extensions/renderer/xwalk_v8tools_module.cc index 4fcad37..941851d 100755 --- a/extensions/renderer/xwalk_v8tools_module.cc +++ b/extensions/renderer/xwalk_v8tools_module.cc @@ -18,7 +18,11 @@ void ForceSetPropertyCallback( if (info.Length() != 3 || !info[0]->IsObject() || !info[1]->IsString()) { return; } - info[0].As()->ForceSet(info[1], info[2]); + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Local ctx = isolate->GetCurrentContext(); + v8::String::Utf8Value value(info[1]); + v8::Local key = v8::String::NewFromUtf8(isolate, *value); + info[0].As()->DefineOwnProperty(ctx, key, info[2]); } // ================ -- 2.7.4 From 297d926a8987b59c8a29ae1a48c1b83d38d069f9 Mon Sep 17 00:00:00 2001 From: Guneet K Date: Mon, 14 May 2018 12:25:41 +0530 Subject: [PATCH 07/16] coverity error handling This patch initializes uninitialized member variable. Coverity:107447,110284 Change-Id: I86cd7feafa845323c502ababf1f9287d93818eac Signed-off-by: Guneet K --- common/app_control.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/app_control.cc b/common/app_control.cc index 8fbe4e8..aa14230 100755 --- a/common/app_control.cc +++ b/common/app_control.cc @@ -108,13 +108,15 @@ static void AppendExtraDatafromUrl(AppControl* request, } // namespace AppControl::AppControl(app_control_h app_control) - : app_control_bundle_(nullptr){ + : app_control_bundle_(nullptr), + app_control_(NULL){ app_control_clone(&app_control_, app_control); app_control_to_bundle(app_control_, &app_control_bundle_); } AppControl:: AppControl() - : app_control_bundle_(nullptr){ + : app_control_bundle_(nullptr), + app_control_(NULL){ app_control_create(&app_control_); app_control_to_bundle(app_control_, &app_control_bundle_); } -- 2.7.4 From a36aa4468025350d6563b950aafaec69096626e1 Mon Sep 17 00:00:00 2001 From: Guneet K Date: Mon, 14 May 2018 15:12:22 +0530 Subject: [PATCH 08/16] coverity error handling This patch makes handle_ a data member of XWalkExtension class. dlclose(handle_) is called from XWalkExtension class destructor to prevent resource leak. Coverity:109521 Change-Id: I24ae7763809536b3b5ad486c7f45c7c40a9dc528 Signed-off-by: Guneet K --- extensions/common/xwalk_extension.cc | 13 ++++++++----- extensions/common/xwalk_extension.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/extensions/common/xwalk_extension.cc b/extensions/common/xwalk_extension.cc index a5f9292..f1ecfa5 100755 --- a/extensions/common/xwalk_extension.cc +++ b/extensions/common/xwalk_extension.cc @@ -20,6 +20,7 @@ XWalkExtension::XWalkExtension(const std::string& path, library_path_(path), xw_extension_(0), lazy_loading_(false), + handle_(nullptr), delegate_(delegate), created_instance_callback_(NULL), destroyed_instance_callback_(NULL), @@ -39,6 +40,7 @@ XWalkExtension::XWalkExtension(const std::string& path, name_(name), entry_points_(entry_points), lazy_loading_(true), + handle_(nullptr), delegate_(delegate), created_instance_callback_(NULL), destroyed_instance_callback_(NULL), @@ -54,25 +56,26 @@ XWalkExtension::~XWalkExtension() { if (shutdown_callback_) shutdown_callback_(xw_extension_); XWalkExtensionAdapter::GetInstance()->UnregisterExtension(this); + dlclose(handle_); } bool XWalkExtension::Initialize() { if (initialized_) return true; - void* handle = dlopen(library_path_.c_str(), RTLD_LAZY); - if (!handle) { + handle_ = dlopen(library_path_.c_str(), RTLD_LAZY); + if (!handle_) { LOGGER(ERROR) << "Error loading extension '" << library_path_ << "' : " << dlerror(); return false; } XW_Initialize_Func initialize = reinterpret_cast( - dlsym(handle, "XW_Initialize")); + dlsym(handle_, "XW_Initialize")); if (!initialize) { LOGGER(ERROR) << "Error loading extension '" << library_path_ << "' : couldn't get XW_Initialize function."; - dlclose(handle); + dlclose(handle_); return false; } @@ -84,7 +87,7 @@ bool XWalkExtension::Initialize() { if (ret != XW_OK) { LOGGER(ERROR) << "Error loading extension '" << library_path_ << "' : XW_Initialize() returned error value."; - dlclose(handle); + dlclose(handle_); return false; } diff --git a/extensions/common/xwalk_extension.h b/extensions/common/xwalk_extension.h index c7aaf83..6b19630 100755 --- a/extensions/common/xwalk_extension.h +++ b/extensions/common/xwalk_extension.h @@ -66,6 +66,7 @@ class XWalkExtension { std::string javascript_api_; StringVector entry_points_; bool lazy_loading_; + void *handle_; XWalkExtensionDelegate* delegate_; -- 2.7.4 From c8c1a1c5d78776c99fff97a1c86ab041bb5a29ec Mon Sep 17 00:00:00 2001 From: Guneet K Date: Mon, 14 May 2018 16:08:34 +0530 Subject: [PATCH 09/16] coverity error handling This patch makes handle_ a data member of XWalkExtensionManager class. dlclose(handle_) is called from XWalkExtensionManager class destructor to prevent resource leak. coverity:109521 Change-Id: I4751e38e50b491dc54a893d5c9d1da4e41ab90f0 Signed-off-by: Guneet K --- extensions/common/xwalk_extension_manager.cc | 9 ++++++--- extensions/common/xwalk_extension_manager.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/extensions/common/xwalk_extension_manager.cc b/extensions/common/xwalk_extension_manager.cc index 130eca8..f0e3084 100755 --- a/extensions/common/xwalk_extension_manager.cc +++ b/extensions/common/xwalk_extension_manager.cc @@ -55,15 +55,18 @@ XWalkExtensionManager::XWalkExtensionManager() { } XWalkExtensionManager::~XWalkExtensionManager() { + for (auto dlhandle : handle_) + dlclose(dlhandle); } void XWalkExtensionManager::PreloadExtensions() { for (int i = 0; kPreloadLibs[i]; i++) { LOGGER(DEBUG) << "Preload libs : " << kPreloadLibs[i]; - void* handle = dlopen(kPreloadLibs[i], RTLD_NOW|RTLD_GLOBAL); - if (handle == nullptr) { + void *dlhandle = dlopen(kPreloadLibs[i], RTLD_NOW|RTLD_GLOBAL); + if (dlhandle == nullptr) LOGGER(WARN) << "Fail to load libs : " << dlerror(); - } + else + handle_.push_back(dlhandle); } } diff --git a/extensions/common/xwalk_extension_manager.h b/extensions/common/xwalk_extension_manager.h index cfbdede..786edfc 100755 --- a/extensions/common/xwalk_extension_manager.h +++ b/extensions/common/xwalk_extension_manager.h @@ -40,6 +40,7 @@ class XWalkExtensionManager : public XWalkExtension::XWalkExtensionDelegate { StringSet extension_symbols_; ExtensionMap extensions_; + std::vector handle_; }; } // namespace extensions -- 2.7.4 From d9b1c47c315d6c8f74b5ce60683ddc923987a59a Mon Sep 17 00:00:00 2001 From: Guneet K Date: Wed, 16 May 2018 18:06:30 +0530 Subject: [PATCH 10/16] Hotfix for "App Not Launch" Issue This patch removes the initialization of window using wrt-loader. The initialization of window happens at actual launch time. Change-Id: I6e1c16defbf5cf9283184cdc5cf056136e8a555f Signed-off-by: Guneet K --- runtime/browser/preload_manager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/browser/preload_manager.cc b/runtime/browser/preload_manager.cc index 53317ae..fe1cce7 100755 --- a/runtime/browser/preload_manager.cc +++ b/runtime/browser/preload_manager.cc @@ -49,7 +49,7 @@ void PreloadManager::CreateCacheComponet() { ewk_context_new_with_injected_bundle_path(INJECTED_BUNDLE_PATH); context = context; // To prevent build warning cached_window_.reset(new NativeAppWindow()); - cached_window_->Initialize(); + //cached_window_->Initialize(); } NativeWindow* PreloadManager::GetCachedNativeWindow() { -- 2.7.4 From 57b3ac78e6d2dd5545147874a01684bed7a3b203 Mon Sep 17 00:00:00 2001 From: YongGeol Jung Date: Wed, 16 May 2018 07:35:26 -0700 Subject: [PATCH 11/16] [hotfix] Fix js callback crash issue. JS callback causes crash if current |context| of |isolate| is null. To prevent this, make new |context| for |isolate|. Change-Id: I212beb06dfe9dfab310b71d1dbb594c3abb3c4c9 Signed-off-by: YongGeol Jung --- extensions/renderer/runtime_ipc_client.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extensions/renderer/runtime_ipc_client.cc b/extensions/renderer/runtime_ipc_client.cc index 6b96828..3835b32 100644 --- a/extensions/renderer/runtime_ipc_client.cc +++ b/extensions/renderer/runtime_ipc_client.cc @@ -43,6 +43,13 @@ void RuntimeIPCClient::JSCallback::Call(v8::Isolate* isolate, if (!callback_.IsEmpty()) { v8::HandleScope handle_scope(isolate); v8::TryCatch try_catch(isolate); + v8::Local context(isolate->GetCurrentContext()); + if (context.IsEmpty()) { + // If there's no JavaScript on the stack, we have to make a new Context. + context = v8::Context::New(isolate); + } + v8::Context::Scope scope(context); + v8::Handle func = v8::Local::New(isolate, callback_); func->Call(func, 1, args); -- 2.7.4 From 7f56f6ccb8f03d6162b5b2d19742bb35ac52e785 Mon Sep 17 00:00:00 2001 From: "surya.kumar7" Date: Wed, 28 Feb 2018 13:00:23 +0530 Subject: [PATCH 12/16] Print dlerror() for debugging dlopen() fails for numerous reasons and returns NULL in such cases. Logging the error will be useful for inspecting the failure reason. Change-Id: Idc21de1165537160baf1c7dfbb76a2b3c3cfe2d8 Signed-off-by: surya.kumar7 --- loader/wrt_loader.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loader/wrt_loader.cc b/loader/wrt_loader.cc index 14ea066..d42d69d 100644 --- a/loader/wrt_loader.cc +++ b/loader/wrt_loader.cc @@ -21,7 +21,7 @@ int main(int argc, char* argv[]) { void* handle = dlopen("/usr/bin/xwalk_runtime", RTLD_NOW); if (!handle) { - dlog_print(DLOG_DEBUG, "XWALK", "Error loading xwalk_runtime"); + dlog_print(DLOG_ERROR, "XWALK", "Error loading xwalk_runtime: %s", dlerror()); return false; } @@ -29,7 +29,7 @@ int main(int argc, char* argv[]) { MAIN_FUNC real_main = reinterpret_cast(dlsym(handle, "main")); if (!real_main) { - dlog_print(DLOG_DEBUG, "XWALK", "Error loading real_main"); + dlog_print(DLOG_ERROR, "XWALK", "Error loading real_main: %s", dlerror()); return false; } -- 2.7.4 From 60a66619fd827b006d2f09d8d2f8f74498220cfd Mon Sep 17 00:00:00 2001 From: Prathmesh Date: Fri, 25 May 2018 15:33:22 +0530 Subject: [PATCH 13/16] 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 --- common/app_control.h | 2 +- runtime/browser/ui_runtime.cc | 1 + runtime/browser/web_application.cc | 48 ++++++++++++++++++++++++++++++++++---- runtime/browser/web_application.h | 10 ++++++++ 4 files changed, 56 insertions(+), 5 deletions(-) diff --git a/common/app_control.h b/common/app_control.h index 573d24a..e0f5a4c 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 7a6188f..bb0e11a 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 cfe9b0c..9039ca7 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 99e56d0..a724a09 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 -- 2.7.4 From fc5cd3021777786b51fed198a44fd54124b2d5d4 Mon Sep 17 00:00:00 2001 From: "k2.nagaraju" Date: Mon, 4 Jun 2018 14:49:15 +0530 Subject: [PATCH 14/16] Runtime object creation code cleanup. Change-Id: I6abd9fa5e506099def2ca41143887dbb9f7edccc Signed-off-by: k2.nagaraju --- runtime/browser/runtime.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/runtime/browser/runtime.cc b/runtime/browser/runtime.cc index 8e68210..01af3bf 100644 --- a/runtime/browser/runtime.cc +++ b/runtime/browser/runtime.cc @@ -41,24 +41,19 @@ Runtime::~Runtime() { std::unique_ptr Runtime::MakeRuntime( common::ApplicationData* app_data) { - if (app_data->app_type() == common::ApplicationData::UI) { - return std::unique_ptr(new UiRuntime(app_data)); - } #ifdef IME_FEATURE_SUPPORT - else if (TIZEN_FEATURE_web_ime_support && - app_data->app_type() == common::ApplicationData::IME) { + if (TIZEN_FEATURE_web_ime_support && + app_data->app_type() == common::ApplicationData::IME) { return std::unique_ptr(new ImeRuntime(app_data)); } #endif // IME_FEATURE_SUPPORT #ifdef WATCH_FACE_FEATURE_SUPPORT - else if (TIZEN_FEATURE_watch_face_support && - app_data->app_type() == common::ApplicationData::WATCH) { + if (TIZEN_FEATURE_watch_face_support && + app_data->app_type() == common::ApplicationData::WATCH) { return std::unique_ptr(new WatchRuntime(app_data)); } #endif // WATCH_FACE_FEATURE_SUPPORT - else { - return std::unique_ptr(new UiRuntime(app_data)); - } + return std::unique_ptr(new UiRuntime(app_data)); } void Runtime::ProcessClosingPage(WebApplication* application) { -- 2.7.4 From 0ac321d81ee989f42adf03ebed1ada53a73fe960 Mon Sep 17 00:00:00 2001 From: Prathmesh Date: Fri, 22 Jun 2018 10:00:03 +0530 Subject: [PATCH 15/16] Show window on frame rendered after appcontrol reset - Currently window is shown after reset once appcontrol is received. Due to this sometimes old contents are visible first then new contents are rendered - If the app is reset on app-control then do show the window right away. Rather the window will be shown once frame rendered is received Change-Id: Ice201a6c6ff35430186abcad917af767fb1ccdaf Signed-off-by: Prathmesh --- runtime/browser/web_application.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 9039ca7..e9c9c33 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -626,7 +626,11 @@ void WebApplication::AppControl( if (!verbose_mode_ && appcontrol->data(kVerboseKey) == "true") { verbose_mode_ = true; } - window_->Active(); + + // If app was reset then show window after new frame + // is rendered. Else old page will be displayed + if (!do_reset) + window_->Active(); } void WebApplication::SendAppControlEvent() { -- 2.7.4 From 3a8f307a04aefd6c7c2049aea130a0004c8a6e0a Mon Sep 17 00:00:00 2001 From: jaekuk lee Date: Fri, 22 Jun 2018 06:21:44 +0000 Subject: [PATCH 16/16] Revert "Show window on frame rendered after appcontrol reset" This reverts commit 0ac321d81ee989f42adf03ebed1ada53a73fe960. Change-Id: Icc64ab6ef123581210cbc552eff33a645727b670 --- runtime/browser/web_application.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index e9c9c33..9039ca7 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -626,11 +626,7 @@ void WebApplication::AppControl( if (!verbose_mode_ && appcontrol->data(kVerboseKey) == "true") { verbose_mode_ = true; } - - // If app was reset then show window after new frame - // is rendered. Else old page will be displayed - if (!do_reset) - window_->Active(); + window_->Active(); } void WebApplication::SendAppControlEvent() { -- 2.7.4