| 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 #include "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/process.h" | 6 #include "base/process.h" |
| 7 #include "chrome/browser/renderer_host/audio_renderer_host.h" | 7 #include "chrome/browser/renderer_host/audio_renderer_host.h" |
| 8 | 8 |
| 9 AudioRendererHost::IPCAudioSource::IPCAudioSource( | 9 AudioRendererHost::IPCAudioSource::IPCAudioSource( |
| 10 AudioRendererHost* host, | 10 AudioRendererHost* host, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 185 |
| 186 void AudioRendererHost::OnInitialized() { | 186 void AudioRendererHost::OnInitialized() { |
| 187 DCHECK(MessageLoop::current() == io_loop_); | 187 DCHECK(MessageLoop::current() == io_loop_); |
| 188 | 188 |
| 189 // Increase the ref count of this object so it is active until we do | 189 // Increase the ref count of this object so it is active until we do |
| 190 // Release(). | 190 // Release(). |
| 191 AddRef(); | 191 AddRef(); |
| 192 | 192 |
| 193 // Also create the AudioManager singleton in this thread. | 193 // Also create the AudioManager singleton in this thread. |
| 194 // TODO(hclam): figure out a better location to initialize the AudioManager | 194 // TODO(hclam): figure out a better location to initialize the AudioManager |
| 195 // singleton. | 195 // singleton. The following method call seems to create a memory leak. |
| 196 AudioManager::GetAudioManager(); | 196 // AudioManager::GetAudioManager(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void AudioRendererHost::OnDestroyed() { | 199 void AudioRendererHost::OnDestroyed() { |
| 200 DCHECK(MessageLoop::current() == io_loop_); | 200 DCHECK(MessageLoop::current() == io_loop_); |
| 201 | 201 |
| 202 // Destroy audio streams only in the thread it should happen. | 202 // Destroy audio streams only in the thread it should happen. |
| 203 // TODO(hclam): make sure we don't call IPC::Message::Sender inside | 203 // TODO(hclam): make sure we don't call IPC::Message::Sender inside |
| 204 // IPCAudioSource because it is most likely be destroyed. | 204 // IPCAudioSource because it is most likely be destroyed. |
| 205 DestroyAllStreams(); | 205 DestroyAllStreams(); |
| 206 | 206 |
| 207 // Decrease the reference to this object, which may lead to self-destruction. | 207 // Decrease the reference to this object, which may lead to self-destruction. |
| 208 Release(); | 208 Release(); |
| 209 } | 209 } |
| OLD | NEW |