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()); |
} |