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 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 return false; | |
|
Raymond Toy
2017/04/07 17:11:01
Add comment why false and not true.
| |
| 73 #endif | |
| 71 } | 74 } |
| 72 #endif | |
| 73 | 75 |
| 74 void DeferredTaskHandler::addDeferredBreakConnection(AudioHandler& node) { | 76 void DeferredTaskHandler::addDeferredBreakConnection(AudioHandler& node) { |
| 75 DCHECK(isAudioThread()); | 77 DCHECK(isAudioThread()); |
| 76 m_deferredBreakConnectionList.push_back(&node); | 78 m_deferredBreakConnectionList.push_back(&node); |
| 77 } | 79 } |
| 78 | 80 |
| 79 void DeferredTaskHandler::breakConnections() { | 81 void DeferredTaskHandler::breakConnections() { |
| 80 DCHECK(isAudioThread()); | 82 DCHECK(isAudioThread()); |
| 81 ASSERT(isGraphOwner()); | 83 ASSERT(isGraphOwner()); |
| 82 | 84 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 m_deletableOrphanHandlers.clear(); | 283 m_deletableOrphanHandlers.clear(); |
| 282 } | 284 } |
| 283 | 285 |
| 284 void DeferredTaskHandler::setAudioThreadToCurrentThread() { | 286 void DeferredTaskHandler::setAudioThreadToCurrentThread() { |
| 285 DCHECK(!isMainThread()); | 287 DCHECK(!isMainThread()); |
| 286 ThreadIdentifier thread = currentThread(); | 288 ThreadIdentifier thread = currentThread(); |
| 287 releaseStore(&m_audioThread, thread); | 289 releaseStore(&m_audioThread, thread); |
| 288 } | 290 } |
| 289 | 291 |
| 290 } // namespace blink | 292 } // namespace blink |
| OLD | NEW |