Bug 1180355 - Initialize the AudioChannelAgent after AudioContext has gained a stable refcount; r=baku

This commit is contained in:
Ehsan Akhgari 2015-07-04 00:13:03 -04:00
Родитель 1bff6caf2d
Коммит 70caaac6af
2 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -105,6 +105,11 @@ AudioContext::AudioContext(nsPIDOMWindow* aWindow,
// bound to the window.
mDestination = new AudioDestinationNode(this, aIsOffline, aChannel,
aNumberOfChannels, aLength, aSampleRate);
}
void
AudioContext::Init()
{
// We skip calling SetIsOnlyNodeForContext and the creation of the
// audioChannelAgent during mDestination's constructor, because we can only
// call them after mDestination has been set up.
@ -145,6 +150,7 @@ AudioContext::Constructor(const GlobalObject& aGlobal,
nsRefPtr<AudioContext> object =
new AudioContext(window, false,
AudioChannelService::GetDefaultAudioChannel());
object->Init();
RegisterWeakMemoryReporter(object);
@ -163,6 +169,7 @@ AudioContext::Constructor(const GlobalObject& aGlobal,
}
nsRefPtr<AudioContext> object = new AudioContext(window, false, aChannel);
object->Init();
RegisterWeakMemoryReporter(object);

Просмотреть файл

@ -101,6 +101,8 @@ class AudioContext final : public DOMEventTargetHelper,
float aSampleRate = 0.0f);
~AudioContext();
void Init();
public:
typedef uint64_t AudioContextId;