Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1142)

Unified Diff: third_party/WebKit/Source/platform/audio/HRTFElevation.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}
« no previous file with comments | « third_party/WebKit/Source/platform/audio/HRTFElevation.h ('k') | third_party/WebKit/Source/platform/audio/HRTFKernel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698