Bug 821062 - Share a decoding thread pool for all AudioContexts; r=padenot

This commit is contained in:
Ehsan Akhgari 2014-02-20 09:02:14 -05:00
parent 67f0c0ca2e
commit 492c419c55
3 changed files with 4 additions and 19 deletions

View File

@ -564,8 +564,6 @@ AudioContext::Shutdown()
Mute();
}
mDecoder.Shutdown();
// Release references to active nodes.
// Active AudioNodes don't unregister in destructors, at which point the
// Node is already unregistered.

View File

@ -518,26 +518,14 @@ bool
MediaBufferDecoder::EnsureThreadPoolInitialized()
{
if (!mThreadPool) {
mThreadPool = do_CreateInstance(NS_THREADPOOL_CONTRACTID);
mThreadPool = SharedThreadPool::Get(NS_LITERAL_CSTRING("MediaBufferDecoder"));
if (!mThreadPool) {
return false;
}
mThreadPool->SetName(NS_LITERAL_CSTRING("MediaBufferDecoder"));
}
return true;
}
void
MediaBufferDecoder::Shutdown() {
if (mThreadPool) {
// Setting threadLimit to 0 causes threads to exit when all events have
// been run, like nsIThreadPool::Shutdown(), but doesn't run a nested event
// loop nor wait until this has happened.
mThreadPool->SetThreadLimit(0);
mThreadPool = nullptr;
}
}
WebAudioDecodeJob::WebAudioDecodeJob(const nsACString& aContentType,
AudioContext* aContext,
const ArrayBuffer& aBuffer,

View File

@ -10,11 +10,12 @@
#include "nsWrapperCache.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsIThreadPool.h"
#include "SharedThreadPool.h"
#include "nsString.h"
#include "nsTArray.h"
#include "mozilla/dom/TypedArray.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/RefPtr.h"
namespace mozilla {
@ -82,8 +83,6 @@ public:
bool SyncDecodeMedia(const char* aContentType, uint8_t* aBuffer,
uint32_t aLength, WebAudioDecodeJob& aDecodeJob);
void Shutdown();
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{
return 0;
@ -93,7 +92,7 @@ private:
bool EnsureThreadPoolInitialized();
private:
nsCOMPtr<nsIThreadPool> mThreadPool;
RefPtr<SharedThreadPool> mThreadPool;
};
}