commit | 3842e7ec13687f928fa7b5f6f3e05250283b8233 | [log] [tgz] |
---|---|---|
author | Ramin Halavati <[email protected]> | Wed Jul 31 04:39:21 2024 |
committer | Chromium LUCI CQ <[email protected]> | Wed Jul 31 04:39:21 2024 |
tree | 34d7667e548526b3f2d6bd9e2f3ab804008279e2 | |
parent | 2f6f99488f1f8784ae1e0bdca45a0843c85f6663 [diff] [blame] |
Reland: Shutdown ScreenAI service if it has no clients. ScreenAI service checks periodically if there are any remotes connected to it, and if there is none, shuts itself down to release resources. The first patch of this CL is the last patch of the reverted one. Cq-Include-Trybots: luci.chromium.try:linux_chromium_msan_rel_ng AX-Relnotes: n/a Bug: 353718857 Change-Id: I34aad66b8bfea73650f563a32c7f9bf9576551ea Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5741655 Reviewed-by: David Tseng <[email protected]> Reviewed-by: Alex Gough <[email protected]> Commit-Queue: Ramin Halavati <[email protected]> Cr-Original-Commit-Position: refs/heads/main@{#1334635} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5746964 Cr-Commit-Position: refs/heads/main@{#1335236}
diff --git a/services/screen_ai/screen_ai_service_impl.cc b/services/screen_ai/screen_ai_service_impl.cc index cb36243..75dc8be3 100644 --- a/services/screen_ai/screen_ai_service_impl.cc +++ b/services/screen_ai/screen_ai_service_impl.cc
@@ -459,4 +459,12 @@ } } +void ScreenAIService::ShutDownIfNoClients() { + bool no_clients = screen_ai_annotators_.empty() && + screen_2x_main_content_extractors_.empty(); + if (no_clients) { + base::Process::TerminateCurrentProcessImmediately(0); + } +} + } // namespace screen_ai