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

Unified Diff: media/audio/audio_manager_base.h

Issue 9255017: Add thread safety to AudioManagerBase to protect access to the audio thread member variable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix style issue Created 8 years, 11 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 | « media/audio/audio_manager.h ('k') | media/audio/audio_manager_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_manager_base.h
diff --git a/media/audio/audio_manager_base.h b/media/audio/audio_manager_base.h
index 15e18bed38979fda69a4d5d48bf8571450d2d258..7a7eee2d42fa0273d26e275658bd90b70ec44d26 100644
--- a/media/audio/audio_manager_base.h
+++ b/media/audio/audio_manager_base.h
@@ -9,11 +9,16 @@
#include "base/atomic_ref_count.h"
#include "base/compiler_specific.h"
-#include "base/threading/thread.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/lock.h"
#include "media/audio/audio_manager.h"
class AudioOutputDispatcher;
+namespace base {
+class Thread;
+}
+
// AudioManagerBase provides AudioManager functions common for all platforms.
class MEDIA_EXPORT AudioManagerBase : public AudioManager {
public:
@@ -34,7 +39,7 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
virtual void Init() OVERRIDE;
- virtual MessageLoop* GetMessageLoop() OVERRIDE;
+ virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE;
virtual string16 GetAudioInputDeviceModel() OVERRIDE;
@@ -66,12 +71,13 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
void ShutdownOnAudioThread();
- bool initialized() { return audio_thread_.IsRunning(); }
-
// Thread used to interact with AudioOutputStreams created by this
// audio manger.
- base::Thread audio_thread_;
+ scoped_ptr<base::Thread> audio_thread_;
+ mutable base::Lock audio_thread_lock_;
+ // Map of cached AudioOutputDispatcher instances. Must only be touched
+ // from the audio thread (no locking).
AudioOutputDispatchersMap output_dispatchers_;
// Counts the number of active input streams to find out if something else
« no previous file with comments | « media/audio/audio_manager.h ('k') | media/audio/audio_manager_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698