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

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

Issue 393133003: Oilpan: WebAudio: Apply the weak HashMap pattern to remove an entry from AudioContext::m_dirtyAudio… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 // Called at the start of each render quantum. 134 // Called at the start of each render quantum.
135 void handlePreRenderTasks(); 135 void handlePreRenderTasks();
136 136
137 // Called at the end of each render quantum. 137 // Called at the end of each render quantum.
138 void handlePostRenderTasks(); 138 void handlePostRenderTasks();
139 139
140 // Called periodically at the end of each render quantum to dereference fini shed source nodes. 140 // Called periodically at the end of each render quantum to dereference fini shed source nodes.
141 void derefFinishedSourceNodes(); 141 void derefFinishedSourceNodes();
142 142
143 #if ENABLE(OILPAN)
144 void registerLiveAudioSummingJunction(AudioSummingJunction&);
145 #endif
143 // We schedule deletion of all marked nodes at the end of each realtime rend er quantum. 146 // We schedule deletion of all marked nodes at the end of each realtime rend er quantum.
144 void markForDeletion(AudioNode*); 147 void markForDeletion(AudioNode*);
145 void deleteMarkedNodes(); 148 void deleteMarkedNodes();
146 149
147 // AudioContext can pull node(s) at the end of each render quantum even when they are not connected to any downstream nodes. 150 // AudioContext can pull node(s) at the end of each render quantum even when they are not connected to any downstream nodes.
148 // These two methods are called by the nodes who want to add/remove themselv es into/from the automatic pull lists. 151 // These two methods are called by the nodes who want to add/remove themselv es into/from the automatic pull lists.
149 void addAutomaticPullNode(AudioNode*); 152 void addAutomaticPullNode(AudioNode*);
150 void removeAutomaticPullNode(AudioNode*); 153 void removeAutomaticPullNode(AudioNode*);
151 154
152 // Called right before handlePostRenderTasks() to handle nodes which need to be pulled even when they are not connected to anything. 155 // Called right before handlePostRenderTasks() to handle nodes which need to be pulled even when they are not connected to anything.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // Only accessed in the audio thread. 272 // Only accessed in the audio thread.
270 Vector<AudioNode*> m_finishedNodes; 273 Vector<AudioNode*> m_finishedNodes;
271 274
272 // List of source nodes. This is either accessed when the graph lock is 275 // List of source nodes. This is either accessed when the graph lock is
273 // held, or on the main thread when the audio thread has finished. 276 // held, or on the main thread when the audio thread has finished.
274 // This RefPtr is connection reference. We must call AudioNode:: 277 // This RefPtr is connection reference. We must call AudioNode::
275 // makeConnection() after ref(), and call AudioNode::breakConnection() 278 // makeConnection() after ref(), and call AudioNode::breakConnection()
276 // before deref(). 279 // before deref().
277 Vector<RefPtr<AudioNode> > m_referencedNodes; 280 Vector<RefPtr<AudioNode> > m_referencedNodes;
278 281
282 #if ENABLE(OILPAN)
283 class AudioSummingJunctionDisposer {
284 public:
285 explicit AudioSummingJunctionDisposer(AudioSummingJunction& junction) : m_junction(junction) { }
286 ~AudioSummingJunctionDisposer();
287
288 private:
289 AudioSummingJunction& m_junction;
290 };
291 HeapHashMap<WeakMember<AudioSummingJunction>, OwnPtr<AudioSummingJunctionDis poser> > m_liveAudioSummingJunctions;
292 #endif
279 // Accumulate nodes which need to be deleted here. 293 // Accumulate nodes which need to be deleted here.
280 // This is copied to m_nodesToDelete at the end of a render cycle in handleP ostRenderTasks(), where we're assured of a stable graph 294 // This is copied to m_nodesToDelete at the end of a render cycle in handleP ostRenderTasks(), where we're assured of a stable graph
281 // state which will have no references to any of the nodes in m_nodesToDelet e once the context lock is released 295 // state which will have no references to any of the nodes in m_nodesToDelet e once the context lock is released
282 // (when handlePostRenderTasks() has completed). 296 // (when handlePostRenderTasks() has completed).
283 Vector<AudioNode*> m_nodesMarkedForDeletion; 297 Vector<AudioNode*> m_nodesMarkedForDeletion;
284 298
285 // They will be scheduled for deletion (on the main thread) at the end of a render cycle (in realtime thread). 299 // They will be scheduled for deletion (on the main thread) at the end of a render cycle (in realtime thread).
286 Vector<AudioNode*> m_nodesToDelete; 300 Vector<AudioNode*> m_nodesToDelete;
287 bool m_isDeletionScheduled; 301 bool m_isDeletionScheduled;
288 302
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 AsyncAudioDecoder m_audioDecoder; 334 AsyncAudioDecoder m_audioDecoder;
321 335
322 // This is considering 32 is large enough for multiple channels audio. 336 // This is considering 32 is large enough for multiple channels audio.
323 // It is somewhat arbitrary and could be increased if necessary. 337 // It is somewhat arbitrary and could be increased if necessary.
324 enum { MaxNumberOfChannels = 32 }; 338 enum { MaxNumberOfChannels = 32 };
325 }; 339 };
326 340
327 } // WebCore 341 } // WebCore
328 342
329 #endif // AudioContext_h 343 #endif // AudioContext_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioContext.cpp » ('j') | Source/modules/webaudio/AudioContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698