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 must be used only for OfflineAudioContext. It allows the regular |
| 113 // lock (instead of tryLock) in offline audio rendering and it is okay to |
| 114 // lock the offline audio render thread because it is not real-time thread. |
| 115 void offlineContextLock(); |
| 116 |
111 bool tryLock(); | 117 bool tryLock(); |
112 void unlock(); | 118 void unlock(); |
| 119 |
113 #if ENABLE(ASSERT) | 120 #if ENABLE(ASSERT) |
114 // Returns true if this thread owns the context's lock. | 121 // Returns true if this thread owns the context's lock. |
115 bool isGraphOwner(); | 122 bool isGraphOwner(); |
116 #endif | 123 #endif |
117 | 124 |
118 class MODULES_EXPORT AutoLocker { | 125 class MODULES_EXPORT AutoLocker { |
119 STACK_ALLOCATED(); | 126 STACK_ALLOCATED(); |
120 public: | 127 public: |
121 explicit AutoLocker(DeferredTaskHandler& handler) | 128 explicit AutoLocker(DeferredTaskHandler& handler) |
122 : m_handler(handler) | 129 : m_handler(handler) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 Vector<RefPtr<AudioHandler>> m_deletableOrphanHandlers; | 172 Vector<RefPtr<AudioHandler>> m_deletableOrphanHandlers; |
166 | 173 |
167 // Graph locking. | 174 // Graph locking. |
168 RecursiveMutex m_contextGraphMutex; | 175 RecursiveMutex m_contextGraphMutex; |
169 volatile ThreadIdentifier m_audioThread; | 176 volatile ThreadIdentifier m_audioThread; |
170 }; | 177 }; |
171 | 178 |
172 } // namespace blink | 179 } // namespace blink |
173 | 180 |
174 #endif // DeferredTaskHandler_h | 181 #endif // DeferredTaskHandler_h |
OLD | NEW |