Merge pull request #10223 from ajmacd/shutdown-desktop-capturers

Ensure DesktopCapturers are destroyed when no longer needed.
This commit is contained in:
Cheng Zhao 2017-08-10 21:28:31 +09:00 committed by GitHub
commit c6289ef219
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 OnSourceNameChanged(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;
protected:

View file

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