Chromium Code Reviews| 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 non-real-time audio thread. | |
|
Raymond Toy
2015/06/16 17:57:09
I think this can only be used with an online conte
hongchan
2015/06/16 21:31:21
No. This lock is only for offline audio context. M
Raymond Toy
2015/06/16 21:46:38
Typo on my part. I meant offline. I think since i
| |
| 48 ASSERT(!isMainThread()); | |
| 49 if (isMainThread()) { | |
|
Raymond Toy
2015/06/16 17:57:09
This is confusing. You ASSERT that it's not the m
hongchan
2015/06/16 21:31:20
I though we discussed this: for debug build, the a
Raymond Toy
2015/06/16 21:46:38
As we discussed offline, this is ok. But now I wo
| |
| 50 // If this gets called in the main thread, do tryLock() instead. | |
| 51 m_contextGraphMutex.tryLock(); | |
| 52 return; | |
| 53 } | |
| 54 | |
| 55 m_contextGraphMutex.lock(); | |
| 56 } | |
| 57 | |
| 45 bool DeferredTaskHandler::tryLock() | 58 bool DeferredTaskHandler::tryLock() |
| 46 { | 59 { |
| 47 // Try to catch cases of using try lock on main thread | 60 // Try to catch cases of using try lock on main thread |
| 48 // - it should use regular lock. | 61 // - it should use regular lock. |
| 49 ASSERT(isAudioThread()); | 62 ASSERT(isAudioThread()); |
| 50 if (!isAudioThread()) { | 63 if (!isAudioThread()) { |
| 51 // In release build treat tryLock() as lock() (since above | 64 // In release build treat tryLock() as lock() (since above |
| 52 // ASSERT(isAudioThread) never fires) - this is the best we can do. | 65 // ASSERT(isAudioThread) never fires) - this is the best we can do. |
| 53 lock(); | 66 lock(); |
| 54 return true; | 67 return true; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 { | 280 { |
| 268 ASSERT(isMainThread()); | 281 ASSERT(isMainThread()); |
| 269 AutoLocker locker(*this); | 282 AutoLocker locker(*this); |
| 270 m_renderingOrphanHandlers.clear(); | 283 m_renderingOrphanHandlers.clear(); |
| 271 m_deletableOrphanHandlers.clear(); | 284 m_deletableOrphanHandlers.clear(); |
| 272 } | 285 } |
| 273 | 286 |
| 274 } // namespace blink | 287 } // namespace blink |
| 275 | 288 |
| 276 #endif // ENABLE(WEB_AUDIO) | 289 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |