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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // This could be a problem if the main thread is very busy doing other t
hings and is being held up handling previous requests. | 222 // This could be a problem if the main thread is very busy doing other t
hings and is being held up handling previous requests. |
223 // The audio thread can't block on this lock, so we call tryLock() inste
ad. | 223 // The audio thread can't block on this lock, so we call tryLock() inste
ad. |
224 MutexTryLocker tryLocker(m_processEventLock); | 224 MutexTryLocker tryLocker(m_processEventLock); |
225 if (!tryLocker.locked()) { | 225 if (!tryLocker.locked()) { |
226 // We're late in handling the previous request. The main thread must
be very busy. | 226 // We're late in handling the previous request. The main thread must
be very busy. |
227 // The best we can do is clear out the buffer ourself here. | 227 // The best we can do is clear out the buffer ourself here. |
228 outputBuffer->zero(); | 228 outputBuffer->zero(); |
229 } else if (context()->executionContext()) { | 229 } else if (context()->executionContext()) { |
230 // Fire the event on the main thread, not this one (which is the rea
ltime audio thread). | 230 // Fire the event on the main thread, not this one (which is the rea
ltime audio thread). |
231 m_doubleBufferIndexForEvent = m_doubleBufferIndex; | 231 m_doubleBufferIndexForEvent = m_doubleBufferIndex; |
232 context()->executionContext()->postTask(FROM_HERE, createCrossThread
Task(&ScriptProcessorNode::fireProcessEvent, this)); | 232 context()->executionContext()->postTask(createCrossThreadTask(&Scrip
tProcessorNode::fireProcessEvent, this)); |
233 } | 233 } |
234 | 234 |
235 swapBuffers(); | 235 swapBuffers(); |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 void ScriptProcessorNode::fireProcessEvent() | 239 void ScriptProcessorNode::fireProcessEvent() |
240 { | 240 { |
241 ASSERT(isMainThread()); | 241 ASSERT(isMainThread()); |
242 | 242 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 DEFINE_TRACE(ScriptProcessorNode) | 302 DEFINE_TRACE(ScriptProcessorNode) |
303 { | 303 { |
304 visitor->trace(m_inputBuffers); | 304 visitor->trace(m_inputBuffers); |
305 visitor->trace(m_outputBuffers); | 305 visitor->trace(m_outputBuffers); |
306 AudioNode::trace(visitor); | 306 AudioNode::trace(visitor); |
307 } | 307 } |
308 | 308 |
309 } // namespace blink | 309 } // namespace blink |
310 | 310 |
311 #endif // ENABLE(WEB_AUDIO) | 311 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |