media::AudioManager::Get() pattern is not self-sufficient. |
||
Issue descriptionThe global variable |g_last_created| pointing to AudioManager is reset in a non-thread-safe way on a thread AudioManagerDeleter is called on (https://cs.chromium.org/chromium/src/media/audio/audio_manager.cc?type=cs&l=274). Clients access it in a non-thread way through AudioManager::Get(). The only reason the code works is the way Content manages lifetime of the browser threads and of the AudioManager. And it does NOT work if AudioManager::Get() is called on audio thread. AudioManager is in media and should know nothing about threading of its clients. And without that context AudioManager::Get() is non-thread-safe and misleading. We should re-work it or better get rid of it.
,
Jan 31 2017
The global pointer to AM is reset on UI thread before AM is posted for deletion to the audio thread (see AM deleter). And there can be tasks queued up on audio thread Wich will be executed after that. AM is alive, but AM::Get() returns nullptr.
,
Feb 1 2017
For background, crbug.com/667981 was caused by using Get on the audio manager thread.
,
Feb 20 2017
Issue 694197 is another example.
,
Jul 11 2017
AudioManager and AudioThread lifetimes were changed recently, not applicable any more. |
||
►
Sign in to add a comment |
||
Comment 1 by dalecur...@chromium.org
, Jan 31 2017