Clean up unnecessary Create() factory functions in platform/audio

As advised in [1], this CL removes unnecessary Foo::Create() in
//third_party/blink/renderer/platform/audio and make their constructors
public, then make the callers use std::make_unique<Foo> instead
of their Create() factory functions.

[1] https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/iJ1bawbxbWs/vEdfT5QtBgAJ

Bug: 939691
Change-Id: Ic613dd9ef74061fe92234fbd9680cab37f3db5d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1525762
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#641156}
diff --git a/third_party/blink/renderer/modules/webaudio/stereo_panner_node.cc b/third_party/blink/renderer/modules/webaudio/stereo_panner_node.cc
index 8cd20ac..f49c4d5 100644
--- a/third_party/blink/renderer/modules/webaudio/stereo_panner_node.cc
+++ b/third_party/blink/renderer/modules/webaudio/stereo_panner_node.cc
@@ -85,7 +85,7 @@
   if (IsInitialized())
     return;
 
-  stereo_panner_ = StereoPanner::Create(Context()->sampleRate());
+  stereo_panner_ = std::make_unique<StereoPanner>(Context()->sampleRate());
 
   AudioHandler::Initialize();
 }
diff --git a/third_party/blink/renderer/platform/audio/hrtf_database.cc b/third_party/blink/renderer/platform/audio/hrtf_database.cc
index 89f88a5..41f3687f 100644
--- a/third_party/blink/renderer/platform/audio/hrtf_database.cc
+++ b/third_party/blink/renderer/platform/audio/hrtf_database.cc
@@ -45,10 +45,6 @@
 const unsigned HRTFDatabase::kNumberOfTotalElevations =
     kNumberOfRawElevations * kInterpolationFactor;
 
-std::unique_ptr<HRTFDatabase> HRTFDatabase::Create(float sample_rate) {
-  return base::WrapUnique(new HRTFDatabase(sample_rate));
-}
-
 HRTFDatabase::HRTFDatabase(float sample_rate)
     : elevations_(kNumberOfTotalElevations), sample_rate_(sample_rate) {
   unsigned elevation_index = 0;
diff --git a/third_party/blink/renderer/platform/audio/hrtf_database.h b/third_party/blink/renderer/platform/audio/hrtf_database.h
index 708fab1..0a7a6b2 100644
--- a/third_party/blink/renderer/platform/audio/hrtf_database.h
+++ b/third_party/blink/renderer/platform/audio/hrtf_database.h
@@ -46,7 +46,7 @@
   USING_FAST_MALLOC(HRTFDatabase);
 
  public:
-  static std::unique_ptr<HRTFDatabase> Create(float sample_rate);
+  explicit HRTFDatabase(float sample_rate);
 
   // getKernelsFromAzimuthElevation() returns a left and right ear kernel, and
   // an interpolated left and right frame delay for the given azimuth and
@@ -75,8 +75,6 @@
   static const unsigned kNumberOfRawElevations;
 
  private:
-  explicit HRTFDatabase(float sample_rate);
-
   // Minimum and maximum elevation angles (inclusive) for a HRTFDatabase.
   static const int kMinElevation;
   static const int kMaxElevation;
diff --git a/third_party/blink/renderer/platform/audio/hrtf_database_loader.cc b/third_party/blink/renderer/platform/audio/hrtf_database_loader.cc
index 050cbb4..7086598 100644
--- a/third_party/blink/renderer/platform/audio/hrtf_database_loader.cc
+++ b/third_party/blink/renderer/platform/audio/hrtf_database_loader.cc
@@ -80,7 +80,7 @@
   // thread.
   MutexLocker locker(lock_);
   // Load the default HRTF database.
-  hrtf_database_ = HRTFDatabase::Create(database_sample_rate_);
+  hrtf_database_ = std::make_unique<HRTFDatabase>(database_sample_rate_);
 }
 
 void HRTFDatabaseLoader::LoadAsynchronously() {
diff --git a/third_party/blink/renderer/platform/audio/hrtf_elevation.cc b/third_party/blink/renderer/platform/audio/hrtf_elevation.cc
index 96872c5..b8fc130 100644
--- a/third_party/blink/renderer/platform/audio/hrtf_elevation.cc
+++ b/third_party/blink/renderer/platform/audio/hrtf_elevation.cc
@@ -184,10 +184,10 @@
   // Note that depending on the fftSize returned by the panner, we may be
   // truncating the impulse response we just loaded in.
   const size_t fft_size = HRTFPanner::FftSizeForSampleRate(sample_rate);
-  kernel_l =
-      HRTFKernel::Create(left_ear_impulse_response, fft_size, sample_rate);
-  kernel_r =
-      HRTFKernel::Create(right_ear_impulse_response, fft_size, sample_rate);
+  kernel_l = std::make_unique<HRTFKernel>(left_ear_impulse_response, fft_size,
+                                          sample_rate);
+  kernel_r = std::make_unique<HRTFKernel>(right_ear_impulse_response, fft_size,
+                                          sample_rate);
 
   return true;
 }
