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

Unified Diff: Source/modules/webaudio/AsyncAudioDecoder.cpp

Issue 205173002: Move webaudio to oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: WIP Created 6 years, 9 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 | « Source/modules/webaudio/AsyncAudioDecoder.h ('k') | Source/modules/webaudio/AudioBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AsyncAudioDecoder.cpp
diff --git a/Source/modules/webaudio/AsyncAudioDecoder.cpp b/Source/modules/webaudio/AsyncAudioDecoder.cpp
index f1ea34f4c71456fad2716838e7c95099aba78e67..44dc7317176adcd0f5c5a1c80fe1ecc396a28005 100644
--- a/Source/modules/webaudio/AsyncAudioDecoder.cpp
+++ b/Source/modules/webaudio/AsyncAudioDecoder.cpp
@@ -41,10 +41,22 @@ namespace WebCore {
AsyncAudioDecoder::AsyncAudioDecoder()
: m_thread(adoptPtr(blink::Platform::current()->createThread("Audio Decoder")))
{
+ m_thread->postTask(new Task(WTF::bind(&AsyncAudioDecoder::setupAudioDecoderThread)));
keishi 2014/03/19 20:33:45 Adding this line fixes an assertion failure but ca
haraken 2014/03/19 21:03:47 Looks like you're hitting dead lock. Isn't there
}
AsyncAudioDecoder::~AsyncAudioDecoder()
{
+ m_thread->postTask(new Task(WTF::bind(&AsyncAudioDecoder::cleanupAudioDecoderThread)));
+}
+
+void AsyncAudioDecoder::setupAudioDecoderThread()
+{
+ ThreadState::attach();
+}
+
+void AsyncAudioDecoder::cleanupAudioDecoderThread()
+{
+ ThreadState::detach();
}
void AsyncAudioDecoder::decodeAsync(ArrayBuffer* audioData, float sampleRate, PassOwnPtr<AudioBufferCallback> successCallback, PassOwnPtr<AudioBufferCallback> errorCallback)
@@ -64,7 +76,7 @@ void AsyncAudioDecoder::decodeAsync(ArrayBuffer* audioData, float sampleRate, Pa
void AsyncAudioDecoder::decode(ArrayBuffer* audioData, float sampleRate, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback)
{
// Do the actual decoding and invoke the callback.
- RefPtr<AudioBuffer> audioBuffer = AudioBuffer::createFromAudioFileData(audioData->data(), audioData->byteLength(), false, sampleRate);
+ RefPtrWillBeRawPtr<AudioBuffer> audioBuffer = AudioBuffer::createFromAudioFileData(audioData->data(), audioData->byteLength(), false, sampleRate);
// Decoding is finished, but we need to do the callbacks on the main thread.
// The leaked reference to audioBuffer is picked up in notifyComplete.
@@ -77,7 +89,9 @@ void AsyncAudioDecoder::notifyComplete(ArrayBuffer* audioData, AudioBufferCallba
RefPtr<ArrayBuffer> audioDataRef = adoptRef(audioData);
OwnPtr<AudioBufferCallback> successCallbackPtr = adoptPtr(successCallback);
OwnPtr<AudioBufferCallback> errorCallbackPtr = adoptPtr(errorCallback);
- RefPtr<AudioBuffer> audioBufferRef = adoptRef(audioBuffer);
+#if !ENABLE(OILPAN)
+ RefPtrWillBeRawPtr<AudioBuffer> audioBufferRef = adoptRefWillBeNoop(audioBuffer);
+#endif
if (audioBuffer && successCallback)
successCallback->handleEvent(audioBuffer);
« no previous file with comments | « Source/modules/webaudio/AsyncAudioDecoder.h ('k') | Source/modules/webaudio/AudioBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698