| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 void DeferredTaskHandler::offlineLock() { | 58 void DeferredTaskHandler::offlineLock() { |
| 59 // CHECK is here to make sure to explicitly crash if this is called from | 59 // CHECK is here to make sure to explicitly crash if this is called from |
| 60 // other than the offline render thread, which is considered as the audio | 60 // other than the offline render thread, which is considered as the audio |
| 61 // thread in OfflineAudioContext. | 61 // thread in OfflineAudioContext. |
| 62 CHECK(isAudioThread()) << "DeferredTaskHandler::offlineLock() must be called " | 62 CHECK(isAudioThread()) << "DeferredTaskHandler::offlineLock() must be called " |
| 63 "within the offline audio thread."; | 63 "within the offline audio thread."; |
| 64 | 64 |
| 65 m_contextGraphMutex.lock(); | 65 m_contextGraphMutex.lock(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool DeferredTaskHandler::isGraphOwner() { |
| 68 #if DCHECK_IS_ON() | 69 #if DCHECK_IS_ON() |
| 69 bool DeferredTaskHandler::isGraphOwner() { | |
| 70 return m_contextGraphMutex.locked(); | 70 return m_contextGraphMutex.locked(); |
| 71 #else |
| 72 // The method is only used inside of DCHECK() so it must be no-op in the |
| 73 // release build. Returning false so we can catch when it happens. |
| 74 return false; |
| 75 #endif |
| 71 } | 76 } |
| 72 #endif | |
| 73 | 77 |
| 74 void DeferredTaskHandler::addDeferredBreakConnection(AudioHandler& node) { | 78 void DeferredTaskHandler::addDeferredBreakConnection(AudioHandler& node) { |
| 75 DCHECK(isAudioThread()); | 79 DCHECK(isAudioThread()); |
| 76 m_deferredBreakConnectionList.push_back(&node); | 80 m_deferredBreakConnectionList.push_back(&node); |
| 77 } | 81 } |
| 78 | 82 |
| 79 void DeferredTaskHandler::breakConnections() { | 83 void DeferredTaskHandler::breakConnections() { |
| 80 DCHECK(isAudioThread()); | 84 DCHECK(isAudioThread()); |
| 81 ASSERT(isGraphOwner()); | 85 ASSERT(isGraphOwner()); |
| 82 | 86 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 m_deletableOrphanHandlers.clear(); | 285 m_deletableOrphanHandlers.clear(); |
| 282 } | 286 } |
| 283 | 287 |
| 284 void DeferredTaskHandler::setAudioThreadToCurrentThread() { | 288 void DeferredTaskHandler::setAudioThreadToCurrentThread() { |
| 285 DCHECK(!isMainThread()); | 289 DCHECK(!isMainThread()); |
| 286 ThreadIdentifier thread = currentThread(); | 290 ThreadIdentifier thread = currentThread(); |
| 287 releaseStore(&m_audioThread, thread); | 291 releaseStore(&m_audioThread, thread); |
| 288 } | 292 } |
| 289 | 293 |
| 290 } // namespace blink | 294 } // namespace blink |
| OLD | NEW |