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

Side by Side Diff: Source/modules/webaudio/AudioContext.h

Issue 445453006: Add comments to vectors/hash sets of raw pointers to on-heap objects used in webaudio/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioNodeInput.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 void derefNode(AudioNode*); 269 void derefNode(AudioNode*);
270 270
271 // When the context goes away, there might still be some sources which haven 't finished playing. 271 // When the context goes away, there might still be some sources which haven 't finished playing.
272 // Make sure to dereference them here. 272 // Make sure to dereference them here.
273 void derefUnfinishedSourceNodes(); 273 void derefUnfinishedSourceNodes();
274 274
275 RefPtrWillBeMember<AudioDestinationNode> m_destinationNode; 275 RefPtrWillBeMember<AudioDestinationNode> m_destinationNode;
276 RefPtrWillBeMember<AudioListener> m_listener; 276 RefPtrWillBeMember<AudioListener> m_listener;
277 277
278 // Only accessed in the audio thread. 278 // Only accessed in the audio thread.
279 // Oilpan: Since items are added to the vector by the audio thread (not regi stered to Oilpan),
280 // we cannot use a HeapVector.
279 Vector<AudioNode*> m_finishedNodes; 281 Vector<AudioNode*> m_finishedNodes;
280 282
281 // List of source nodes. This is either accessed when the graph lock is 283 // List of source nodes. This is either accessed when the graph lock is
282 // held, or on the main thread when the audio thread has finished. 284 // held, or on the main thread when the audio thread has finished.
283 // This RefPtr is connection reference. We must call AudioNode:: 285 // This RefPtr is connection reference. We must call AudioNode::
284 // makeConnection() after ref(), and call AudioNode::breakConnection() 286 // makeConnection() after ref(), and call AudioNode::breakConnection()
285 // before deref(). 287 // before deref().
286 // Oilpan: This Vector holds connection references. We must call 288 // Oilpan: This Vector holds connection references. We must call
287 // AudioNode::makeConnection when we add an AudioNode to this, and must call 289 // AudioNode::makeConnection when we add an AudioNode to this, and must call
288 // AudioNode::breakConnection() when we remove an AudioNode from this. 290 // AudioNode::breakConnection() when we remove an AudioNode from this.
(...skipping 21 matching lines...) Expand all
310 // The purpose of m_liveAudioSummingJunctions is to remove a dying 312 // The purpose of m_liveAudioSummingJunctions is to remove a dying
311 // AudioSummingJunction from m_dirtySummingJunctions. However we put all of 313 // AudioSummingJunction from m_dirtySummingJunctions. However we put all of
312 // AudioSummingJunction objects to m_liveAudioSummingJunctions to avoid 314 // AudioSummingJunction objects to m_liveAudioSummingJunctions to avoid
313 // concurrent access to m_liveAudioSummingJunctions. 315 // concurrent access to m_liveAudioSummingJunctions.
314 HeapHashMap<WeakMember<AudioSummingJunction>, OwnPtr<AudioSummingJunctionDis poser> > m_liveAudioSummingJunctions; 316 HeapHashMap<WeakMember<AudioSummingJunction>, OwnPtr<AudioSummingJunctionDis poser> > m_liveAudioSummingJunctions;
315 #else 317 #else
316 // Accumulate nodes which need to be deleted here. 318 // Accumulate nodes which need to be deleted here.
317 // This is copied to m_nodesToDelete at the end of a render cycle in handleP ostRenderTasks(), where we're assured of a stable graph 319 // This is copied to m_nodesToDelete at the end of a render cycle in handleP ostRenderTasks(), where we're assured of a stable graph
318 // state which will have no references to any of the nodes in m_nodesToDelet e once the context lock is released 320 // state which will have no references to any of the nodes in m_nodesToDelet e once the context lock is released
319 // (when handlePostRenderTasks() has completed). 321 // (when handlePostRenderTasks() has completed).
322 // Oilpan: Since items are added to the vector by the audio thread (not regi stered to Oilpan),
323 // we cannot use a HeapVector.
320 Vector<AudioNode*> m_nodesMarkedForDeletion; 324 Vector<AudioNode*> m_nodesMarkedForDeletion;
321 325
322 // They will be scheduled for deletion (on the main thread) at the end of a render cycle (in realtime thread). 326 // They will be scheduled for deletion (on the main thread) at the end of a render cycle (in realtime thread).
327 // Oilpan: Since items are added to the vector by the audio thread (not regi stered to Oilpan),
328 // we cannot use a HeapVector.
323 Vector<AudioNode*> m_nodesToDelete; 329 Vector<AudioNode*> m_nodesToDelete;
324 bool m_isDeletionScheduled; 330 bool m_isDeletionScheduled;
325 #endif 331 #endif
326 332
327 // These two HashSet must be accessed only when the graph lock is held. 333 // These two HashSet must be accessed only when the graph lock is held.
328 // Oilpan: These HashSet should be HeapHashSet<WeakMember<AudioNodeOutput>> 334 // Oilpan: These HashSet should be HeapHashSet<WeakMember<AudioNodeOutput>>
329 // ideally. But it's difficult to lock them correctly during GC. 335 // ideally. But it's difficult to lock them correctly during GC.
336 // Oilpan: Since items are added to these hash sets by the audio thread (not registered to Oilpan),
337 // we cannot use HeapHashSets.
330 HashSet<AudioSummingJunction*> m_dirtySummingJunctions; 338 HashSet<AudioSummingJunction*> m_dirtySummingJunctions;
331 HashSet<AudioNodeOutput*> m_dirtyAudioNodeOutputs; 339 HashSet<AudioNodeOutput*> m_dirtyAudioNodeOutputs;
332 void handleDirtyAudioSummingJunctions(); 340 void handleDirtyAudioSummingJunctions();
333 void handleDirtyAudioNodeOutputs(); 341 void handleDirtyAudioNodeOutputs();
334 342
335 // For the sake of thread safety, we maintain a seperate Vector of automatic pull nodes for rendering in m_renderingAutomaticPullNodes. 343 // For the sake of thread safety, we maintain a seperate Vector of automatic pull nodes for rendering in m_renderingAutomaticPullNodes.
336 // It will be copied from m_automaticPullNodes by updateAutomaticPullNodes() at the very start or end of the rendering quantum. 344 // It will be copied from m_automaticPullNodes by updateAutomaticPullNodes() at the very start or end of the rendering quantum.
345 // Oilpan: Since items are added to the vector/hash set by the audio thread (not registered to Oilpan),
346 // we cannot use a HeapVector/HeapHashSet.
337 HashSet<AudioNode*> m_automaticPullNodes; 347 HashSet<AudioNode*> m_automaticPullNodes;
338 Vector<AudioNode*> m_renderingAutomaticPullNodes; 348 Vector<AudioNode*> m_renderingAutomaticPullNodes;
339 // m_automaticPullNodesNeedUpdating keeps track if m_automaticPullNodes is m odified. 349 // m_automaticPullNodesNeedUpdating keeps track if m_automaticPullNodes is m odified.
340 bool m_automaticPullNodesNeedUpdating; 350 bool m_automaticPullNodesNeedUpdating;
341 void updateAutomaticPullNodes(); 351 void updateAutomaticPullNodes();
342 352
343 unsigned m_connectionCount; 353 unsigned m_connectionCount;
344 354
345 // Graph locking. 355 // Graph locking.
346 Mutex m_contextGraphMutex; 356 Mutex m_contextGraphMutex;
347 volatile ThreadIdentifier m_audioThread; 357 volatile ThreadIdentifier m_audioThread;
348 volatile ThreadIdentifier m_graphOwnerThread; // if the lock is held then th is is the thread which owns it, otherwise == UndefinedThreadIdentifier 358 volatile ThreadIdentifier m_graphOwnerThread; // if the lock is held then th is is the thread which owns it, otherwise == UndefinedThreadIdentifier
349 359
350 // Only accessed in the audio thread. 360 // Only accessed in the audio thread.
361 // Oilpan: Since items are added to these vectors by the audio thread (not r egistered to Oilpan),
362 // we cannot use HeapVectors.
351 Vector<AudioNode*> m_deferredBreakConnectionList; 363 Vector<AudioNode*> m_deferredBreakConnectionList;
352 Vector<AudioNode*> m_deferredFinishDerefList; 364 Vector<AudioNode*> m_deferredFinishDerefList;
353 365
354 RefPtrWillBeMember<AudioBuffer> m_renderTarget; 366 RefPtrWillBeMember<AudioBuffer> m_renderTarget;
355 367
356 bool m_isOfflineContext; 368 bool m_isOfflineContext;
357 369
358 AsyncAudioDecoder m_audioDecoder; 370 AsyncAudioDecoder m_audioDecoder;
359 371
360 // This is considering 32 is large enough for multiple channels audio. 372 // This is considering 32 is large enough for multiple channels audio.
361 // It is somewhat arbitrary and could be increased if necessary. 373 // It is somewhat arbitrary and could be increased if necessary.
362 enum { MaxNumberOfChannels = 32 }; 374 enum { MaxNumberOfChannels = 32 };
363 }; 375 };
364 376
365 } // namespace blink 377 } // namespace blink
366 378
367 #endif // AudioContext_h 379 #endif // AudioContext_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioNodeInput.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698