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

Unified Diff: media/audio/audio_device_thread.cc

Issue 2038053002: Change audio render thread checking to use new AudioRendererSink::BelongsToRendererThread() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix. Rebase. 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
Index: media/audio/audio_device_thread.cc
diff --git a/media/audio/audio_device_thread.cc b/media/audio/audio_device_thread.cc
index 20874599e68f5f7cfddeff0022291e64aa718b6c..5d0767a3f087b58dd6a104eced9069de4ed41a34 100644
--- a/media/audio/audio_device_thread.cc
+++ b/media/audio/audio_device_thread.cc
@@ -230,11 +230,17 @@ AudioDeviceThread::Callback::Callback(const AudioParameters& audio_parameters,
CHECK_GT(total_segments_, 0);
CHECK_EQ(memory_length_ % total_segments_, 0);
segment_length_ = memory_length_ / total_segments_;
+ thread_checker_.DetachFromThread();
}
AudioDeviceThread::Callback::~Callback() {}
void AudioDeviceThread::Callback::InitializeOnAudioThread() {
+ // Normally this function is called before the thread checker is used
+ // elsewhere, but it's not guaranteed. DCHECK to ensure it was not used on
+ // another thread before we get here.
+ DCHECK(thread_checker_.CalledOnValidThread())
+ << "Thread checker was attached on the wrong thread";
MapSharedMemory();
CHECK(shared_memory_.memory());
}

Powered by Google App Engine
This is Rietveld 408576698