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

Unified Diff: content/renderer/media/audio_device.h

Issue 9121045: Switch AudioDevice classes from SyncSocket to CancelableSyncSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments, add temporary ScopedAllowIO for the audio thread cleanup+TODO for next cl. 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
Index: content/renderer/media/audio_device.h
diff --git a/content/renderer/media/audio_device.h b/content/renderer/media/audio_device.h
index 9585ff0d282ac71dcce63ed7dbc62aa8d50d0546..de6ba3b0e2df9da6bd6a11b4fe5c44c5bee67b56 100644
--- a/content/renderer/media/audio_device.h
+++ b/content/renderer/media/audio_device.h
@@ -142,33 +142,6 @@ class CONTENT_EXPORT AudioDevice
virtual void OnVolume(double volume) OVERRIDE;
private:
- // Encapsulate socket into separate class to avoid double-close.
- // Class is ref-counted to avoid potential race condition if audio device
- // is deleted simultaneously with audio thread stopping.
- class AudioSocket : public base::RefCountedThreadSafe<AudioSocket> {
- public:
- explicit AudioSocket(base::SyncSocket::Handle socket_handle)
- : socket_(socket_handle) {
- }
- base::SyncSocket* socket() {
- return &socket_;
- }
- void Close() {
- // Close() should be thread-safe, obtain the lock.
- base::AutoLock auto_lock(lock_);
- socket_.Close();
- }
-
- private:
- // Magic required by ref_counted.h to avoid any code deleting the object
- // accidentally while there are references to it.
- friend class base::RefCountedThreadSafe<AudioSocket>;
- ~AudioSocket() { }
-
- base::Lock lock_;
- base::SyncSocket socket_;
- };
-
// Magic required by ref_counted.h to avoid any code deleting the object
// accidentally while there are references to it.
friend class base::RefCountedThreadSafe<AudioDevice>;
@@ -248,7 +221,7 @@ class CONTENT_EXPORT AudioDevice
// These variables must only be set on the IO thread while the audio_thread_
// is not running.
base::SharedMemoryHandle shared_memory_handle_;
- scoped_refptr<AudioSocket> audio_socket_;
+ scoped_ptr<base::CancelableSyncSocket> audio_socket_;
int memory_length_;
DISALLOW_COPY_AND_ASSIGN(AudioDevice);

Powered by Google App Engine
This is Rietveld 408576698