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

Unified Diff: media/audio/audio_output_resampler.cc

Issue 2570923002: Makes AudioOutputDispatcher non-ref-counted. (Closed)
Patch Set: Created 4 years 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: media/audio/audio_output_resampler.cc
diff --git a/media/audio/audio_output_resampler.cc b/media/audio/audio_output_resampler.cc
index e81af4a6a40d9f63d1da04c8bf1089319b67ea7d..33a4ccd960e1c157f5bea0a3cfd1eae60fafbb7a 100644
--- a/media/audio/audio_output_resampler.cc
+++ b/media/audio/audio_output_resampler.cc
@@ -13,6 +13,7 @@
#include "base/bind_helpers.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "base/numerics/safe_conversions.h"
@@ -255,7 +256,6 @@ void AudioOutputResampler::Reinitialize() {
// Log a trace event so we can get feedback in the field when this happens.
TRACE_EVENT0("audio", "AudioOutputResampler::Reinitialize");
- dispatcher_->Shutdown();
output_params_ = original_output_params_;
streams_opened_ = false;
Initialize();
@@ -264,7 +264,7 @@ void AudioOutputResampler::Reinitialize() {
void AudioOutputResampler::Initialize() {
DCHECK(!streams_opened_);
DCHECK(callbacks_.empty());
- dispatcher_ = new AudioOutputDispatcherImpl(
+ dispatcher_ = base::MakeUnique<AudioOutputDispatcherImpl>(
audio_manager_, output_params_, device_id_, close_delay_);
}
@@ -391,17 +391,6 @@ void AudioOutputResampler::CloseStream(AudioOutputProxy* stream_proxy) {
}
}
-void AudioOutputResampler::Shutdown() {
- DCHECK(task_runner_->BelongsToCurrentThread());
-
- // No AudioOutputProxy objects should hold a reference to us when we get
- // to this stage.
- DCHECK(HasOneRef()) << "Only the AudioManager should hold a reference";
-
- dispatcher_->Shutdown();
- DCHECK(callbacks_.empty());
-}
-
OnMoreDataConverter::OnMoreDataConverter(const AudioParameters& input_params,
const AudioParameters& output_params)
: io_ratio_(static_cast<double>(input_params.GetBytesPerSecond()) /
« media/audio/audio_output_dispatcher_impl.cc ('K') | « media/audio/audio_output_resampler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698