From 0a75aced100c83073cdc6259840ad1e61552b810 Mon Sep 17 00:00:00 2001 From: liwei Date: Tue, 23 Jul 2019 12:12:35 +0800 Subject: [PATCH] [VD] Support analyze webapp loading performance by RWI (1)Once WebAPP is launched, just to load "about:blank" firstly, and saved WebAPP entry url (index.html) (2)A popup window with "OK" button to show RWI connection port on TV This moment, "about:blank" has been loaded for RWI connection in PC also can enable RWI timeline for preparation to record the whole loading (3)Only user click "OK" button on the popup window, then WebAPP entry url (index.html) will be loaded. Native Patch: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/210692/ Change-Id: I2a495659f7761e9d322adee8f19ab95f7eeb27cc Signed-off-by: liwei --- wrt_app/src/runtime.js | 4 ++++ wrt_app/src/web_application.js | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/wrt_app/src/runtime.js b/wrt_app/src/runtime.js index ac408d26..56dfabe3 100644 --- a/wrt_app/src/runtime.js +++ b/wrt_app/src/runtime.js @@ -125,6 +125,10 @@ class Runtime { _this.addonManager.isAddonAvailable(); options.launchMode = appControl.getData('http://samsung.com/appcontrol/data/launch_mode'); _this.webApplication = new WebApplication(options); + if (!_this.debug_mode && wrt.needUseInspector()) { + _this.webApplication.defaultSrc = src; + src = "about:blank"; + } _this.webApplication.mainWindow.loadURL(src); _this.webApplication.prelaunch(_this.addonManager.prelaunch_path, src); } else { diff --git a/wrt_app/src/web_application.js b/wrt_app/src/web_application.js index 65aa1dad..8d5ef433 100755 --- a/wrt_app/src/web_application.js +++ b/wrt_app/src/web_application.js @@ -35,6 +35,8 @@ class WebApplication { this.backgroundSupport = wrt.getBackgroundSupport(); this.multitaskingSupport = wrt.getMultitaskingSupport(); this.debugport = 0; + this.debugDialogShow = false; + this.defaultSrc = ''; if (options.launchMode == 'backgroundAtStartup') { console.log('backgroundAtStartup'); this.preloadState = 'preload'; @@ -169,6 +171,11 @@ class WebApplication { if (self.loadFinished && self.runningStatus == 'behind') { self.suspend(); } + if (self.debugDialogShow && self.runningStatus == 'DialogClose') { + console.log(`runningStatus is DialogClose, src is ${self.defaultSrc}`); + self.debugDialogShow = false; + self.mainWindow.loadURL(self.defaultSrc); + } }); } getWindowOption(options) { @@ -236,9 +243,17 @@ class WebApplication { wrt.notifyAppStatus('preload'); } if(self.debugport && self.isTVProfile) { - const kDebugPopupScript = "alert('port number :" + self.debugport +"')"; - wrt.executeJS(self.mainWindow.webContents, kDebugPopupScript); + let message = self.debugport.toString() + + "\r\nFast RWI is used, [about:blank] is loaded fist instead of \r\n[" + + self.defaultSrc + + "]\r\nClick OK button will start the real loading.\r\nNotes:\r\nPlease " + + "connect to RWI in PC before click OK button.\r\nThen you can get " + + "network log from the initial loading.\r\nPlease click Record button " + + "in Timeline panel in PC before click OK button,\r\nThen you can get " + + "profile log from the initial loading." + self.debugDialogShow = true; self.debugport = 0; + wrt.modalDialog(self.mainWindow.webContents, message); } }); } -- 2.34.1