зеркало из https://github.com/mozilla/gecko-dev.git
bug 1203380 add custom AudioBlock copy constructor and make AudioChunk conversion constructor explicit r=padenot
Making the conversion constructor explicit means that it will be obvious if a temporary is created to pass an AudioChunk as an AudioBlock parameter. --HG-- extra : rebase_source : 54bf8acdb42499a0e0d66cfc138ff6fb6f1ef4da
This commit is contained in:
Родитель
965591c713
Коммит
99e730c642
|
@ -24,9 +24,16 @@ public:
|
||||||
AudioBlock() {
|
AudioBlock() {
|
||||||
mDuration = WEBAUDIO_BLOCK_SIZE;
|
mDuration = WEBAUDIO_BLOCK_SIZE;
|
||||||
}
|
}
|
||||||
MOZ_IMPLICIT AudioBlock(const AudioChunk& aChunk) {
|
// No effort is made in constructors to ensure that mBufferIsDownstreamRef
|
||||||
mDuration = WEBAUDIO_BLOCK_SIZE;
|
// is set because the block is expected to be a temporary and so the
|
||||||
operator=(aChunk);
|
// reference will be released before the next iteration.
|
||||||
|
// The custom copy constructor is required so as not to set
|
||||||
|
// mBufferIsDownstreamRef without notifying AudioBlockBuffer.
|
||||||
|
AudioBlock(const AudioBlock& aBlock) : AudioChunk(aBlock.AsAudioChunk()) {}
|
||||||
|
explicit AudioBlock(const AudioChunk& aChunk)
|
||||||
|
: AudioChunk(aChunk)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(aChunk.mDuration == WEBAUDIO_BLOCK_SIZE);
|
||||||
}
|
}
|
||||||
~AudioBlock();
|
~AudioBlock();
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче