| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 m_destinationNode->startRendering(); | 184 m_destinationNode->startRendering(); |
| 185 ++s_hardwareContextCount; | 185 ++s_hardwareContextCount; |
| 186 } | 186 } |
| 187 | 187 |
| 188 m_isInitialized = true; | 188 m_isInitialized = true; |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 void AudioContext::clear() | 192 void AudioContext::clear() |
| 193 { | 193 { |
| 194 #if ENABLE(OILPAN) |
| 195 // We need to run disposers before destructing m_contextGraphMutex. |
| 196 m_liveAudioSummingJunctions.clear(); |
| 197 #endif |
| 198 |
| 194 // We have to release our reference to the destination node before the conte
xt will ever be deleted since the destination node holds a reference to the cont
ext. | 199 // We have to release our reference to the destination node before the conte
xt will ever be deleted since the destination node holds a reference to the cont
ext. |
| 195 if (m_destinationNode) | 200 if (m_destinationNode) |
| 196 m_destinationNode.clear(); | 201 m_destinationNode.clear(); |
| 197 | 202 |
| 198 // Audio thread is dead. Nobody will schedule node deletion action. Let's do
it ourselves. | 203 // Audio thread is dead. Nobody will schedule node deletion action. Let's do
it ourselves. |
| 199 do { | 204 do { |
| 200 m_nodesToDelete.appendVector(m_nodesMarkedForDeletion); | 205 m_nodesToDelete.appendVector(m_nodesMarkedForDeletion); |
| 201 m_nodesMarkedForDeletion.clear(); | 206 m_nodesMarkedForDeletion.clear(); |
| 202 deleteMarkedNodes(); | 207 deleteMarkedNodes(); |
| 203 } while (m_nodesToDelete.size()); | 208 } while (m_nodesToDelete.size()); |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 | 754 |
| 750 for (unsigned i = 0; i < m_deferredBreakConnectionList.size(); ++i) | 755 for (unsigned i = 0; i < m_deferredBreakConnectionList.size(); ++i) |
| 751 m_deferredBreakConnectionList[i]->breakConnectionWithLock(); | 756 m_deferredBreakConnectionList[i]->breakConnectionWithLock(); |
| 752 m_deferredBreakConnectionList.clear(); | 757 m_deferredBreakConnectionList.clear(); |
| 753 | 758 |
| 754 for (unsigned i = 0; i < m_deferredFinishDerefList.size(); ++i) | 759 for (unsigned i = 0; i < m_deferredFinishDerefList.size(); ++i) |
| 755 m_deferredFinishDerefList[i]->finishDeref(); | 760 m_deferredFinishDerefList[i]->finishDeref(); |
| 756 m_deferredFinishDerefList.clear(); | 761 m_deferredFinishDerefList.clear(); |
| 757 } | 762 } |
| 758 | 763 |
| 764 #if ENABLE(OILPAN) |
| 765 void AudioContext::registerLiveAudioSummingJunction(AudioSummingJunction& juncti
on) |
| 766 { |
| 767 ASSERT(isMainThread()); |
| 768 m_liveAudioSummingJunctions.add(&junction, adoptPtr(new AudioSummingJunction
Disposer(junction))); |
| 769 } |
| 770 |
| 771 AudioContext::AudioSummingJunctionDisposer::~AudioSummingJunctionDisposer() |
| 772 { |
| 773 ASSERT(isMainThread()); |
| 774 m_junction.context()->removeMarkedSummingJunction(&m_junction); |
| 775 } |
| 776 #endif |
| 777 |
| 759 void AudioContext::markForDeletion(AudioNode* node) | 778 void AudioContext::markForDeletion(AudioNode* node) |
| 760 { | 779 { |
| 761 ASSERT(isGraphOwner()); | 780 ASSERT(isGraphOwner()); |
| 762 | 781 |
| 763 if (!isInitialized()) | 782 if (!isInitialized()) |
| 764 m_nodesToDelete.append(node); | 783 m_nodesToDelete.append(node); |
| 765 else | 784 else |
| 766 m_nodesMarkedForDeletion.append(node); | 785 m_nodesMarkedForDeletion.append(node); |
| 767 | 786 |
| 768 // This is probably the best time for us to remove the node from automatic p
ull list, | 787 // This is probably the best time for us to remove the node from automatic p
ull list, |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 // Call the offline rendering completion event listener. | 977 // Call the offline rendering completion event listener. |
| 959 dispatchEvent(OfflineAudioCompletionEvent::create(renderedBuffer)); | 978 dispatchEvent(OfflineAudioCompletionEvent::create(renderedBuffer)); |
| 960 } | 979 } |
| 961 } | 980 } |
| 962 | 981 |
| 963 void AudioContext::trace(Visitor* visitor) | 982 void AudioContext::trace(Visitor* visitor) |
| 964 { | 983 { |
| 965 visitor->trace(m_renderTarget); | 984 visitor->trace(m_renderTarget); |
| 966 visitor->trace(m_destinationNode); | 985 visitor->trace(m_destinationNode); |
| 967 visitor->trace(m_listener); | 986 visitor->trace(m_listener); |
| 987 #if ENABLE(OILPAN) |
| 988 visitor->trace(m_liveAudioSummingJunctions); |
| 989 #endif |
| 968 EventTargetWithInlineData::trace(visitor); | 990 EventTargetWithInlineData::trace(visitor); |
| 969 } | 991 } |
| 970 | 992 |
| 971 } // namespace blink | 993 } // namespace blink |
| 972 | 994 |
| 973 #endif // ENABLE(WEB_AUDIO) | 995 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |