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

Unified Diff: media/audio/alsa/alsa_output.h

Issue 2076423004: Remove calls to MessageLoop::current() in media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | media/audio/alsa/alsa_output.cc » ('j') | media/audio/audio_device_thread.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/alsa/alsa_output.h
diff --git a/media/audio/alsa/alsa_output.h b/media/audio/alsa/alsa_output.h
index 0a7b861b3e218b161cc5c97225e12e864b990b25..c6ac9465c0b897cbdb94b2e8e921c0bd9e108bd8 100644
--- a/media/audio/alsa/alsa_output.h
+++ b/media/audio/alsa/alsa_output.h
@@ -31,14 +31,11 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "base/time/time.h"
#include "media/audio/audio_io.h"
#include "media/base/audio_parameters.h"
-namespace base {
-class MessageLoop;
-}
-
namespace media {
class AlsaWrapper;
@@ -46,7 +43,8 @@ class AudioManagerBase;
class ChannelMixer;
class SeekableBuffer;
-class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream {
+class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream,
+ public base::NonThreadSafe {
public:
// String for the generic "default" ALSA device that has the highest
// compatibility and chance of working.
@@ -66,7 +64,7 @@ class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream {
// |device_name|. The AlsaPcmOutputStream uses |wrapper| to communicate with
// the alsa libraries, allowing for dependency injection during testing. All
// requesting of data, and writing to the alsa device will be done on
- // |message_loop|.
+ // |task_runner|.
//
// If unsure of what to use for |device_name|, use |kAutoSelectDevice|.
AlsaPcmOutputStream(const std::string& device_name,
@@ -144,10 +142,6 @@ class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream {
InternalState TransitionTo(InternalState to);
InternalState state();
- // Returns true when we're on the audio thread or if the audio thread's
- // message loop is NULL (which will happen during shutdown).
- bool IsOnAudioThread() const;
-
// API for Proxying calls to the AudioSourceCallback provided during
// Start().
//
@@ -191,11 +185,8 @@ class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream {
// Audio manager that created us. Used to report that we've been closed.
AudioManagerBase* manager_;
- // Message loop to use for polling. The object is owned by the AudioManager.
- // We hold a reference to the audio thread message loop since
- // AudioManagerBase::ShutDown() can invalidate the message loop pointer
- // before the stream gets deleted.
- base::MessageLoop* message_loop_;
+ // Task runner to use for polling.
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
// Handle to the actual PCM playback device.
snd_pcm_t* playback_handle_;
« no previous file with comments | « no previous file | media/audio/alsa/alsa_output.cc » ('j') | media/audio/audio_device_thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698