OLD | NEW |
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 // AudioRendererHost serves audio related requests from AudioRenderer which | 5 // AudioRendererHost serves audio related requests from AudioRenderer which |
6 // lives inside the render process and provide access to audio hardware. | 6 // lives inside the render process and provide access to audio hardware. |
7 // | 7 // |
8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI | 8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI |
9 // thread, but all other operations and method calls happen on IO thread, so we | 9 // thread, but all other operations and method calls happen on IO thread, so we |
10 // need to be extra careful about the lifetime of this object. AudioManager is a | 10 // need to be extra careful about the lifetime of this object. AudioManager is a |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // ownership of the reader. | 82 // ownership of the reader. |
83 scoped_ptr<media::AudioOutputController::SyncReader> reader; | 83 scoped_ptr<media::AudioOutputController::SyncReader> reader; |
84 | 84 |
85 // Set to true after we called Close() for the controller. | 85 // Set to true after we called Close() for the controller. |
86 bool pending_close; | 86 bool pending_close; |
87 }; | 87 }; |
88 | 88 |
89 typedef std::map<int, AudioEntry*> AudioEntryMap; | 89 typedef std::map<int, AudioEntry*> AudioEntryMap; |
90 | 90 |
91 // Called from UI thread from the owner of this object. | 91 // Called from UI thread from the owner of this object. |
92 AudioRendererHost(const content::ResourceContext* resource_context); | 92 AudioRendererHost(content::ResourceContext* resource_context); |
93 | 93 |
94 // content::BrowserMessageFilter implementation. | 94 // content::BrowserMessageFilter implementation. |
95 virtual void OnChannelClosing() OVERRIDE; | 95 virtual void OnChannelClosing() OVERRIDE; |
96 virtual void OnDestruct() const OVERRIDE; | 96 virtual void OnDestruct() const OVERRIDE; |
97 virtual bool OnMessageReceived(const IPC::Message& message, | 97 virtual bool OnMessageReceived(const IPC::Message& message, |
98 bool* message_was_ok) OVERRIDE; | 98 bool* message_was_ok) OVERRIDE; |
99 | 99 |
100 // AudioOutputController::EventHandler implementations. | 100 // AudioOutputController::EventHandler implementations. |
101 virtual void OnCreated(media::AudioOutputController* controller) OVERRIDE; | 101 virtual void OnCreated(media::AudioOutputController* controller) OVERRIDE; |
102 virtual void OnPlaying(media::AudioOutputController* controller) OVERRIDE; | 102 virtual void OnPlaying(media::AudioOutputController* controller) OVERRIDE; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 // Return resource_context_->media_observer() or a cached copy thereof. | 180 // Return resource_context_->media_observer() or a cached copy thereof. |
181 // This is necessary because resource_context_ can be destructed before all | 181 // This is necessary because resource_context_ can be destructed before all |
182 // AudioEntries have been deleted. The MediaObserver's lifetime is tied to | 182 // AudioEntries have been deleted. The MediaObserver's lifetime is tied to |
183 // that of the IO thread, so this is safe. | 183 // that of the IO thread, so this is safe. |
184 MediaObserver* media_observer(); | 184 MediaObserver* media_observer(); |
185 | 185 |
186 // A map of stream IDs to audio sources. | 186 // A map of stream IDs to audio sources. |
187 AudioEntryMap audio_entries_; | 187 AudioEntryMap audio_entries_; |
188 | 188 |
189 const content::ResourceContext* resource_context_; | 189 content::ResourceContext* resource_context_; |
190 MediaObserver* media_observer_; | 190 MediaObserver* media_observer_; |
191 | 191 |
192 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 192 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
193 }; | 193 }; |
194 | 194 |
195 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 195 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
OLD | NEW |