mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 21:28:55 +00:00
Bug 821062 - Share a decoding thread pool for all AudioContexts; r=padenot
This commit is contained in:
parent
67f0c0ca2e
commit
492c419c55
@ -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.
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user