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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 // The main thread controls m_activeSourceNodes, all updates and additions | 446 // The main thread controls m_activeSourceNodes, all updates and additions |
447 // are performed by it. When the audio thread marks a source node as finished, | 447 // are performed by it. When the audio thread marks a source node as finished, |
448 // the nodes are added to |m_finishedSourceNodes| and scheduled for removal | 448 // the nodes are added to |m_finishedSourceNodes| and scheduled for removal |
449 // from |m_activeSourceNodes| by the main thread. | 449 // from |m_activeSourceNodes| by the main thread. |
450 HashSet<UntracedMember<AudioNode>> finished_source_nodes_; | 450 HashSet<UntracedMember<AudioNode>> finished_source_nodes_; |
451 | 451 |
452 // FIXME(dominicc): Move these to AudioContext because only | 452 // FIXME(dominicc): Move these to AudioContext because only |
453 // it creates these Promises. | 453 // it creates these Promises. |
454 // Handle Promises for resume() and suspend() | 454 // Handle Promises for resume() and suspend() |
455 void ResolvePromisesForResume(); | 455 void ResolvePromisesForResume(); |
456 void ResolvePromisesForResumeOnMainThread(); | 456 |
| 457 void PerformCleanupOnMainThread(); |
| 458 void ScheduleMainThreadCleanup(); |
457 | 459 |
458 // When the context is going away, reject any pending script promise | 460 // When the context is going away, reject any pending script promise |
459 // resolvers. | 461 // resolvers. |
460 virtual void RejectPendingResolvers(); | 462 virtual void RejectPendingResolvers(); |
461 | 463 |
462 // Record the current autoplay status and clear it. | 464 // Record the current autoplay status and clear it. |
463 void RecordAutoplayStatus(); | 465 void RecordAutoplayStatus(); |
464 | 466 |
465 // True if we're in the process of resolving promises for resume(). Resolving | 467 // True if we're in the process of resolving promises for resume(). Resolving |
466 // can take some time and the audio context process loop is very fast, so we | 468 // can take some time and the audio context process loop is very fast, so we |
467 // don't want to call resolve an excessive number of times. | 469 // don't want to call resolve an excessive number of times. |
468 bool is_resolving_resume_promises_; | 470 bool is_resolving_resume_promises_; |
469 | 471 |
| 472 // Set to |true| by the audio thread when it posts a main-thread task to |
| 473 // perform delayed state sync'ing updates that needs to be done on the main |
| 474 // thread. Cleared by the main thread task once it has run. |
| 475 bool has_posted_cleanup_task_; |
| 476 |
470 // Whether a user gesture is required to start this AudioContext. | 477 // Whether a user gesture is required to start this AudioContext. |
471 bool user_gesture_required_; | 478 bool user_gesture_required_; |
472 | 479 |
473 unsigned connection_count_; | 480 unsigned connection_count_; |
474 | 481 |
475 // Graph locking. | 482 // Graph locking. |
476 RefPtr<DeferredTaskHandler> deferred_task_handler_; | 483 RefPtr<DeferredTaskHandler> deferred_task_handler_; |
477 | 484 |
478 // The state of the BaseAudioContext. | 485 // The state of the BaseAudioContext. |
479 AudioContextState context_state_; | 486 AudioContextState context_state_; |
(...skipping 28 matching lines...) Expand all Loading... |
508 // It is somewhat arbitrary and could be increased if necessary. | 515 // It is somewhat arbitrary and could be increased if necessary. |
509 enum { kMaxNumberOfChannels = 32 }; | 516 enum { kMaxNumberOfChannels = 32 }; |
510 | 517 |
511 Optional<AutoplayStatus> autoplay_status_; | 518 Optional<AutoplayStatus> autoplay_status_; |
512 AudioIOPosition output_position_; | 519 AudioIOPosition output_position_; |
513 }; | 520 }; |
514 | 521 |
515 } // namespace blink | 522 } // namespace blink |
516 | 523 |
517 #endif // BaseAudioContext_h | 524 #endif // BaseAudioContext_h |
OLD | NEW |