[VD] Support analyze webapp loading performance by RWI 93/210693/7
authorliwei <wei90727.li@samsung.com>
Tue, 23 Jul 2019 04:12:35 +0000 (12:12 +0800)
committerliwei <wei90727.li@samsung.com>
Thu, 25 Jul 2019 05:02:14 +0000 (13:02 +0800)
(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 <wei90727.li@samsung.com>
wrt_app/src/runtime.js
wrt_app/src/web_application.js

index ac408d26ca885d434ea9ac7640349896c3e5ca02..56dfabe3b73960b459ee78ffe757264451abbb50 100644 (file)
@@ -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 {
index 65aa1dad1953f82c496826eb6ec4a3789d44cf93..8d5ef4332b1ac17c8b940d6ae841aecddfc1d83a 100755 (executable)
@@ -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);
             }
         });
     }