import { Worker, isMainThread } from 'worker_threads';
import { wrt } from '../browser/wrt';
+import * as XWalkExtension from '../common/wrt_xwalk_extension';
interface WorkerMap {
[id: string]: any;
workers[id].postMessage({ type: 'stop', delay });
}
+let initializeExtensionOnMain = () => {
+ initializeExtensionOnMain = () => {};
+ XWalkExtension.initialize();
+ // This is workaround solution to make webapis's singleton worker, which has
+ // same smack label with pid's.
+ // It must be handled ahead of dropThreadPrivilege()
+ // Otherwise, smack violation might hanppen from 'libdbuspolicy'.
+ global.tizen.systeminfo.getPropertyValue("CPU", () => { }, () => { });
+}
+
export function startService(id: string, filename: string) {
console.debug(`startService - ${id}`);
+ initializeExtensionOnMain();
if (global['serviceType'] === 'STANDALONE') {
let ids = id.split(':');
let serviceId = ids[0];
}
export function start(id: string, filename: string) {
+ let ids = id.split(':');
+ let serviceId = ids[0];
+ let packageId = wrt.getPackageId(serviceId);
wrt.setServiceAppId(id);
+ wrt.security?.dropThreadPrivilege(packageId, serviceId);
+
XWalkExtension.initialize();
XWalkExtension.setRuntimeMessageHandler((type, data) => {
if (type === 'tizen://exit') {
console.debug(`serviceType : ${global['serviceType']}`)
new DeviceAPIRouter(id, isGlobalService());
-
- // this is workaround solution to make webapis singleton worker
- // ahead of dropThreadPrivilege()
- global.tizen.systeminfo.getPropertyValue("CPU", () => { }, () => { });
+ printAppControlData(id);
// This is for awaking up uv loop.
if (isGlobalService()) {
}
try {
- let ids = id.split(':');
- let serviceId = ids[0];
- let packageId = global.webapis.getPackageId();
- wrt.security?.dropThreadPrivilege(packageId, serviceId);
- printAppControlData(id);
-
app = require(filename);
if (app.onStart !== undefined) {
app.onStart();