Simplify Libassistant startup (and fix crashes)
Currently starting Libassistant happens in 2 steps: 1. (On background thread) ServiceController::Start() creates the |AssistantManager|. 2. (On main thread) ServiceControllerProxy::FinishAssistantStart() sets some extra fields on |AssistantManager| and calls AssistantManager::Start(). This causes a race condition if Libassistant is immediately stopped, as that happens on the background thread and can collide with step 2 above. To prevent this from happening, this CL collapses both starting steps in a single step that runs on the background thread. We do this by registering a callback which is called by the background thread in step 1 above. This callback is temporary but necessary as some parts of the initialization code still use objects that have not been migrated to the Libassistant mojom service yet. Bug: 1157177, b/171748795, 1128032 Test: chromeos_unittests "Assistant*:ServiceController*" Change-Id: Ifab9705839ad5d3e5c9f2b7f7fba4c336b9f7c9d Cq-Include-Trybots: luci.chrome.try:linux-chromeos-chrome Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2594090 Commit-Queue: Jeroen Dhollander <jeroendh@chromium.org> Reviewed-by:Xiaohui Chen <xiaohuic@chromium.org> Cr-Commit-Position: refs/heads/master@{#838277}
Showing
Please register or sign in to comment