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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 wrapPersistent(this))); | 623 wrapPersistent(this))); |
624 } | 624 } |
625 | 625 |
626 void BaseAudioContext::notifyStateChange() { | 626 void BaseAudioContext::notifyStateChange() { |
627 dispatchEvent(Event::create(EventTypeNames::statechange)); | 627 dispatchEvent(Event::create(EventTypeNames::statechange)); |
628 } | 628 } |
629 | 629 |
630 void BaseAudioContext::notifySourceNodeFinishedProcessing( | 630 void BaseAudioContext::notifySourceNodeFinishedProcessing( |
631 AudioHandler* handler) { | 631 AudioHandler* handler) { |
632 DCHECK(isAudioThread()); | 632 DCHECK(isAudioThread()); |
633 m_finishedSourceHandlers.append(handler); | 633 m_finishedSourceHandlers.push_back(handler); |
634 } | 634 } |
635 | 635 |
636 void BaseAudioContext::removeFinishedSourceNodes() { | 636 void BaseAudioContext::removeFinishedSourceNodes() { |
637 DCHECK(isMainThread()); | 637 DCHECK(isMainThread()); |
638 AutoLocker locker(this); | 638 AutoLocker locker(this); |
639 // Quadratic worst case, but sizes of both vectors are considered | 639 // Quadratic worst case, but sizes of both vectors are considered |
640 // manageable, especially |m_finishedSourceNodes| is likely to be short. | 640 // manageable, especially |m_finishedSourceNodes| is likely to be short. |
641 for (AudioNode* node : m_finishedSourceNodes) { | 641 for (AudioNode* node : m_finishedSourceNodes) { |
642 size_t i = m_activeSourceNodes.find(node); | 642 size_t i = m_activeSourceNodes.find(node); |
643 if (i != kNotFound) | 643 if (i != kNotFound) |
(...skipping 24 matching lines...) Expand all Loading... |
668 crossThreadBind(&BaseAudioContext::removeFinishedSourceNodes, | 668 crossThreadBind(&BaseAudioContext::removeFinishedSourceNodes, |
669 wrapCrossThreadPersistent(this))); | 669 wrapCrossThreadPersistent(this))); |
670 | 670 |
671 m_finishedSourceHandlers.clear(); | 671 m_finishedSourceHandlers.clear(); |
672 } | 672 } |
673 | 673 |
674 void BaseAudioContext::notifySourceNodeStartedProcessing(AudioNode* node) { | 674 void BaseAudioContext::notifySourceNodeStartedProcessing(AudioNode* node) { |
675 DCHECK(isMainThread()); | 675 DCHECK(isMainThread()); |
676 AutoLocker locker(this); | 676 AutoLocker locker(this); |
677 | 677 |
678 m_activeSourceNodes.append(node); | 678 m_activeSourceNodes.push_back(node); |
679 node->handler().makeConnection(); | 679 node->handler().makeConnection(); |
680 } | 680 } |
681 | 681 |
682 void BaseAudioContext::releaseActiveSourceNodes() { | 682 void BaseAudioContext::releaseActiveSourceNodes() { |
683 DCHECK(isMainThread()); | 683 DCHECK(isMainThread()); |
684 for (auto& sourceNode : m_activeSourceNodes) | 684 for (auto& sourceNode : m_activeSourceNodes) |
685 sourceNode->handler().breakConnection(); | 685 sourceNode->handler().breakConnection(); |
686 | 686 |
687 m_activeSourceNodes.clear(); | 687 m_activeSourceNodes.clear(); |
688 } | 688 } |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 } | 892 } |
893 | 893 |
894 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const { | 894 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const { |
895 if (getExecutionContext()) | 895 if (getExecutionContext()) |
896 return getExecutionContext()->getSecurityOrigin(); | 896 return getExecutionContext()->getSecurityOrigin(); |
897 | 897 |
898 return nullptr; | 898 return nullptr; |
899 } | 899 } |
900 | 900 |
901 } // namespace blink | 901 } // namespace blink |
OLD | NEW |