Ensure DesktopCapturers are destroyed when no longer needed.

This commit is contained in:
Andrew MacDonald 2017-08-04 15:06:58 -07:00
parent 5b9d31d3ff
commit a8759a3176
2 changed files with 6 additions and 0 deletions

View file

@ -14,6 +14,9 @@ class DesktopMediaListObserver {
virtual void OnSourceMoved(int old_index, int new_index) = 0; virtual void OnSourceMoved(int old_index, int new_index) = 0;
virtual void OnSourceNameChanged(int index) = 0; virtual void OnSourceNameChanged(int index) = 0;
virtual void OnSourceThumbnailChanged(int index) = 0; virtual void OnSourceThumbnailChanged(int index) = 0;
// Return false to stop refreshing. The associated |DesktopMediaList| should
// no longer be used.
virtual bool OnRefreshFinished() = 0; virtual bool OnRefreshFinished() = 0;
protected: protected:

View file

@ -368,5 +368,8 @@ void NativeDesktopMediaList::OnRefreshFinished() {
base::Bind(&NativeDesktopMediaList::Refresh, base::Bind(&NativeDesktopMediaList::Refresh,
weak_factory_.GetWeakPtr()), weak_factory_.GetWeakPtr()),
update_period_); update_period_);
} else {
// Destroy the capturers.
worker_.reset();
} }
} }