[Service][Workaround] Make singleton worker thread before app start 81/259281/11 accepted/tizen/unified/20210702.013502 submit/tizen/20210630.160022
authorDongHyun Song <dh81.song@samsung.com>
Fri, 4 Jun 2021 02:32:21 +0000 (11:32 +0900)
committerDongHyun Song <dh81.song@samsung.com>
Wed, 30 Jun 2021 07:37:14 +0000 (07:37 +0000)
This patch will make singleton webapi worker thread ahead of app
launching to keep it 'User' smack label.
There are lots usage of putting message at singleton worker thread by
 - TaskQueue::GetInstance().Queue()
 - TaskQueue::GetInstance().Async()

tizen.systeminfo.getPropertyValue() is one of API to use TaskQueue
singleton instance.

+ remove unnecessary log

Related patch of filesystem webapi worker issue:
https://review.tizen.org/gerrit/#/c/platform/core/api/webapi-plugins/+/259382/

Change-Id: I7e0abe5e93335d2798bc388f22a88aff754d8d2b
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
wrt_app/common/service_runner.ts
wrt_app/service/device_api_router.ts

index 3b5c308..93be76e 100644 (file)
@@ -78,16 +78,21 @@ export function start(id: string, filename: string) {
   console.log(`serviceType : ${global['serviceType']}`)
   new DeviceAPIRouter(id, isGlobalService());
 
+  // this is workaround solution to make webapis singleton worker
+  // ahead of dropThreadPrivilege()
+  global.tizen.systeminfo.getPropertyValue("CPU", () => { }, () => { });
+
+  // This is for awaking up uv loop.
+  dummyTimer = setInterval(() => {
+    checkLauncherAlive(id);
+  }, 100);
+
   if (isServiceApplication()) {
     registerExtensionResolver(id);
     filename = wrt.getStartServiceFile(id);
     console.log(`start global service file: ${filename}`);
   }
 
-  // This is for awaking up uv loop.
-  dummyTimer = setInterval(() => {
-    checkLauncherAlive(id);
-  }, 100);
   printAppControlData(id);
 
   try {
index 3347e61..ae2fd53 100644 (file)
@@ -311,7 +311,6 @@ export class DeviceAPIRouter {
 
   injectVirtualRootResolver(func: Function) {
     return (...args: any[]) => {
-      console.log('arguments : ' + args);
       if (args.length && !(args[0] === null || args[0] === undefined)) {
         args[0] = wrt.resolveVirtualRoot(this.getServiceId(), args[0]);
         console.log('updated argument[0] : ' + args[0]);