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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 bool tryLock(); | 111 bool tryLock(); |
112 void unlock(); | 112 void unlock(); |
113 | |
114 // This locks the audio render thread for OfflineAudioContext rendering. | |
115 // CANNOT be used in the real-time audio context. | |
Raymond Toy
2015/10/16 23:32:36
CANNOT -> MUST NOT.
hongchan
2015/10/19 20:08:12
Done.
| |
116 void offlineLock(); | |
117 | |
113 #if ENABLE(ASSERT) | 118 #if ENABLE(ASSERT) |
114 // Returns true if this thread owns the context's lock. | 119 // Returns true if this thread owns the context's lock. |
115 bool isGraphOwner(); | 120 bool isGraphOwner(); |
116 #endif | 121 #endif |
117 | 122 |
118 class MODULES_EXPORT AutoLocker { | 123 class MODULES_EXPORT AutoLocker { |
119 STACK_ALLOCATED(); | 124 STACK_ALLOCATED(); |
120 public: | 125 public: |
121 explicit AutoLocker(DeferredTaskHandler& handler) | 126 explicit AutoLocker(DeferredTaskHandler& handler) |
122 : m_handler(handler) | 127 : m_handler(handler) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 Vector<RefPtr<AudioHandler>> m_deletableOrphanHandlers; | 170 Vector<RefPtr<AudioHandler>> m_deletableOrphanHandlers; |
166 | 171 |
167 // Graph locking. | 172 // Graph locking. |
168 RecursiveMutex m_contextGraphMutex; | 173 RecursiveMutex m_contextGraphMutex; |
169 volatile ThreadIdentifier m_audioThread; | 174 volatile ThreadIdentifier m_audioThread; |
170 }; | 175 }; |
171 | 176 |
172 } // namespace blink | 177 } // namespace blink |
173 | 178 |
174 #endif // DeferredTaskHandler_h | 179 #endif // DeferredTaskHandler_h |
OLD | NEW |