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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 172 } |
173 | 173 |
174 void DeferredTaskHandler::processAutomaticPullNodes(size_t framesToProcess) | 174 void DeferredTaskHandler::processAutomaticPullNodes(size_t framesToProcess) |
175 { | 175 { |
176 ASSERT(isAudioThread()); | 176 ASSERT(isAudioThread()); |
177 | 177 |
178 for (unsigned i = 0; i < m_renderingAutomaticPullNodes.size(); ++i) | 178 for (unsigned i = 0; i < m_renderingAutomaticPullNodes.size(); ++i) |
179 m_renderingAutomaticPullNodes[i]->processIfNecessary(framesToProcess); | 179 m_renderingAutomaticPullNodes[i]->processIfNecessary(framesToProcess); |
180 } | 180 } |
181 | 181 |
182 void DeferredTaskHandler::addChangedChannelCountMode(AudioHandler* node) | |
183 { | |
184 ASSERT(isGraphOwner()); | |
185 ASSERT(isMainThread()); | |
186 m_deferredCountModeChange.add(node); | |
187 } | |
188 | |
189 void DeferredTaskHandler::removeChangedChannelCountMode(AudioHandler* node) | |
190 { | |
191 ASSERT(isGraphOwner()); | |
192 | |
193 m_deferredCountModeChange.remove(node); | |
194 } | |
195 | |
196 void DeferredTaskHandler::addChangedChannelInterpretation(AudioHandler* node) | |
197 { | |
198 ASSERT(isGraphOwner()); | |
199 ASSERT(isMainThread()); | |
200 m_deferredChannelInterpretationChange.add(node); | |
201 } | |
202 | |
203 void DeferredTaskHandler::removeChangedChannelInterpretation(AudioHandler* node) | |
204 { | |
205 ASSERT(isGraphOwner()); | |
206 | |
207 m_deferredChannelInterpretationChange.remove(node); | |
208 } | |
209 | |
210 void DeferredTaskHandler::updateChangedChannelCountMode() | |
211 { | |
212 ASSERT(isGraphOwner()); | |
213 | |
214 for (AudioHandler* node : m_deferredCountModeChange) | |
215 node->updateChannelCountMode(); | |
216 m_deferredCountModeChange.clear(); | |
217 } | |
218 | |
219 void DeferredTaskHandler::updateChangedChannelInterpretation() | |
220 { | |
221 ASSERT(isGraphOwner()); | |
222 | |
223 for (AudioHandler* node : m_deferredChannelInterpretationChange) | |
224 node->updateChannelInterpretation(); | |
225 m_deferredChannelInterpretationChange.clear(); | |
226 } | |
227 | |
228 DeferredTaskHandler::DeferredTaskHandler() | 182 DeferredTaskHandler::DeferredTaskHandler() |
229 : m_automaticPullNodesNeedUpdating(false) | 183 : m_automaticPullNodesNeedUpdating(false) |
230 , m_audioThread(0) | 184 , m_audioThread(0) |
231 { | 185 { |
232 } | 186 } |
233 | 187 |
234 PassRefPtr<DeferredTaskHandler> DeferredTaskHandler::create() | 188 PassRefPtr<DeferredTaskHandler> DeferredTaskHandler::create() |
235 { | 189 { |
236 return adoptRef(new DeferredTaskHandler()); | 190 return adoptRef(new DeferredTaskHandler()); |
237 } | 191 } |
238 | 192 |
239 DeferredTaskHandler::~DeferredTaskHandler() | 193 DeferredTaskHandler::~DeferredTaskHandler() |
240 { | 194 { |
241 ASSERT(!m_automaticPullNodes.size()); | 195 ASSERT(!m_automaticPullNodes.size()); |
242 if (m_automaticPullNodesNeedUpdating) | 196 if (m_automaticPullNodesNeedUpdating) |
243 m_renderingAutomaticPullNodes.resize(m_automaticPullNodes.size()); | 197 m_renderingAutomaticPullNodes.resize(m_automaticPullNodes.size()); |
244 ASSERT(!m_renderingAutomaticPullNodes.size()); | 198 ASSERT(!m_renderingAutomaticPullNodes.size()); |
245 } | 199 } |
246 | 200 |
247 void DeferredTaskHandler::handleDeferredTasks() | 201 void DeferredTaskHandler::handleDeferredTasks() |
248 { | 202 { |
249 updateChangedChannelCountMode(); | |
250 updateChangedChannelInterpretation(); | |
251 handleDirtyAudioSummingJunctions(); | 203 handleDirtyAudioSummingJunctions(); |
252 handleDirtyAudioNodeOutputs(); | 204 handleDirtyAudioNodeOutputs(); |
253 updateAutomaticPullNodes(); | 205 updateAutomaticPullNodes(); |
254 } | 206 } |
255 | 207 |
256 void DeferredTaskHandler::contextWillBeDestroyed() | 208 void DeferredTaskHandler::contextWillBeDestroyed() |
257 { | 209 { |
258 for (auto& handler : m_renderingOrphanHandlers) | 210 for (auto& handler : m_renderingOrphanHandlers) |
259 handler->clearContext(); | 211 handler->clearContext(); |
260 for (auto& handler : m_deletableOrphanHandlers) | 212 for (auto& handler : m_deletableOrphanHandlers) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 262 |
311 void DeferredTaskHandler::setAudioThreadToCurrentThread() | 263 void DeferredTaskHandler::setAudioThreadToCurrentThread() |
312 { | 264 { |
313 ASSERT(!isMainThread()); | 265 ASSERT(!isMainThread()); |
314 ThreadIdentifier thread = currentThread(); | 266 ThreadIdentifier thread = currentThread(); |
315 releaseStore(&m_audioThread, thread); | 267 releaseStore(&m_audioThread, thread); |
316 } | 268 } |
317 | 269 |
318 } // namespace blink | 270 } // namespace blink |
319 | 271 |
OLD | NEW |