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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 void DeferredTaskHandler::lock() | 38 void DeferredTaskHandler::lock() |
39 { | 39 { |
40 // Don't allow regular lock in real-time audio thread. | 40 // Don't allow regular lock in real-time audio thread. |
41 ASSERT(isMainThread()); | 41 ASSERT(isMainThread()); |
42 m_contextGraphMutex.lock(); | 42 m_contextGraphMutex.lock(); |
43 } | 43 } |
44 | 44 |
| 45 void DeferredTaskHandler::forceLock() |
| 46 { |
| 47 // This allows the regular lock in offline audio rendering. It is okay to |
| 48 // lock the offline audio render thread because it is not real-time thread. |
| 49 ASSERT(!isMainThread()); |
| 50 m_contextGraphMutex.lock(); |
| 51 } |
| 52 |
45 bool DeferredTaskHandler::tryLock() | 53 bool DeferredTaskHandler::tryLock() |
46 { | 54 { |
47 // Try to catch cases of using try lock on main thread | 55 // Try to catch cases of using try lock on main thread |
48 // - it should use regular lock. | 56 // - it should use regular lock. |
49 ASSERT(isAudioThread()); | 57 ASSERT(isAudioThread()); |
50 if (!isAudioThread()) { | 58 if (!isAudioThread()) { |
51 // In release build treat tryLock() as lock() (since above | 59 // In release build treat tryLock() as lock() (since above |
52 // ASSERT(isAudioThread) never fires) - this is the best we can do. | 60 // ASSERT(isAudioThread) never fires) - this is the best we can do. |
53 lock(); | 61 lock(); |
54 return true; | 62 return true; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 { | 275 { |
268 ASSERT(isMainThread()); | 276 ASSERT(isMainThread()); |
269 AutoLocker locker(*this); | 277 AutoLocker locker(*this); |
270 m_renderingOrphanHandlers.clear(); | 278 m_renderingOrphanHandlers.clear(); |
271 m_deletableOrphanHandlers.clear(); | 279 m_deletableOrphanHandlers.clear(); |
272 } | 280 } |
273 | 281 |
274 } // namespace blink | 282 } // namespace blink |
275 | 283 |
276 #endif // ENABLE(WEB_AUDIO) | 284 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |