mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-01 11:57:04 +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);
|
menu_manager_.reset(nullptr);
|
||||||
|
|
||||||
// Delete the audio capturer
|
// Delete the audio capturer
|
||||||
recently_audible_timer_.Stop();
|
if (recently_audible_timer_) {
|
||||||
|
recently_audible_timer_->Stop();
|
||||||
|
recently_audible_timer_.reset();
|
||||||
|
}
|
||||||
audio_capturer_.reset(nullptr);
|
audio_capturer_.reset(nullptr);
|
||||||
|
|
||||||
CefBrowserHostBase::DestroyBrowser();
|
CefBrowserHostBase::DestroyBrowser();
|
||||||
@ -1501,14 +1504,19 @@ void AlloyBrowserHostImpl::DidFinishNavigation(
|
|||||||
|
|
||||||
void AlloyBrowserHostImpl::OnAudioStateChanged(bool audible) {
|
void AlloyBrowserHostImpl::OnAudioStateChanged(bool audible) {
|
||||||
if (audible) {
|
if (audible) {
|
||||||
recently_audible_timer_.Stop();
|
if (recently_audible_timer_)
|
||||||
|
recently_audible_timer_->Stop();
|
||||||
|
|
||||||
StartAudioCapturer();
|
StartAudioCapturer();
|
||||||
} else if (audio_capturer_) {
|
} 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
|
// 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
|
// 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
|
// audio stream so quickly, let's give the stream some time to resume
|
||||||
// playing.
|
// playing.
|
||||||
recently_audible_timer_.Start(
|
recently_audible_timer_->Start(
|
||||||
FROM_HERE, kRecentlyAudibleTimeout,
|
FROM_HERE, kRecentlyAudibleTimeout,
|
||||||
base::BindOnce(&AlloyBrowserHostImpl::OnRecentlyAudibleTimerFired,
|
base::BindOnce(&AlloyBrowserHostImpl::OnRecentlyAudibleTimerFired,
|
||||||
this));
|
this));
|
||||||
|
@ -370,7 +370,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
|||||||
// Timer for determining when "recently audible" transitions to false. This
|
// Timer for determining when "recently audible" transitions to false. This
|
||||||
// starts running when a tab stops being audible, and is canceled if it starts
|
// starts running when a tab stops being audible, and is canceled if it starts
|
||||||
// being audible again before it fires.
|
// 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_
|
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_HOST_IMPL_H_
|
||||||
|
Loading…
x
Reference in New Issue
Block a user