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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 } | 659 } |
660 | 660 |
661 void BaseAudioContext::removeFinishedSourceNodesOnMainThread() { | 661 void BaseAudioContext::removeFinishedSourceNodesOnMainThread() { |
662 DCHECK(isMainThread()); | 662 DCHECK(isMainThread()); |
663 AutoLocker locker(this); | 663 AutoLocker locker(this); |
664 // Quadratic worst case, but sizes of both vectors are considered | 664 // Quadratic worst case, but sizes of both vectors are considered |
665 // manageable, especially |m_finishedSourceNodes| is likely to be short. | 665 // manageable, especially |m_finishedSourceNodes| is likely to be short. |
666 for (AudioNode* node : m_finishedSourceNodes) { | 666 for (AudioNode* node : m_finishedSourceNodes) { |
667 size_t i = m_activeSourceNodes.find(node); | 667 size_t i = m_activeSourceNodes.find(node); |
668 if (i != kNotFound) | 668 if (i != kNotFound) |
669 m_activeSourceNodes.remove(i); | 669 m_activeSourceNodes.erase(i); |
670 } | 670 } |
671 m_finishedSourceNodes.clear(); | 671 m_finishedSourceNodes.clear(); |
672 } | 672 } |
673 | 673 |
674 bool BaseAudioContext::releaseFinishedSourceNodes() { | 674 bool BaseAudioContext::releaseFinishedSourceNodes() { |
675 ASSERT(isGraphOwner()); | 675 ASSERT(isGraphOwner()); |
676 DCHECK(isAudioThread()); | 676 DCHECK(isAudioThread()); |
677 bool didRemove = false; | 677 bool didRemove = false; |
678 for (AudioHandler* handler : m_finishedSourceHandlers) { | 678 for (AudioHandler* handler : m_finishedSourceHandlers) { |
679 for (AudioNode* node : m_activeSourceNodes) { | 679 for (AudioNode* node : m_activeSourceNodes) { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 } | 918 } |
919 | 919 |
920 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const { | 920 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const { |
921 if (getExecutionContext()) | 921 if (getExecutionContext()) |
922 return getExecutionContext()->getSecurityOrigin(); | 922 return getExecutionContext()->getSecurityOrigin(); |
923 | 923 |
924 return nullptr; | 924 return nullptr; |
925 } | 925 } |
926 | 926 |
927 } // namespace blink | 927 } // namespace blink |
OLD | NEW |