diff --git a/third_party/blink/renderer/platform/audio/hrtf_kernel.cc b/third_party/blink/renderer/platform/audio/hrtf_kernel.cc
index ab0b64d..c0e02a3 100644
--- a/third_party/blink/renderer/platform/audio/hrtf_kernel.cc
+++ b/third_party/blink/renderer/platform/audio/hrtf_kernel.cc
@@ -140,8 +140,8 @@
   std::unique_ptr<FFTFrame> interpolated_frame =
       FFTFrame::CreateInterpolatedFrame(*kernel1->FftFrame(),
                                         *kernel2->FftFrame(), x);
-  return HRTFKernel::Create(std::move(interpolated_frame), frame_delay,
-                            sample_rate1);
+  return std::make_unique<HRTFKernel>(std::move(interpolated_frame),
+                                      frame_delay, sample_rate1);
 }
 
 }  // namespace blink
diff --git a/third_party/blink/renderer/platform/audio/hrtf_kernel.h b/third_party/blink/renderer/platform/audio/hrtf_kernel.h
index b9b9bf4..093f89d 100644
--- a/third_party/blink/renderer/platform/audio/hrtf_kernel.h
+++ b/third_party/blink/renderer/platform/audio/hrtf_kernel.h
@@ -57,18 +57,13 @@
  public:
   // Note: this is destructive on the passed in AudioChannel.
   // The length of channel must be a power of two.
-  static std::unique_ptr<HRTFKernel> Create(AudioChannel* channel,
-                                            size_t fft_size,
-                                            float sample_rate) {
-    return base::WrapUnique(new HRTFKernel(channel, fft_size, sample_rate));
-  }
-
-  static std::unique_ptr<HRTFKernel> Create(std::unique_ptr<FFTFrame> fft_frame,
-                                            float frame_delay,
-                                            float sample_rate) {
-    return base::WrapUnique(
-        new HRTFKernel(std::move(fft_frame), frame_delay, sample_rate));
-  }
+  HRTFKernel(AudioChannel*, size_t fft_size, float sample_rate);
+  HRTFKernel(std::unique_ptr<FFTFrame> fft_frame,
+             float frame_delay,
+             float sample_rate)
+      : fft_frame_(std::move(fft_frame)),
+        frame_delay_(frame_delay),
+        sample_rate_(sample_rate) {}
 
   // Given two HRTFKernels, and an interpolation factor x: 0 -> 1, returns an
   // interpolated HRTFKernel.
@@ -87,16 +82,6 @@
   std::unique_ptr<AudioChannel> CreateImpulseResponse();
 
  private:
-  // Note: this is destructive on the passed in AudioChannel.
-  HRTFKernel(AudioChannel*, size_t fft_size, float sample_rate);
-
-  HRTFKernel(std::unique_ptr<FFTFrame> fft_frame,
-             float frame_delay,
-             float sample_rate)
-      : fft_frame_(std::move(fft_frame)),
-        frame_delay_(frame_delay),
-        sample_rate_(sample_rate) {}
-
   std::unique_ptr<FFTFrame> fft_frame_;
   float frame_delay_;
   float sample_rate_;
diff --git a/third_party/blink/renderer/platform/audio/stereo_panner.cc b/third_party/blink/renderer/platform/audio/stereo_panner.cc
index 9ba7245..9e619f0 100644
--- a/third_party/blink/renderer/platform/audio/stereo_panner.cc
+++ b/third_party/blink/renderer/platform/audio/stereo_panner.cc
@@ -17,10 +17,6 @@
 // Implement equal-power panning algorithm for mono or stereo input.
 // See: http://webaudio.github.io/web-audio-api/#panning-algorithm
 
-std::unique_ptr<StereoPanner> StereoPanner::Create(float sample_rate) {
-  return base::WrapUnique(new StereoPanner(sample_rate));
-}
-
 StereoPanner::StereoPanner(float sample_rate) {}
 
 void StereoPanner::PanWithSampleAccurateValues(const AudioBus* input_bus,
diff --git a/third_party/blink/renderer/platform/audio/stereo_panner.h b/third_party/blink/renderer/platform/audio/stereo_panner.h
index 96affa9..49dbdac 100644
--- a/third_party/blink/renderer/platform/audio/stereo_panner.h
+++ b/third_party/blink/renderer/platform/audio/stereo_panner.h
@@ -20,7 +20,7 @@
   USING_FAST_MALLOC(StereoPanner);
 
  public:
-  static std::unique_ptr<StereoPanner> Create(float sample_rate);
+  explicit StereoPanner(float sample_rate);
   ~StereoPanner() = default;
 
   void PanWithSampleAccurateValues(const AudioBus* input_bus,
@@ -33,8 +33,6 @@
                         uint32_t frames_to_process);
 
  private:
-  explicit StereoPanner(float sample_rate);
-
   DISALLOW_COPY_AND_ASSIGN(StereoPanner);
 };