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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 void addRenderingOrphanHandler(PassRefPtr<AudioHandler>); | 95 void addRenderingOrphanHandler(PassRefPtr<AudioHandler>); |
96 void requestToDeleteHandlersOnMainThread(); | 96 void requestToDeleteHandlersOnMainThread(); |
97 void clearHandlersToBeDeleted(); | 97 void clearHandlersToBeDeleted(); |
98 | 98 |
99 // | 99 // |
100 // Thread Safety and Graph Locking: | 100 // Thread Safety and Graph Locking: |
101 // | 101 // |
102 void setAudioThreadToCurrentThread(); | 102 void setAudioThreadToCurrentThread(); |
103 ThreadIdentifier audioThread() const { return acquireLoad(&m_audioThread); } | 103 ThreadIdentifier audioThread() const { return acquireLoad(&m_audioThread); } |
| 104 void clearAudioThread(); |
104 | 105 |
105 // TODO(hongchan): Use no-barrier load here. (crbug.com/247328) | 106 // TODO(hongchan): Use no-barrier load here. (crbug.com/247328) |
106 // | 107 // |
107 // It is okay to use a relaxed (no-barrier) load here. Because the data | 108 // It is okay to use a relaxed (no-barrier) load here. Because the data |
108 // referenced by m_audioThread is not actually being used, thus we do not | 109 // referenced by m_audioThread is not actually being used, thus we do not |
109 // need a barrier between the load of m_audioThread and of that data. | 110 // need a barrier between the load of m_audioThread and of that data. |
110 bool isAudioThread() const { return currentThread() == acquireLoad(&m_audioT
hread); } | 111 bool isAudioThread() const { return currentThread() == acquireLoad(&m_audioT
hread); } |
111 | 112 |
112 void lock(); | 113 void lock(); |
113 bool tryLock(); | 114 bool tryLock(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 Vector<RefPtr<AudioHandler>> m_deletableOrphanHandlers; | 188 Vector<RefPtr<AudioHandler>> m_deletableOrphanHandlers; |
188 | 189 |
189 // Graph locking. | 190 // Graph locking. |
190 RecursiveMutex m_contextGraphMutex; | 191 RecursiveMutex m_contextGraphMutex; |
191 volatile ThreadIdentifier m_audioThread; | 192 volatile ThreadIdentifier m_audioThread; |
192 }; | 193 }; |
193 | 194 |
194 } // namespace blink | 195 } // namespace blink |
195 | 196 |
196 #endif // DeferredTaskHandler_h | 197 #endif // DeferredTaskHandler_h |
OLD | NEW |