Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 2084643003: Invalidate FFmpegDemuxer WeakPtrs on the right thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_demuxer.cc
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 5dc61ea35cbb238c6eaa364b099139f22c9c8d17..8925c3eab8ab0dcf6870a6715485dfdfcf0d558a 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -786,7 +786,11 @@ FFmpegDemuxer::FFmpegDemuxer(
DCHECK(!media_tracks_updated_cb_.is_null());
}
-FFmpegDemuxer::~FFmpegDemuxer() {}
+FFmpegDemuxer::~FFmpegDemuxer() {
+ // NOTE: This class is not destroyed on |task_runner|, so we must ensure that
+ // there are no outstanding WeakPtrs by the time we reach here.
+ DCHECK(!weak_factory_.HasWeakPtrs());
+}
std::string FFmpegDemuxer::GetDisplayName() const {
return "FFmpegDemuxer";
@@ -848,6 +852,10 @@ void FFmpegDemuxer::Stop() {
}
data_source_ = NULL;
+
+ // Invalidate WeakPtrs on |task_runner_|, destruction may happen on another
+ // thread.
+ weak_factory_.InvalidateWeakPtrs();
}
void FFmpegDemuxer::StartWaitingForSeek(base::TimeDelta seek_time) {}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698