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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 #if DEBUG_AUDIONODE_REFERENCES | 185 #if DEBUG_AUDIONODE_REFERENCES |
186 fprintf(stderr, "%p: AudioContext::AudioContext(): %u #%u\n", | 186 fprintf(stderr, "%p: AudioContext::AudioContext(): %u #%u\n", |
187 this, m_contextId, AudioContext::s_hardwareContextCount); | 187 this, m_contextId, AudioContext::s_hardwareContextCount); |
188 #endif | 188 #endif |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 void AudioContext::clear() | 192 void AudioContext::clear() |
193 { | 193 { |
194 // We need to run disposers before destructing m_contextGraphMutex. | 194 // We need to run disposers before destructing m_contextGraphMutex. |
195 m_liveAudioSummingJunctions.clear(); | |
196 m_liveNodes.clear(); | 195 m_liveNodes.clear(); |
197 m_destinationNode.clear(); | 196 m_destinationNode.clear(); |
198 m_isCleared = true; | 197 m_isCleared = true; |
199 } | 198 } |
200 | 199 |
201 void AudioContext::uninitialize() | 200 void AudioContext::uninitialize() |
202 { | 201 { |
203 ASSERT(isMainThread()); | 202 ASSERT(isMainThread()); |
204 | 203 |
205 if (!isInitialized()) | 204 if (!isInitialized()) |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 m_liveNodes.add(&node, adoptPtr(new AudioNodeDisposer(node))); | 1004 m_liveNodes.add(&node, adoptPtr(new AudioNodeDisposer(node))); |
1006 } | 1005 } |
1007 | 1006 |
1008 AudioContext::AudioNodeDisposer::~AudioNodeDisposer() | 1007 AudioContext::AudioNodeDisposer::~AudioNodeDisposer() |
1009 { | 1008 { |
1010 ASSERT(isMainThread()); | 1009 ASSERT(isMainThread()); |
1011 AudioContext::AutoLocker locker(m_node.context()); | 1010 AudioContext::AutoLocker locker(m_node.context()); |
1012 m_node.dispose(); | 1011 m_node.dispose(); |
1013 } | 1012 } |
1014 | 1013 |
1015 void AudioContext::registerLiveAudioSummingJunction(AudioSummingJunction& juncti
on) | |
1016 { | |
1017 ASSERT(isMainThread()); | |
1018 m_liveAudioSummingJunctions.add(&junction, adoptPtr(new AudioSummingJunction
Disposer(junction))); | |
1019 } | |
1020 | |
1021 AudioContext::AudioSummingJunctionDisposer::~AudioSummingJunctionDisposer() | |
1022 { | |
1023 ASSERT(isMainThread()); | |
1024 m_junction.dispose(); | |
1025 } | |
1026 | |
1027 void DeferredTaskHandler::disposeOutputs(AudioNode& node) | 1014 void DeferredTaskHandler::disposeOutputs(AudioNode& node) |
1028 { | 1015 { |
1029 ASSERT(isGraphOwner()); | 1016 ASSERT(isGraphOwner()); |
1030 ASSERT(isMainThread()); | 1017 ASSERT(isMainThread()); |
1031 for (unsigned i = 0; i < node.numberOfOutputs(); ++i) | 1018 for (unsigned i = 0; i < node.numberOfOutputs(); ++i) |
1032 node.output(i)->dispose(); | 1019 node.output(i)->dispose(); |
1033 } | 1020 } |
1034 | 1021 |
1035 void DeferredTaskHandler::markSummingJunctionDirty(AudioSummingJunction* summing
Junction) | 1022 void DeferredTaskHandler::markSummingJunctionDirty(AudioSummingJunction* summing
Junction) |
1036 { | 1023 { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 // m_contextGraphMutex might be unavailable. | 1255 // m_contextGraphMutex might be unavailable. |
1269 if (m_didInitializeContextGraphMutex) { | 1256 if (m_didInitializeContextGraphMutex) { |
1270 AutoLocker lock(this); | 1257 AutoLocker lock(this); |
1271 visitor->trace(m_referencedNodes); | 1258 visitor->trace(m_referencedNodes); |
1272 } else { | 1259 } else { |
1273 visitor->trace(m_referencedNodes); | 1260 visitor->trace(m_referencedNodes); |
1274 } | 1261 } |
1275 visitor->trace(m_resumeResolvers); | 1262 visitor->trace(m_resumeResolvers); |
1276 visitor->trace(m_suspendResolvers); | 1263 visitor->trace(m_suspendResolvers); |
1277 visitor->trace(m_liveNodes); | 1264 visitor->trace(m_liveNodes); |
1278 visitor->trace(m_liveAudioSummingJunctions); | |
1279 RefCountedGarbageCollectedEventTargetWithInlineData<AudioContext>::trace(vis
itor); | 1265 RefCountedGarbageCollectedEventTargetWithInlineData<AudioContext>::trace(vis
itor); |
1280 ActiveDOMObject::trace(visitor); | 1266 ActiveDOMObject::trace(visitor); |
1281 } | 1267 } |
1282 | 1268 |
1283 void DeferredTaskHandler::addChangedChannelCountMode(AudioNode* node) | 1269 void DeferredTaskHandler::addChangedChannelCountMode(AudioNode* node) |
1284 { | 1270 { |
1285 ASSERT(isGraphOwner()); | 1271 ASSERT(isGraphOwner()); |
1286 ASSERT(isMainThread()); | 1272 ASSERT(isMainThread()); |
1287 m_deferredCountModeChange.add(node); | 1273 m_deferredCountModeChange.add(node); |
1288 } | 1274 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 DeferredTaskHandler::AutoLocker::AutoLocker(AudioContext* context) | 1366 DeferredTaskHandler::AutoLocker::AutoLocker(AudioContext* context) |
1381 : m_handler(context->handler()) | 1367 : m_handler(context->handler()) |
1382 { | 1368 { |
1383 m_handler.lock(); | 1369 m_handler.lock(); |
1384 } | 1370 } |
1385 | 1371 |
1386 | 1372 |
1387 } // namespace blink | 1373 } // namespace blink |
1388 | 1374 |
1389 #endif // ENABLE(WEB_AUDIO) | 1375 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |