summaryrefslogtreecommitdiffstats
path: root/media/audio
diff options
context:
space:
mode:
authorleandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-22 22:40:58 +0000
committerleandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-22 22:40:58 +0000
commit6c0a61ea15991256be5c53e4b32d15d141604e39 (patch)
treec9b228294c8c82a83dee90714befc120cacc2c75 /media/audio
parent7524cd89b0dda14dfcc0d477a576da5e1dee59d1 (diff)
downloadchromium_src-6c0a61ea15991256be5c53e4b32d15d141604e39.zip
chromium_src-6c0a61ea15991256be5c53e4b32d15d141604e39.tar.gz
chromium_src-6c0a61ea15991256be5c53e4b32d15d141604e39.tar.bz2
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
Diffstat (limited to 'media/audio')
-rw-r--r--media/audio/audio_input_controller.cc11
1 files changed, 11 insertions, 0 deletions
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();
}