Index: third_party/WebKit/Source/platform/audio/HRTFElevation.cpp |
diff --git a/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp b/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp |
index aa8ca147c312787174821994ee6c235c458e8652..c51917d83e309e283904fe7710503de97100b9e5 100644 |
--- a/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp |
+++ b/third_party/WebKit/Source/platform/audio/HRTFElevation.cpp |
@@ -26,13 +26,15 @@ |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#include "platform/audio/HRTFElevation.h" |
-#include <math.h> |
-#include <algorithm> |
#include "platform/audio/AudioBus.h" |
+#include "platform/audio/HRTFElevation.h" |
#include "platform/audio/HRTFPanner.h" |
+#include "wtf/PtrUtil.h" |
#include "wtf/ThreadingPrimitives.h" |
#include "wtf/text/StringHash.h" |
+#include <algorithm> |
+#include <math.h> |
+#include <memory> |
namespace blink { |
@@ -96,7 +98,7 @@ static PassRefPtr<AudioBus> getConcatenatedImpulseResponsesForSubject(const Stri |
} |
#endif |
-bool HRTFElevation::calculateKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName, OwnPtr<HRTFKernel>& kernelL, OwnPtr<HRTFKernel>& kernelR) |
+bool HRTFElevation::calculateKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName, std::unique_ptr<HRTFKernel>& kernelL, std::unique_ptr<HRTFKernel>& kernelR) |
{ |
// Valid values for azimuth are 0 -> 345 in 15 degree increments. |
// Valid values for elevation are -45 -> +90 in 15 degree increments. |
@@ -219,15 +221,15 @@ static int maxElevations[] = { |
45 // 345 |
}; |
-PassOwnPtr<HRTFElevation> HRTFElevation::createForSubject(const String& subjectName, int elevation, float sampleRate) |
+std::unique_ptr<HRTFElevation> HRTFElevation::createForSubject(const String& subjectName, int elevation, float sampleRate) |
{ |
bool isElevationGood = elevation >= -45 && elevation <= 90 && (elevation / 15) * 15 == elevation; |
ASSERT(isElevationGood); |
if (!isElevationGood) |
return nullptr; |
- OwnPtr<HRTFKernelList> kernelListL = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); |
- OwnPtr<HRTFKernelList> kernelListR = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); |
+ std::unique_ptr<HRTFKernelList> kernelListL = wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); |
+ std::unique_ptr<HRTFKernelList> kernelListR = wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); |
// Load convolution kernels from HRTF files. |
int interpolatedIndex = 0; |
@@ -256,11 +258,11 @@ PassOwnPtr<HRTFElevation> HRTFElevation::createForSubject(const String& subjectN |
} |
} |
- OwnPtr<HRTFElevation> hrtfElevation = adoptPtr(new HRTFElevation(std::move(kernelListL), std::move(kernelListR), elevation, sampleRate)); |
+ std::unique_ptr<HRTFElevation> hrtfElevation = wrapUnique(new HRTFElevation(std::move(kernelListL), std::move(kernelListR), elevation, sampleRate)); |
return hrtfElevation; |
} |
-PassOwnPtr<HRTFElevation> HRTFElevation::createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, float x, float sampleRate) |
+std::unique_ptr<HRTFElevation> HRTFElevation::createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, float x, float sampleRate) |
{ |
ASSERT(hrtfElevation1 && hrtfElevation2); |
if (!hrtfElevation1 || !hrtfElevation2) |
@@ -268,8 +270,8 @@ PassOwnPtr<HRTFElevation> HRTFElevation::createByInterpolatingSlices(HRTFElevati |
ASSERT(x >= 0.0 && x < 1.0); |
- OwnPtr<HRTFKernelList> kernelListL = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); |
- OwnPtr<HRTFKernelList> kernelListR = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths)); |
+ std::unique_ptr<HRTFKernelList> kernelListL = wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); |
+ std::unique_ptr<HRTFKernelList> kernelListR = wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); |
HRTFKernelList* kernelListL1 = hrtfElevation1->kernelListL(); |
HRTFKernelList* kernelListR1 = hrtfElevation1->kernelListR(); |
@@ -285,7 +287,7 @@ PassOwnPtr<HRTFElevation> HRTFElevation::createByInterpolatingSlices(HRTFElevati |
// Interpolate elevation angle. |
double angle = (1.0 - x) * hrtfElevation1->elevationAngle() + x * hrtfElevation2->elevationAngle(); |
- OwnPtr<HRTFElevation> hrtfElevation = adoptPtr(new HRTFElevation(std::move(kernelListL), std::move(kernelListR), static_cast<int>(angle), sampleRate)); |
+ std::unique_ptr<HRTFElevation> hrtfElevation = wrapUnique(new HRTFElevation(std::move(kernelListL), std::move(kernelListR), static_cast<int>(angle), sampleRate)); |
return hrtfElevation; |
} |