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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h

Issue 2638413004: Don't run removeFinishedSourceNodes with the context lock. (Closed)
Patch Set: Add removeFinishedSourceNodesOnMainThread Created 3 years, 11 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // When a source node has no more processing to do (has finished playing), 242 // When a source node has no more processing to do (has finished playing),
243 // this method tells the context to release the corresponding node. 243 // this method tells the context to release the corresponding node.
244 void notifySourceNodeFinishedProcessing(AudioHandler*); 244 void notifySourceNodeFinishedProcessing(AudioHandler*);
245 245
246 // Called at the start of each render quantum. 246 // Called at the start of each render quantum.
247 void handlePreRenderTasks(const AudioIOPosition& outputPosition); 247 void handlePreRenderTasks(const AudioIOPosition& outputPosition);
248 248
249 // Called at the end of each render quantum. 249 // Called at the end of each render quantum.
250 void handlePostRenderTasks(); 250 void handlePostRenderTasks();
251 251
252 // Called periodically at the end of each render quantum to release finished 252 // Called periodically at the end of each render quantum to release
253 // source nodes. 253 // finished source nodes. Updates m_finishedSourceNodes with nodes
254 void releaseFinishedSourceNodes(); 254 // to be deleted. Returns true if any node needs deletion. Must be
255 // run from the audio thread.
256 bool releaseFinishedSourceNodes();
257
258 // The finished source nodes found by |releaseFinishedSourceNodes|
259 // will be removed on the main thread, which is done here.
260 void removeFinishedSourceNodes(bool needsRemoval);
255 261
256 // Keeps track of the number of connections made. 262 // Keeps track of the number of connections made.
257 void incrementConnectionCount() { 263 void incrementConnectionCount() {
258 DCHECK(isMainThread()); 264 DCHECK(isMainThread());
259 m_connectionCount++; 265 m_connectionCount++;
260 } 266 }
261 267
262 unsigned connectionCount() const { return m_connectionCount; } 268 unsigned connectionCount() const { return m_connectionCount; }
263 269
264 DeferredTaskHandler& deferredTaskHandler() const { 270 DeferredTaskHandler& deferredTaskHandler() const {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 AutoplayStatusCount 378 AutoplayStatusCount
373 }; 379 };
374 380
375 bool m_isCleared; 381 bool m_isCleared;
376 void clear(); 382 void clear();
377 383
378 // When the context goes away, there might still be some sources which 384 // When the context goes away, there might still be some sources which
379 // haven't finished playing. Make sure to release them here. 385 // haven't finished playing. Make sure to release them here.
380 void releaseActiveSourceNodes(); 386 void releaseActiveSourceNodes();
381 387
382 void removeFinishedSourceNodes(); 388 // Actually remove the nodes noted for deletion by
389 // releaseFinishedSourceNodes. Must be run from the main thread,
390 // and must not be run with the context lock.
391 void removeFinishedSourceNodesOnMainThread();
383 392
384 // Listener for the PannerNodes 393 // Listener for the PannerNodes
385 Member<AudioListener> m_listener; 394 Member<AudioListener> m_listener;
386 395
387 // Only accessed in the audio thread. 396 // Only accessed in the audio thread.
388 // These raw pointers are safe because AudioSourceNodes in 397 // These raw pointers are safe because AudioSourceNodes in
389 // m_activeSourceNodes own them. 398 // m_activeSourceNodes own them.
390 Vector<AudioHandler*> m_finishedSourceHandlers; 399 Vector<AudioHandler*> m_finishedSourceHandlers;
391 400
392 // List of source nodes. This is either accessed when the graph lock is 401 // List of source nodes. This is either accessed when the graph lock is
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 // It is somewhat arbitrary and could be increased if necessary. 465 // It is somewhat arbitrary and could be increased if necessary.
457 enum { MaxNumberOfChannels = 32 }; 466 enum { MaxNumberOfChannels = 32 };
458 467
459 Optional<AutoplayStatus> m_autoplayStatus; 468 Optional<AutoplayStatus> m_autoplayStatus;
460 AudioIOPosition m_outputPosition; 469 AudioIOPosition m_outputPosition;
461 }; 470 };
462 471
463 } // namespace blink 472 } // namespace blink
464 473
465 #endif // BaseAudioContext_h 474 #endif // BaseAudioContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698