From 6c0a61ea15991256be5c53e4b32d15d141604e39 Mon Sep 17 00:00:00 2001 From: "leandrogracia@chromium.org" Date: Wed, 22 Dec 2010 22:40:58 +0000 Subject: Set scoped IO access when closing the audio input thread to allow joining. This is a fix for the crash problem described by issue 67806. The problem was caused by a new included IO access assertion that prevented the IO thread to join any other thread. This raised an error when trying to stop the audio recording thread. BUG=67806 TEST=none Review URL: http://codereview.chromium.org/6063004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69994 0039d316-1c4b-4281-b951-d872f2087c98 --- media/audio/audio_input_controller.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'media/audio') diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc index b5c9df2b..50fb39d 100644 --- a/media/audio/audio_input_controller.cc +++ b/media/audio/audio_input_controller.cc @@ -3,6 +3,8 @@ // found in the LICENSE file. #include "media/audio/audio_input_controller.h" + +#include "base/thread_restrictions.h" #include "media/base/limits.h" namespace { @@ -68,6 +70,15 @@ void AudioInputController::Close() { thread_.message_loop()->PostTask( FROM_HERE, NewRunnableMethod(this, &AudioInputController::DoClose)); + + // A ScopedAllowIO object is required to join the thread when calling Stop. + // This is because as joining threads may be a long operation it's now + // not allowed in threads without IO access, which is the case of the IO + // thread (it is missnamed) being used here. This object overrides + // temporarily this restriction and should be used only in specific + // infrequent cases where joining is guaranteed to be fast. + // Bug: http://code.google.com/p/chromium/issues/detail?id=67806 + base::ThreadRestrictions::ScopedAllowIO allow_io_for_thread_join; thread_.Stop(); } -- cgit v1.1