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

Side by Side Diff: media/audio/audio_output_dispatcher.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/audio/audio_output_controller.cc ('k') | media/audio/audio_output_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // AudioOutputDispatcher is a single-threaded class that dispatches creation and 5 // AudioOutputDispatcher is a single-threaded class that dispatches creation and
6 // deletion of audio output streams. AudioOutputProxy objects use this class to 6 // deletion of audio output streams. AudioOutputProxy objects use this class to
7 // allocate and recycle actual audio output streams. When playback is started, 7 // allocate and recycle actual audio output streams. When playback is started,
8 // the proxy calls StreamStarted() to get an output stream that it uses to play 8 // the proxy calls StreamStarted() to get an output stream that it uses to play
9 // audio. When playback is stopped, the proxy returns the stream back to the 9 // audio. When playback is stopped, the proxy returns the stream back to the
10 // dispatcher by calling StreamStopped(). 10 // dispatcher by calling StreamStopped().
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // added to the pool of pending streams (i.e. |idle_streams_|). 62 // added to the pool of pending streams (i.e. |idle_streams_|).
63 // Ownership of the |stream| is passed to the dispatcher. 63 // Ownership of the |stream| is passed to the dispatcher.
64 void StreamStopped(AudioOutputStream* stream); 64 void StreamStopped(AudioOutputStream* stream);
65 65
66 // Called by AudioOutputProxy when the stream is closed. 66 // Called by AudioOutputProxy when the stream is closed.
67 void StreamClosed(); 67 void StreamClosed();
68 68
69 // Called on the audio thread when the AudioManager is shutting down. 69 // Called on the audio thread when the AudioManager is shutting down.
70 void Shutdown(); 70 void Shutdown();
71 71
72 MessageLoop* message_loop();
73
74 private: 72 private:
75 friend class AudioOutputProxyTest; 73 friend class AudioOutputProxyTest;
76 74
77 // Creates a new physical output stream, opens it and pushes to 75 // Creates a new physical output stream, opens it and pushes to
78 // |idle_streams_|. Returns false if the stream couldn't be created or 76 // |idle_streams_|. Returns false if the stream couldn't be created or
79 // opened. 77 // opened.
80 bool CreateAndOpenStream(); 78 bool CreateAndOpenStream();
81 79
82 // A task scheduled by StreamStarted(). Opens a new stream and puts 80 // A task scheduled by StreamStarted(). Opens a new stream and puts
83 // it in |idle_streams_|. 81 // it in |idle_streams_|.
(...skipping 19 matching lines...) Expand all
103 AudioOutputStreamList pausing_streams_; 101 AudioOutputStreamList pausing_streams_;
104 102
105 // Used to post delayed tasks to ourselves that we cancel inside Shutdown(). 103 // Used to post delayed tasks to ourselves that we cancel inside Shutdown().
106 base::WeakPtrFactory<AudioOutputDispatcher> weak_this_; 104 base::WeakPtrFactory<AudioOutputDispatcher> weak_this_;
107 base::DelayTimer<AudioOutputDispatcher> close_timer_; 105 base::DelayTimer<AudioOutputDispatcher> close_timer_;
108 106
109 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); 107 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher);
110 }; 108 };
111 109
112 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ 110 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « media/audio/audio_output_controller.cc ('k') | media/audio/audio_output_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698