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