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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // This could be a problem if the main thread is very busy doing other t
hings and is being held up handling previous requests. | 161 // This could be a problem if the main thread is very busy doing other t
hings and is being held up handling previous requests. |
162 // The audio thread can't block on this lock, so we call tryLock() inste
ad. | 162 // The audio thread can't block on this lock, so we call tryLock() inste
ad. |
163 MutexTryLocker tryLocker(m_processEventLock); | 163 MutexTryLocker tryLocker(m_processEventLock); |
164 if (!tryLocker.locked()) { | 164 if (!tryLocker.locked()) { |
165 // We're late in handling the previous request. The main thread must
be very busy. | 165 // We're late in handling the previous request. The main thread must
be very busy. |
166 // The best we can do is clear out the buffer ourself here. | 166 // The best we can do is clear out the buffer ourself here. |
167 outputBuffer->zero(); | 167 outputBuffer->zero(); |
168 } else if (context()->executionContext()) { | 168 } else if (context()->executionContext()) { |
169 // Fire the event on the main thread, not this one (which is the rea
ltime audio thread). | 169 // Fire the event on the main thread, not this one (which is the rea
ltime audio thread). |
170 m_doubleBufferIndexForEvent = m_doubleBufferIndex; | 170 m_doubleBufferIndexForEvent = m_doubleBufferIndex; |
171 context()->executionContext()->postTask(FROM_HERE, createCrossThread
Task(&ScriptProcessorHandler::fireProcessEvent, PassRefPtr<ScriptProcessorHandle
r>(this))); | 171 context()->executionContext()->postTask(BLINK_FROM_HERE, createCross
ThreadTask(&ScriptProcessorHandler::fireProcessEvent, PassRefPtr<ScriptProcessor
Handler>(this))); |
172 } | 172 } |
173 | 173 |
174 swapBuffers(); | 174 swapBuffers(); |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 void ScriptProcessorHandler::fireProcessEvent() | 178 void ScriptProcessorHandler::fireProcessEvent() |
179 { | 179 { |
180 ASSERT(isMainThread()); | 180 ASSERT(isMainThread()); |
181 | 181 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 294 } |
295 | 295 |
296 size_t ScriptProcessorNode::bufferSize() const | 296 size_t ScriptProcessorNode::bufferSize() const |
297 { | 297 { |
298 return static_cast<ScriptProcessorHandler&>(handler()).bufferSize(); | 298 return static_cast<ScriptProcessorHandler&>(handler()).bufferSize(); |
299 } | 299 } |
300 | 300 |
301 } // namespace blink | 301 } // namespace blink |
302 | 302 |
303 #endif // ENABLE(WEB_AUDIO) | 303 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |