Move FlushData() after setEnable() 94/264794/1 submit/tizen/20210930.160018
authorDongHyun Song <dh81.song@samsung.com>
Thu, 30 Sep 2021 01:30:24 +0000 (10:30 +0900)
committerDongHyun Song <dh81.song@samsung.com>
Thu, 30 Sep 2021 01:34:07 +0000 (10:34 +0900)
With low-end product, FlushData() looks to take too much time to
flush StoragePartition. Then renderer can be not stopped immediately.

Change-Id: Ibc96785878fd92e26d08e92dcffa9b9e6d39fb9d
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
wrt_app/src/web_application.ts

index 1238497..b68bf17 100755 (executable)
@@ -308,6 +308,10 @@ export class WebApplication {
     }
   }
 
+  private isPausable() {
+    return !this.profileDelegate.canIgnoreSuspend() && !this.backgroundRunnable();
+  }
+
   suspend() {
     if (this.suspended || this.inQuit)
       return;
@@ -317,10 +321,7 @@ export class WebApplication {
       addonManager.emit('lcSuspend', this.mainWindow.id);
       this.windowList[this.windowList.length - 1].hide();
     }
-    this.flushData();
-    if (this.profileDelegate.canIgnoreSuspend())
-      return;
-    if (!this.backgroundRunnable()) {
+    if (this.isPausable()) {
       this.windowList.forEach((window) => window.setEnabled(false));
       if (!this.multitaskingSupport) {
         setTimeout(() => {
@@ -329,6 +330,7 @@ export class WebApplication {
         }, 0);
       }
     }
+    this.flushData();
   }
 
   resume() {
@@ -344,11 +346,11 @@ export class WebApplication {
 
   quit() {
     console.log('WebApplication : quit');
-    this.flushData();
     this.windowList.forEach((window) => {
       window.removeAllListeners();
       window.setEnabled(false);
     });
+    this.flushData();
     this.inQuit = false;
   }