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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 ThreadIdentifier audioThread() const { return acquireLoad(&m_audioThread); } | 101 ThreadIdentifier audioThread() const { return acquireLoad(&m_audioThread); } |
| 102 | 102 |
| 103 // TODO(hongchan): Use no-barrier load here. (crbug.com/247328) | 103 // TODO(hongchan): Use no-barrier load here. (crbug.com/247328) |
| 104 // | 104 // |
| 105 // It is okay to use a relaxed (no-barrier) load here. Because the data | 105 // It is okay to use a relaxed (no-barrier) load here. Because the data |
| 106 // referenced by m_audioThread is not actually being used, thus we do not | 106 // referenced by m_audioThread is not actually being used, thus we do not |
| 107 // need a barrier between the load of m_audioThread and of that data. | 107 // need a barrier between the load of m_audioThread and of that data. |
| 108 bool isAudioThread() const { return currentThread() == acquireLoad(&m_audioT hread); } | 108 bool isAudioThread() const { return currentThread() == acquireLoad(&m_audioT hread); } |
| 109 | 109 |
| 110 void lock(); | 110 void lock(); |
| 111 | |
| 112 // This allows the regular lock in offline audio rendering. It is okay to | |
| 113 // lock the offline audio render thread because it is not real-time thread. | |
|
Raymond Toy
2015/07/17 15:44:03
Nit: Add comment this must only be used for offlin
hongchan
2015/07/17 15:51:17
Done.
| |
| 114 void offlineContextLock(); | |
| 115 | |
| 111 bool tryLock(); | 116 bool tryLock(); |
| 112 void unlock(); | 117 void unlock(); |
| 118 | |
| 113 #if ENABLE(ASSERT) | 119 #if ENABLE(ASSERT) |
| 114 // Returns true if this thread owns the context's lock. | 120 // Returns true if this thread owns the context's lock. |
| 115 bool isGraphOwner(); | 121 bool isGraphOwner(); |
| 116 #endif | 122 #endif |
| 117 | 123 |
| 118 class MODULES_EXPORT AutoLocker { | 124 class MODULES_EXPORT AutoLocker { |
| 119 STACK_ALLOCATED(); | 125 STACK_ALLOCATED(); |
| 120 public: | 126 public: |
| 121 explicit AutoLocker(DeferredTaskHandler& handler) | 127 explicit AutoLocker(DeferredTaskHandler& handler) |
| 122 : m_handler(handler) | 128 : m_handler(handler) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 Vector<RefPtr<AudioHandler>> m_deletableOrphanHandlers; | 171 Vector<RefPtr<AudioHandler>> m_deletableOrphanHandlers; |
| 166 | 172 |
| 167 // Graph locking. | 173 // Graph locking. |
| 168 RecursiveMutex m_contextGraphMutex; | 174 RecursiveMutex m_contextGraphMutex; |
| 169 volatile ThreadIdentifier m_audioThread; | 175 volatile ThreadIdentifier m_audioThread; |
| 170 }; | 176 }; |
| 171 | 177 |
| 172 } // namespace blink | 178 } // namespace blink |
| 173 | 179 |
| 174 #endif // DeferredTaskHandler_h | 180 #endif // DeferredTaskHandler_h |
| OLD | NEW |