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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 // Handle Promises for resume() and suspend() | 311 // Handle Promises for resume() and suspend() |
312 void resolvePromisesForResume(); | 312 void resolvePromisesForResume(); |
313 void resolvePromisesForResumeOnMainThread(); | 313 void resolvePromisesForResumeOnMainThread(); |
314 | 314 |
315 void resolvePromisesForSuspend(); | 315 void resolvePromisesForSuspend(); |
316 void resolvePromisesForSuspendOnMainThread(); | 316 void resolvePromisesForSuspendOnMainThread(); |
317 | 317 |
318 // Vector of promises created by resume(). It takes time to handle them, so
we collect all of | 318 // Vector of promises created by resume(). It takes time to handle them, so
we collect all of |
319 // the promises here until they can be resolved or rejected. | 319 // the promises here until they can be resolved or rejected. |
320 WillBeHeapVector<RefPtrWillBeMember<ScriptPromiseResolver> > m_resumeResolve
rs; | 320 WillBeHeapVector<RefPtrWillBeMember<ScriptPromiseResolver>> m_resumeResolver
s; |
321 // Like m_resumeResolvers but for suspend(). | 321 // Like m_resumeResolvers but for suspend(). |
322 WillBeHeapVector<RefPtrWillBeMember<ScriptPromiseResolver> > m_suspendResolv
ers; | 322 WillBeHeapVector<RefPtrWillBeMember<ScriptPromiseResolver>> m_suspendResolve
rs; |
323 void rejectPendingResolvers(); | 323 void rejectPendingResolvers(); |
324 | 324 |
325 // True if we're in the process of resolving promises for resume(). Resolvi
ng can take some | 325 // True if we're in the process of resolving promises for resume(). Resolvi
ng can take some |
326 // time and the audio context process loop is very fast, so we don't want to
call resolve an | 326 // time and the audio context process loop is very fast, so we don't want to
call resolve an |
327 // excessive number of times. | 327 // excessive number of times. |
328 bool m_isResolvingResumePromises; | 328 bool m_isResolvingResumePromises; |
329 | 329 |
330 class AudioNodeDisposer { | 330 class AudioNodeDisposer { |
331 public: | 331 public: |
332 explicit AudioNodeDisposer(AudioNode& node) : m_node(node) { } | 332 explicit AudioNodeDisposer(AudioNode& node) : m_node(node) { } |
333 ~AudioNodeDisposer(); | 333 ~AudioNodeDisposer(); |
334 | 334 |
335 private: | 335 private: |
336 AudioNode& m_node; | 336 AudioNode& m_node; |
337 }; | 337 }; |
338 HeapHashMap<WeakMember<AudioNode>, OwnPtr<AudioNodeDisposer> > m_liveNodes; | 338 HeapHashMap<WeakMember<AudioNode>, OwnPtr<AudioNodeDisposer>> m_liveNodes; |
339 | 339 |
340 class AudioSummingJunctionDisposer { | 340 class AudioSummingJunctionDisposer { |
341 public: | 341 public: |
342 explicit AudioSummingJunctionDisposer(AudioSummingJunction& junction) :
m_junction(junction) { } | 342 explicit AudioSummingJunctionDisposer(AudioSummingJunction& junction) :
m_junction(junction) { } |
343 ~AudioSummingJunctionDisposer(); | 343 ~AudioSummingJunctionDisposer(); |
344 | 344 |
345 private: | 345 private: |
346 AudioSummingJunction& m_junction; | 346 AudioSummingJunction& m_junction; |
347 }; | 347 }; |
348 // The purpose of m_liveAudioSummingJunctions is to remove a dying | 348 // The purpose of m_liveAudioSummingJunctions is to remove a dying |
349 // AudioSummingJunction from m_dirtySummingJunctions. However we put all of | 349 // AudioSummingJunction from m_dirtySummingJunctions. However we put all of |
350 // AudioSummingJunction objects to m_liveAudioSummingJunctions to avoid | 350 // AudioSummingJunction objects to m_liveAudioSummingJunctions to avoid |
351 // concurrent access to m_liveAudioSummingJunctions. | 351 // concurrent access to m_liveAudioSummingJunctions. |
352 HeapHashMap<WeakMember<AudioSummingJunction>, OwnPtr<AudioSummingJunctionDis
poser> > m_liveAudioSummingJunctions; | 352 HeapHashMap<WeakMember<AudioSummingJunction>, OwnPtr<AudioSummingJunctionDis
poser>> m_liveAudioSummingJunctions; |
353 | 353 |
354 // These two HashSet must be accessed only when the graph lock is held. | 354 // These two HashSet must be accessed only when the graph lock is held. |
355 // Oilpan: These HashSet should be HeapHashSet<WeakMember<AudioNodeOutput>> | 355 // Oilpan: These HashSet should be HeapHashSet<WeakMember<AudioNodeOutput>> |
356 // ideally. But it's difficult to lock them correctly during GC. | 356 // ideally. But it's difficult to lock them correctly during GC. |
357 // Oilpan: Since items are added to these hash sets by the audio thread (not
registered to Oilpan), | 357 // Oilpan: Since items are added to these hash sets by the audio thread (not
registered to Oilpan), |
358 // we cannot use HeapHashSets. | 358 // we cannot use HeapHashSets. |
359 GC_PLUGIN_IGNORE("http://crbug.com/404527") | 359 GC_PLUGIN_IGNORE("http://crbug.com/404527") |
360 HashSet<AudioSummingJunction*> m_dirtySummingJunctions; | 360 HashSet<AudioSummingJunction*> m_dirtySummingJunctions; |
361 GC_PLUGIN_IGNORE("http://crbug.com/404527") | 361 GC_PLUGIN_IGNORE("http://crbug.com/404527") |
362 HashSet<AudioNodeOutput*> m_dirtyAudioNodeOutputs; | 362 HashSet<AudioNodeOutput*> m_dirtyAudioNodeOutputs; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 size_t m_cachedSampleFrame; | 406 size_t m_cachedSampleFrame; |
407 | 407 |
408 // This is considering 32 is large enough for multiple channels audio. | 408 // This is considering 32 is large enough for multiple channels audio. |
409 // It is somewhat arbitrary and could be increased if necessary. | 409 // It is somewhat arbitrary and could be increased if necessary. |
410 enum { MaxNumberOfChannels = 32 }; | 410 enum { MaxNumberOfChannels = 32 }; |
411 }; | 411 }; |
412 | 412 |
413 } // namespace blink | 413 } // namespace blink |
414 | 414 |
415 #endif // AudioContext_h | 415 #endif // AudioContext_h |
OLD | NEW |