mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-20 21:44:06 +01:00
alloy: Fix shutdown assert if OneShotTimer is deleted on the wrong thread
This commit is contained in:
parent
1e1133ec66
commit
303280dd71
@ -765,7 +765,10 @@ void AlloyBrowserHostImpl::DestroyBrowser() {
|
||||
menu_manager_.reset(nullptr);
|
||||
|
||||
// Delete the audio capturer
|
||||
recently_audible_timer_.Stop();
|
||||
if (recently_audible_timer_) {
|
||||
recently_audible_timer_->Stop();
|
||||
recently_audible_timer_.reset();
|
||||
}
|
||||
audio_capturer_.reset(nullptr);
|
||||
|
||||
CefBrowserHostBase::DestroyBrowser();
|
||||
@ -1501,14 +1504,19 @@ void AlloyBrowserHostImpl::DidFinishNavigation(
|
||||
|
||||
void AlloyBrowserHostImpl::OnAudioStateChanged(bool audible) {
|
||||
if (audible) {
|
||||
recently_audible_timer_.Stop();
|
||||
if (recently_audible_timer_)
|
||||
recently_audible_timer_->Stop();
|
||||
|
||||
StartAudioCapturer();
|
||||
} else if (audio_capturer_) {
|
||||
if (!recently_audible_timer_)
|
||||
recently_audible_timer_ = std::make_unique<base::OneShotTimer>();
|
||||
|
||||
// If you have a media playing that has a short quiet moment, web_contents
|
||||
// will immediately switch to non-audible state. We don't want to stop
|
||||
// audio stream so quickly, let's give the stream some time to resume
|
||||
// playing.
|
||||
recently_audible_timer_.Start(
|
||||
recently_audible_timer_->Start(
|
||||
FROM_HERE, kRecentlyAudibleTimeout,
|
||||
base::BindOnce(&AlloyBrowserHostImpl::OnRecentlyAudibleTimerFired,
|
||||
this));
|
||||
|
@ -370,7 +370,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
// Timer for determining when "recently audible" transitions to false. This
|
||||
// starts running when a tab stops being audible, and is canceled if it starts
|
||||
// being audible again before it fires.
|
||||
base::OneShotTimer recently_audible_timer_;
|
||||
std::unique_ptr<base::OneShotTimer> recently_audible_timer_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_HOST_IMPL_H_
|
||||
|
Loading…
Reference in New Issue
Block a user