Commit b1b7aac6 authored by Olga Sharonova's avatar Olga Sharonova Committed by Commit Bot

Reland "Delay audio service launch on the browser startup."

This is a reland of eab3705f

Original change's description:
> Delay audio service launch on the browser startup.
>
> (see the bug) From the traces the service/process creation gets posted to the
> IO thread during startup.
> It may be delaying startup for some other services needed for the first paint, or it may be
> just eating up CPU when the load is already quite high. We'll experiment with delaying
> the service launch.
>
> Bug: 867461
> Change-Id: I048e33d049e665d8e9489046c5813918d8077524
> Reviewed-on: https://chromium-review.googlesource.com/1153248
> Commit-Queue: Olga Sharonova <olka@chromium.org>
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#579460}

Bug: 867461,870171
Change-Id: Ia1a0c31ccc6c643ad10fb250862a9d1fb408c216
Reviewed-on: https://chromium-review.googlesource.com/1162184
Commit-Queue: Marina Ciocea <marinaciocea@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580905}
parent 8d157075
......@@ -1712,9 +1712,20 @@ void BrowserMainLoop::InitializeAudio() {
}
if (base::FeatureList::IsEnabled(features::kAudioServiceLaunchOnStartup)) {
content::ServiceManagerConnection::GetForProcess()
->GetConnector()
->StartService(audio::mojom::kServiceName);
// Schedule the audio service startup on the main thread.
BrowserThread::PostAfterStartupTask(
FROM_HERE, BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
base::BindOnce([]() {
TRACE_EVENT0("audio", "Starting audio service");
ServiceManagerConnection* connection =
content::ServiceManagerConnection::GetForProcess();
if (connection) {
// The browser is not shutting down: |connection| would be null
// otherwise.
connection->GetConnector()->StartService(
audio::mojom::kServiceName);
}
}));
}
audio_system_ = audio::CreateAudioSystem(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment