| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 DCHECK(isMainThread()); | 281 DCHECK(isMainThread()); |
| 282 DCHECK(audioData); | 282 DCHECK(audioData); |
| 283 | 283 |
| 284 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 284 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
| 285 ScriptPromise promise = resolver->promise(); | 285 ScriptPromise promise = resolver->promise(); |
| 286 | 286 |
| 287 float rate = isContextClosed() ? closedContextSampleRate() : sampleRate(); | 287 float rate = isContextClosed() ? closedContextSampleRate() : sampleRate(); |
| 288 | 288 |
| 289 DCHECK_GT(rate, 0); | 289 DCHECK_GT(rate, 0); |
| 290 | 290 |
| 291 m_decodeAudioResolvers.add(resolver); | 291 m_decodeAudioResolvers.insert(resolver); |
| 292 m_audioDecoder.decodeAsync(audioData, rate, successCallback, errorCallback, | 292 m_audioDecoder.decodeAsync(audioData, rate, successCallback, errorCallback, |
| 293 resolver, this); | 293 resolver, this); |
| 294 | 294 |
| 295 return promise; | 295 return promise; |
| 296 } | 296 } |
| 297 | 297 |
| 298 void BaseAudioContext::handleDecodeAudioData( | 298 void BaseAudioContext::handleDecodeAudioData( |
| 299 AudioBuffer* audioBuffer, | 299 AudioBuffer* audioBuffer, |
| 300 ScriptPromiseResolver* resolver, | 300 ScriptPromiseResolver* resolver, |
| 301 AudioBufferCallback* successCallback, | 301 AudioBufferCallback* successCallback, |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 bool BaseAudioContext::releaseFinishedSourceNodes() { | 661 bool BaseAudioContext::releaseFinishedSourceNodes() { |
| 662 ASSERT(isGraphOwner()); | 662 ASSERT(isGraphOwner()); |
| 663 DCHECK(isAudioThread()); | 663 DCHECK(isAudioThread()); |
| 664 bool didRemove = false; | 664 bool didRemove = false; |
| 665 for (AudioHandler* handler : m_finishedSourceHandlers) { | 665 for (AudioHandler* handler : m_finishedSourceHandlers) { |
| 666 for (AudioNode* node : m_activeSourceNodes) { | 666 for (AudioNode* node : m_activeSourceNodes) { |
| 667 if (m_finishedSourceNodes.contains(node)) | 667 if (m_finishedSourceNodes.contains(node)) |
| 668 continue; | 668 continue; |
| 669 if (handler == &node->handler()) { | 669 if (handler == &node->handler()) { |
| 670 handler->breakConnection(); | 670 handler->breakConnection(); |
| 671 m_finishedSourceNodes.add(node); | 671 m_finishedSourceNodes.insert(node); |
| 672 didRemove = true; | 672 didRemove = true; |
| 673 break; | 673 break; |
| 674 } | 674 } |
| 675 } | 675 } |
| 676 } | 676 } |
| 677 m_finishedSourceHandlers.clear(); | 677 m_finishedSourceHandlers.clear(); |
| 678 return didRemove; | 678 return didRemove; |
| 679 } | 679 } |
| 680 | 680 |
| 681 void BaseAudioContext::notifySourceNodeStartedProcessing(AudioNode* node) { | 681 void BaseAudioContext::notifySourceNodeStartedProcessing(AudioNode* node) { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 } | 902 } |
| 903 | 903 |
| 904 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const { | 904 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const { |
| 905 if (getExecutionContext()) | 905 if (getExecutionContext()) |
| 906 return getExecutionContext()->getSecurityOrigin(); | 906 return getExecutionContext()->getSecurityOrigin(); |
| 907 | 907 |
| 908 return nullptr; | 908 return nullptr; |
| 909 } | 909 } |
| 910 | 910 |
| 911 } // namespace blink | 911 } // namespace blink |
| OLD | NEW |