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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 void addDeferredBreakConnection(AudioHandler&); | 92 void addDeferredBreakConnection(AudioHandler&); |
93 void breakConnections(); | 93 void breakConnections(); |
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 setAudioThread(ThreadIdentifier thread) { releaseStore(&m_audioThread,
thread); } // FIXME: check either not initialized or the same | 102 void setAudioThreadToCurrentThread(); |
103 ThreadIdentifier audioThread() const { return acquireLoad(&m_audioThread); } | 103 ThreadIdentifier audioThread() const { return acquireLoad(&m_audioThread); } |
104 | 104 |
105 // TODO(hongchan): Use no-barrier load here. (crbug.com/247328) | 105 // TODO(hongchan): Use no-barrier load here. (crbug.com/247328) |
106 // | 106 // |
107 // It is okay to use a relaxed (no-barrier) load here. Because the data | 107 // 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 | 108 // 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. | 109 // need a barrier between the load of m_audioThread and of that data. |
110 bool isAudioThread() const { return currentThread() == acquireLoad(&m_audioT
hread); } | 110 bool isAudioThread() const { return currentThread() == acquireLoad(&m_audioT
hread); } |
111 | 111 |
112 void lock(); | 112 void lock(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 Vector<RefPtr<AudioHandler>> m_deletableOrphanHandlers; | 187 Vector<RefPtr<AudioHandler>> m_deletableOrphanHandlers; |
188 | 188 |
189 // Graph locking. | 189 // Graph locking. |
190 RecursiveMutex m_contextGraphMutex; | 190 RecursiveMutex m_contextGraphMutex; |
191 volatile ThreadIdentifier m_audioThread; | 191 volatile ThreadIdentifier m_audioThread; |
192 }; | 192 }; |
193 | 193 |
194 } // namespace blink | 194 } // namespace blink |
195 | 195 |
196 #endif // DeferredTaskHandler_h | 196 #endif // DeferredTaskHandler_h |
OLD | NEW |