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

Unified Diff: media/audio/audio_input_device.cc

Issue 2828233002: DCHECK that audio devices are stopped prior to destruction. (Closed)
Patch Set: More DCHECKs! Created 3 years, 8 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 | media/audio/audio_input_device_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_input_device.cc
diff --git a/media/audio/audio_input_device.cc b/media/audio/audio_input_device.cc
index aa44d9d7552e0c4f40cf550465aa891fdf8edec9..07b966cba0ce817139cc6696953e1113459af23c 100644
--- a/media/audio/audio_input_device.cc
+++ b/media/audio/audio_input_device.cc
@@ -191,7 +191,17 @@ void AudioInputDevice::OnIPCClosed() {
ipc_.reset();
}
-AudioInputDevice::~AudioInputDevice() {}
+AudioInputDevice::~AudioInputDevice() {
+#if DCHECK_IS_ON()
+ // Make sure we've stopped the stream properly before destructing |this|.
+ DCHECK(audio_thread_lock_.Try());
+ DCHECK_LE(state_, IDLE);
+ DCHECK(!audio_thread_);
+ DCHECK(!audio_callback_);
+ DCHECK(!stopping_hack_);
+ audio_thread_lock_.Release();
+#endif // DCHECK_IS_ON()
+}
void AudioInputDevice::StartUpOnIOThread() {
DCHECK(task_runner()->BelongsToCurrentThread());
« no previous file with comments | « no previous file | media/audio/audio_input_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698