| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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. It maps | 6 // lives inside the render process and provide access to audio hardware. It maps |
| 7 // an internal ID to AudioRendererHost::IPCAudioSource in a map, which is the | 7 // an internal ID to AudioRendererHost::IPCAudioSource in a map, which is the |
| 8 // actual object providing audio packets through IPC. It creates the actual | 8 // actual object providing audio packets through IPC. It creates the actual |
| 9 // AudioOutputStream object when requested by the renderer and returns an | 9 // AudioOutputStream object when requested by the renderer and returns an |
| 10 // internal ID. It then delegates calls to the AudioOutputStream object indexed | 10 // internal ID. It then delegates calls to the AudioOutputStream object indexed |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // streams are also created in the IO thread, so we need to destroy them also | 25 // streams are also created in the IO thread, so we need to destroy them also |
| 26 // in IO thread. After this class is created, a task of OnInitialized() is | 26 // in IO thread. After this class is created, a task of OnInitialized() is |
| 27 // posted on IO thread in which singleton of AudioManager is created and | 27 // posted on IO thread in which singleton of AudioManager is created and |
| 28 // AddRef() is called to increase one ref count of this object. Owner of this | 28 // AddRef() is called to increase one ref count of this object. Owner of this |
| 29 // class should call Destroy() before decrementing the ref count to this object, | 29 // class should call Destroy() before decrementing the ref count to this object, |
| 30 // which essentially post a task of OnDestroyed() on IO thread. Inside | 30 // which essentially post a task of OnDestroyed() on IO thread. Inside |
| 31 // OnDestroyed(), audio output streams are destroyed and Release() is called | 31 // OnDestroyed(), audio output streams are destroyed and Release() is called |
| 32 // which may result in self-destruction. | 32 // which may result in self-destruction. |
| 33 // | 33 // |
| 34 // TODO(hclam): Have these things done before having real implementations: | 34 // TODO(hclam): Have these things done before having real implementations: |
| 35 // 1. Make sure this class has greater or equal lifetime to | 35 // 1. Make AudioManager a singleton and construct/destruct it properly. |
| 36 // 2. Make sure this class has greater or equal lifetime to |
| 36 // IPC:Message::Sender, essentially ResourceMessageFilter. | 37 // IPC:Message::Sender, essentially ResourceMessageFilter. |
| 37 // 2. Listen to destruction event of the browser and do cleanup in case this | 38 // 3. Listen to destruction event of the browser and do cleanup in case this |
| 38 // class is not destructed nicely during browser close. | 39 // class is not destructed nicely during browser close. |
| 39 | 40 |
| 40 #ifndef CHROME_BROWSER_RENDERER_HOST_AUDIO_RENDERER_HOST_H_ | 41 #ifndef CHROME_BROWSER_RENDERER_HOST_AUDIO_RENDERER_HOST_H_ |
| 41 #define CHROME_BROWSER_RENDERER_HOST_AUDIO_RENDERER_HOST_H_ | 42 #define CHROME_BROWSER_RENDERER_HOST_AUDIO_RENDERER_HOST_H_ |
| 42 | 43 |
| 43 #include "base/id_map.h" | 44 #include "base/id_map.h" |
| 44 #include "base/ref_counted.h" | 45 #include "base/ref_counted.h" |
| 45 #include "base/shared_memory.h" | 46 #include "base/shared_memory.h" |
| 46 #include "chrome/common/ipc_message.h" | 47 #include "chrome/common/ipc_message.h" |
| 47 #include "media/audio/audio_output.h" | 48 #include "media/audio/audio_output.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 int32 next_id_; | 154 int32 next_id_; |
| 154 | 155 |
| 155 // Only used for DCHECKs to make sure all methods calls are from the same | 156 // Only used for DCHECKs to make sure all methods calls are from the same |
| 156 // thread as this object is created. | 157 // thread as this object is created. |
| 157 MessageLoop* io_loop_; | 158 MessageLoop* io_loop_; |
| 158 | 159 |
| 159 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 160 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
| 160 }; | 161 }; |
| 161 | 162 |
| 162 #endif // CHROME_BROWSER_RENDERER_HOST_AUDIO_RENDERER_HOST_H_ | 163 #endif // CHROME_BROWSER_RENDERER_HOST_AUDIO_RENDERER_HOST_H_ |
| OLD | NEW |