[WRTjs][Service] Remove polling of message queue 64/291364/3
authorDongHyun Song <dh81.song@samsung.com>
Fri, 14 Apr 2023 00:38:26 +0000 (09:38 +0900)
committerBot Blink <blinkbot@samsung.com>
Fri, 14 Apr 2023 07:44:14 +0000 (07:44 +0000)
This will handle message queue on demand and remove unncessary
polling.

Change-Id: I5b989d9c3cadb013bf6bdb2e668d04f2e2a70c0d
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
packaging/chromium-efl.spec
wrt/src/app/service_main.cc

index 54ead18bf2e4b00528d313c00582c944141cf2d6..50fc056dff7d9094e3108f457dd99e6094daa7b5 100755 (executable)
@@ -2,7 +2,7 @@ Name: chromium-efl
 Summary: Chromium EFL
 # Version: {TPK_VERSION}.{INTERNAL_API_REVISION}.{CHROMIUM_MAJOR_VERSION}
 # The {INTERNAL_API_REVISION} is used for compatibility check with wrtjs.
-Version: 1.1.94
+Version: 1.2.94
 # Set by ./tizen_src/scripts/update_chromium_version.sh
 %define upstream_chromium_version 94.0.4606.31
 Release: 1
index cf852233a3232568bf70a8bb89316ac2f38c8928..7e05a02b9811c250c6e8af558a62b1b14defa19a 100644 (file)
@@ -63,7 +63,9 @@ gboolean HandleCommandQueue(gpointer /*data*/) {
       break;
     }
   } while (!command_queue.empty());
-  return true;
+
+  message_queue_timer = 0;
+  return G_SOURCE_REMOVE;
 }
 
 void ChildCreated() {
@@ -131,6 +133,8 @@ void OnAppControl(app_control_h app_control, void* data) {
     wrt_ipc->SendMessage(command_key.c_str(), command_value.c_str());
   } else {
     command_queue.push(std::make_pair(command_key, command_value));
+    if (!message_queue_timer)
+      message_queue_timer = g_timeout_add_seconds(1, HandleCommandQueue, nullptr);
   }
 }
 
@@ -139,7 +143,6 @@ bool OnCreate(void* data) {
   if (!child_created)
     StartProcess(static_cast<char*>(data));
 
-  message_queue_timer = g_timeout_add_seconds(1, HandleCommandQueue, nullptr);
   return true;
 }
 
@@ -147,8 +150,10 @@ void OnTerminate(void* data) {
   LOG(INFO) << "wrt-service will be terminated.";
   ChildTerminated(0);
 
-  if (message_queue_timer)
+  if (message_queue_timer) {
     g_source_remove(message_queue_timer);
+    message_queue_timer = 0;
+  }
 }
 
 }  // namespace