Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 if (m_destinationNode) { | 168 if (m_destinationNode) { |
| 169 m_destinationNode->handler().initialize(); | 169 m_destinationNode->handler().initialize(); |
| 170 // The AudioParams in the listener need access to the destination node, so only create the | 170 // The AudioParams in the listener need access to the destination node, so only create the |
| 171 // listener if the destination node exists. | 171 // listener if the destination node exists. |
| 172 m_listener = AudioListener::create(*this); | 172 m_listener = AudioListener::create(*this); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 void BaseAudioContext::clear() | 176 void BaseAudioContext::clear() |
| 177 { | 177 { |
| 178 printf("BaseAudioContext::clear\n"); | |
| 178 m_destinationNode.clear(); | 179 m_destinationNode.clear(); |
| 179 // The audio rendering thread is dead. Nobody will schedule AudioHandler | 180 // The audio rendering thread is dead. Nobody will schedule AudioHandler |
| 180 // deletion. Let's do it ourselves. | 181 // deletion. Let's do it ourselves. |
| 181 deferredTaskHandler().clearHandlersToBeDeleted(); | 182 deferredTaskHandler().clearHandlersToBeDeleted(); |
| 182 m_isCleared = true; | 183 m_isCleared = true; |
| 183 } | 184 } |
| 184 | 185 |
| 185 void BaseAudioContext::uninitialize() | 186 void BaseAudioContext::uninitialize() |
| 186 { | 187 { |
| 188 printf("BaseAudioContext::uninitialize\n"); | |
| 187 DCHECK(isMainThread()); | 189 DCHECK(isMainThread()); |
| 188 | 190 |
| 189 if (!isDestinationInitialized()) | 191 if (!isDestinationInitialized()) |
| 190 return; | 192 return; |
| 191 | 193 |
| 192 // This stops the audio thread and all audio rendering. | 194 // This stops the audio thread and all audio rendering. |
| 193 if (m_destinationNode) | 195 if (m_destinationNode) |
| 194 m_destinationNode->handler().uninitialize(); | 196 m_destinationNode->handler().uninitialize(); |
| 195 | 197 |
| 196 // Get rid of the sources which may still be playing. | 198 // Get rid of the sources which may still be playing. |
| 197 releaseActiveSourceNodes(); | 199 releaseActiveSourceNodes(); |
| 198 | 200 |
| 199 // Reject any pending resolvers before we go away. | 201 // Reject any pending resolvers before we go away. |
| 200 rejectPendingResolvers(); | 202 rejectPendingResolvers(); |
| 201 didClose(); | 203 didClose(); |
| 202 | 204 |
| 203 DCHECK(m_listener); | 205 DCHECK(m_listener); |
| 204 m_listener->waitForHRTFDatabaseLoaderThreadCompletion(); | 206 m_listener->waitForHRTFDatabaseLoaderThreadCompletion(); |
| 205 | 207 |
| 206 clear(); | 208 clear(); |
| 207 } | 209 } |
| 208 | 210 |
| 209 void BaseAudioContext::stop() | 211 void BaseAudioContext::stop() |
| 210 { | 212 { |
| 213 printf("BaseAudioContext::stop\n"); | |
| 211 uninitialize(); | 214 uninitialize(); |
| 212 } | 215 } |
| 213 | 216 |
| 214 bool BaseAudioContext::hasPendingActivity() const | 217 bool BaseAudioContext::hasPendingActivity() const |
| 215 { | 218 { |
| 219 printf("BaseAudioContext::hasPendingActivity\n"); | |
| 216 // There's no pending activity if the audio context has been cleared. | 220 // There's no pending activity if the audio context has been cleared. |
| 217 return !m_isCleared; | 221 return !m_isCleared; |
|
Raymond Toy
2016/09/02 18:19:21
This is different from PS1, where you were returni
| |
| 218 } | 222 } |
| 219 | 223 |
| 220 AudioDestinationNode* BaseAudioContext::destination() const | 224 AudioDestinationNode* BaseAudioContext::destination() const |
| 221 { | 225 { |
| 222 // Cannot be called from the audio thread because this method touches object s managed by Oilpan, | 226 // Cannot be called from the audio thread because this method touches object s managed by Oilpan, |
| 223 // and the audio thread is not managed by Oilpan. | 227 // and the audio thread is not managed by Oilpan. |
| 224 DCHECK(!isAudioThread()); | 228 DCHECK(!isAudioThread()); |
| 225 return m_destinationNode; | 229 return m_destinationNode; |
| 226 } | 230 } |
| 227 | 231 |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 831 | 835 |
| 832 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const | 836 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const |
| 833 { | 837 { |
| 834 if (getExecutionContext()) | 838 if (getExecutionContext()) |
| 835 return getExecutionContext()->getSecurityOrigin(); | 839 return getExecutionContext()->getSecurityOrigin(); |
| 836 | 840 |
| 837 return nullptr; | 841 return nullptr; |
| 838 } | 842 } |
| 839 | 843 |
| 840 } // namespace blink | 844 } // namespace blink |
| OLD | NEW |