| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // The audio thread can't block on this lock, so we call tryLock() inste
ad. | 158 // The audio thread can't block on this lock, so we call tryLock() inste
ad. |
| 159 MutexTryLocker tryLocker(m_processEventLock); | 159 MutexTryLocker tryLocker(m_processEventLock); |
| 160 if (!tryLocker.locked()) { | 160 if (!tryLocker.locked()) { |
| 161 // We're late in handling the previous request. The main thread must
be very busy. | 161 // We're late in handling the previous request. The main thread must
be very busy. |
| 162 // The best we can do is clear out the buffer ourself here. | 162 // The best we can do is clear out the buffer ourself here. |
| 163 outputBuffer->zero(); | 163 outputBuffer->zero(); |
| 164 } else if (context()->getExecutionContext()) { | 164 } else if (context()->getExecutionContext()) { |
| 165 // Fire the event on the main thread with the appropriate buffer | 165 // Fire the event on the main thread with the appropriate buffer |
| 166 // index. | 166 // index. |
| 167 context()->getExecutionContext()->postTask(BLINK_FROM_HERE, | 167 context()->getExecutionContext()->postTask(BLINK_FROM_HERE, |
| 168 createCrossThreadTask(&ScriptProcessorHandler::fireProcessEvent,
AllowCrossThreadAccess(this), m_doubleBufferIndex)); | 168 createCrossThreadTask(&ScriptProcessorHandler::fireProcessEvent,
this, m_doubleBufferIndex)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 swapBuffers(); | 171 swapBuffers(); |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 | 174 |
| 175 void ScriptProcessorHandler::fireProcessEvent(unsigned doubleBufferIndex) | 175 void ScriptProcessorHandler::fireProcessEvent(unsigned doubleBufferIndex) |
| 176 { | 176 { |
| 177 ASSERT(isMainThread()); | 177 ASSERT(isMainThread()); |
| 178 | 178 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // If |onaudioprocess| event handler is defined, the node should not be | 304 // If |onaudioprocess| event handler is defined, the node should not be |
| 305 // GCed even if it is out of scope. | 305 // GCed even if it is out of scope. |
| 306 if (hasEventListeners(EventTypeNames::audioprocess)) | 306 if (hasEventListeners(EventTypeNames::audioprocess)) |
| 307 return true; | 307 return true; |
| 308 | 308 |
| 309 return false; | 309 return false; |
| 310 } | 310 } |
| 311 | 311 |
| 312 } // namespace blink | 312 } // namespace blink |
| 313 | 313 |
| OLD | NEW |