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 DCHECK(isAudioThread()); | 176 DCHECK(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 DCHECK(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 DCHECK(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 |
182 DeferredTaskHandler::DeferredTaskHandler() | 228 DeferredTaskHandler::DeferredTaskHandler() |
183 : m_automaticPullNodesNeedUpdating(false) | 229 : m_automaticPullNodesNeedUpdating(false) |
184 , m_audioThread(0) | 230 , m_audioThread(0) |
185 { | 231 { |
186 } | 232 } |
187 | 233 |
188 PassRefPtr<DeferredTaskHandler> DeferredTaskHandler::create() | 234 PassRefPtr<DeferredTaskHandler> DeferredTaskHandler::create() |
189 { | 235 { |
190 return adoptRef(new DeferredTaskHandler()); | 236 return adoptRef(new DeferredTaskHandler()); |
191 } | 237 } |
192 | 238 |
193 DeferredTaskHandler::~DeferredTaskHandler() | 239 DeferredTaskHandler::~DeferredTaskHandler() |
194 { | 240 { |
195 DCHECK(!m_automaticPullNodes.size()); | 241 DCHECK(!m_automaticPullNodes.size()); |
196 if (m_automaticPullNodesNeedUpdating) | 242 if (m_automaticPullNodesNeedUpdating) |
197 m_renderingAutomaticPullNodes.resize(m_automaticPullNodes.size()); | 243 m_renderingAutomaticPullNodes.resize(m_automaticPullNodes.size()); |
198 DCHECK(!m_renderingAutomaticPullNodes.size()); | 244 DCHECK(!m_renderingAutomaticPullNodes.size()); |
199 } | 245 } |
200 | 246 |
201 void DeferredTaskHandler::handleDeferredTasks() | 247 void DeferredTaskHandler::handleDeferredTasks() |
202 { | 248 { |
| 249 updateChangedChannelCountMode(); |
| 250 updateChangedChannelInterpretation(); |
203 handleDirtyAudioSummingJunctions(); | 251 handleDirtyAudioSummingJunctions(); |
204 handleDirtyAudioNodeOutputs(); | 252 handleDirtyAudioNodeOutputs(); |
205 updateAutomaticPullNodes(); | 253 updateAutomaticPullNodes(); |
206 } | 254 } |
207 | 255 |
208 void DeferredTaskHandler::contextWillBeDestroyed() | 256 void DeferredTaskHandler::contextWillBeDestroyed() |
209 { | 257 { |
210 for (auto& handler : m_renderingOrphanHandlers) | 258 for (auto& handler : m_renderingOrphanHandlers) |
211 handler->clearContext(); | 259 handler->clearContext(); |
212 for (auto& handler : m_deletableOrphanHandlers) | 260 for (auto& handler : m_deletableOrphanHandlers) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 310 |
263 void DeferredTaskHandler::setAudioThreadToCurrentThread() | 311 void DeferredTaskHandler::setAudioThreadToCurrentThread() |
264 { | 312 { |
265 DCHECK(!isMainThread()); | 313 DCHECK(!isMainThread()); |
266 ThreadIdentifier thread = currentThread(); | 314 ThreadIdentifier thread = currentThread(); |
267 releaseStore(&m_audioThread, thread); | 315 releaseStore(&m_audioThread, thread); |
268 } | 316 } |
269 | 317 |
270 } // namespace blink | 318 } // namespace blink |
271 | 319 |
OLD | NEW |