Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.cpp

Issue 2014343002: Defer changes to channelInterpretation to pre/post rendering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 m_deferredCountModeChange.add(node); 186 m_deferredCountModeChange.add(node);
187 } 187 }
188 188
189 void DeferredTaskHandler::removeChangedChannelCountMode(AudioHandler* node) 189 void DeferredTaskHandler::removeChangedChannelCountMode(AudioHandler* node)
190 { 190 {
191 ASSERT(isGraphOwner()); 191 ASSERT(isGraphOwner());
192 192
193 m_deferredCountModeChange.remove(node); 193 m_deferredCountModeChange.remove(node);
194 } 194 }
195 195
196 void DeferredTaskHandler::addChangedChannelInterpretation(AudioHandler* node)
197 {
198 DCHECK(isGraphOwner());
199 DCHECK(isMainThread());
200 m_deferredChannelInterpretationChange.add(node);
201 }
202
203 void DeferredTaskHandler::removeChangedChannelInterpretation(AudioHandler* node)
204 {
205 DCHECK(isGraphOwner());
206
207 m_deferredChannelInterpretationChange.remove(node);
208 }
209
196 void DeferredTaskHandler::updateChangedChannelCountMode() 210 void DeferredTaskHandler::updateChangedChannelCountMode()
197 { 211 {
198 ASSERT(isGraphOwner()); 212 ASSERT(isGraphOwner());
199 213
200 for (AudioHandler* node : m_deferredCountModeChange) 214 for (AudioHandler* node : m_deferredCountModeChange)
201 node->updateChannelCountMode(); 215 node->updateChannelCountMode();
202 m_deferredCountModeChange.clear(); 216 m_deferredCountModeChange.clear();
203 } 217 }
204 218
219 void DeferredTaskHandler::updateChangedChannelInterpretation()
220 {
221 DCHECK(isGraphOwner());
222
223 for (AudioHandler* node : m_deferredChannelInterpretationChange)
224 node->updateChannelInterpretation();
225 m_deferredChannelInterpretationChange.clear();
226 }
227
205 DeferredTaskHandler::DeferredTaskHandler() 228 DeferredTaskHandler::DeferredTaskHandler()
206 : m_automaticPullNodesNeedUpdating(false) 229 : m_automaticPullNodesNeedUpdating(false)
207 , m_audioThread(0) 230 , m_audioThread(0)
208 { 231 {
209 } 232 }
210 233
211 PassRefPtr<DeferredTaskHandler> DeferredTaskHandler::create() 234 PassRefPtr<DeferredTaskHandler> DeferredTaskHandler::create()
212 { 235 {
213 return adoptRef(new DeferredTaskHandler()); 236 return adoptRef(new DeferredTaskHandler());
214 } 237 }
215 238
216 DeferredTaskHandler::~DeferredTaskHandler() 239 DeferredTaskHandler::~DeferredTaskHandler()
217 { 240 {
218 ASSERT(!m_automaticPullNodes.size()); 241 ASSERT(!m_automaticPullNodes.size());
219 if (m_automaticPullNodesNeedUpdating) 242 if (m_automaticPullNodesNeedUpdating)
220 m_renderingAutomaticPullNodes.resize(m_automaticPullNodes.size()); 243 m_renderingAutomaticPullNodes.resize(m_automaticPullNodes.size());
221 ASSERT(!m_renderingAutomaticPullNodes.size()); 244 ASSERT(!m_renderingAutomaticPullNodes.size());
222 } 245 }
223 246
224 void DeferredTaskHandler::handleDeferredTasks() 247 void DeferredTaskHandler::handleDeferredTasks()
225 { 248 {
226 updateChangedChannelCountMode(); 249 updateChangedChannelCountMode();
250 updateChangedChannelInterpretation();
227 handleDirtyAudioSummingJunctions(); 251 handleDirtyAudioSummingJunctions();
228 handleDirtyAudioNodeOutputs(); 252 handleDirtyAudioNodeOutputs();
229 updateAutomaticPullNodes(); 253 updateAutomaticPullNodes();
230 } 254 }
231 255
232 void DeferredTaskHandler::contextWillBeDestroyed() 256 void DeferredTaskHandler::contextWillBeDestroyed()
233 { 257 {
234 for (auto& handler : m_renderingOrphanHandlers) 258 for (auto& handler : m_renderingOrphanHandlers)
235 handler->clearContext(); 259 handler->clearContext();
236 for (auto& handler : m_deletableOrphanHandlers) 260 for (auto& handler : m_deletableOrphanHandlers)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 310
287 void DeferredTaskHandler::setAudioThreadToCurrentThread() 311 void DeferredTaskHandler::setAudioThreadToCurrentThread()
288 { 312 {
289 ASSERT(!isMainThread()); 313 ASSERT(!isMainThread());
290 ThreadIdentifier thread = currentThread(); 314 ThreadIdentifier thread = currentThread();
291 releaseStore(&m_audioThread, thread); 315 releaseStore(&m_audioThread, thread);
292 } 316 }
293 317
294 } // namespace blink 318 } // namespace blink
295 319
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698