From c80325e680fe9f818e4cf2d81ee6414f4e7455b5 Mon Sep 17 00:00:00 2001 From: Raymond Toy Date: Wed, 14 Sep 2016 11:44:57 -0700 Subject: [PATCH] Fix #948: Move close() to AudioContext Having close() be in BaseAudioContext is a little confusing because you can't close an OfflineAudioContext. Move close() to the AudioContext instead. --- index.html | 149 ++++++++++++++++++++++++++--------------------------- 1 file changed, 72 insertions(+), 77 deletions(-) diff --git a/index.html b/index.html index 6a3a159f7..b9ca0c86a 100644 --- a/index.html +++ b/index.html @@ -1060,83 +1060,6 @@

-
- Promise<void> close() -
-
-

- Closes the BaseAudioContext, releasing the system - resources it's using. This will not automatically release all - AudioContext-created objects, but will suspend the - progression of the AudioContext's currentTime, and stop - processing audio data. -

-

- When close is called, execute these - steps: -

-
    -
  1. Let promise be a new Promise. -
  2. -
  3. If this BaseAudioContext is an - OfflineAudioContext, reject promise with - NotSupportedError, return it, and abort these steps. -
  4. -
  5. If the control thread state flag on the - AudioContext is closed reject the promise - with InvalidStateError, abort these steps, returning - promise. -
  6. -
  7. If the state attribute - of the AudioContext is already closed, - resolve promise, return it, and abort these steps. -
  8. -
  9. Set the control thread state flag on the - AudioContext to closed. -
  10. -
  11. - Queue a control message to the - AudioContext. -
  12. -
  13. Return promise. -
  14. -
-

- Running a control message to close an - BaseAudioContext means running these steps on the - rendering thread: -

-
    -
  1. Attempt to release system resources. -
  2. -
  3. Queue a task on the control thread's event loop, to - execute these steps: -
      -
    1. Resolve promise. -
    2. -
    3. If the state - attribute of the AudioContext is not already - closed: -
        -
      1. Set the state - attribute of the AudioContext to - closed. -
      2. -
      3. Queue a task to fire a simple event named - statechange at the AudioContext -
      4. -
      -
    4. -
    -
  4. -
-

- When an BaseAudioContext has been closed, implementation - can choose to aggressively release more resources than when - suspending. -

-
attribute EventHandler onstatechange
@@ -1879,6 +1802,78 @@

attribute should be used instead.

+
+ Promise<void> close() +
+
+

+ Closes the AudioContext, releasing the system + resources it's using. This will not automatically release all + AudioContext-created objects, but will suspend the + progression of the AudioContext's currentTime, and stop + processing audio data. +

+

+ When close is called, execute these + steps: +

+
    +
  1. Let promise be a new Promise. +
  2. +
  3. If the control thread state flag on the + AudioContext is closed reject the promise + with InvalidStateError, abort these steps, returning + promise. +
  4. +
  5. If the state attribute + of the AudioContext is already closed, + resolve promise, return it, and abort these steps. +
  6. +
  7. Set the control thread state flag on the + AudioContext to closed. +
  8. +
  9. + Queue a control message to the + AudioContext. +
  10. +
  11. Return promise. +
  12. +
+

+ Running a control message to close an AudioContext + means running these steps on the rendering thread: +

+
    +
  1. Attempt to release system resources. +
  2. +
  3. Queue a task on the control thread's event loop, to + execute these steps: +
      +
    1. Resolve promise. +
    2. +
    3. If the state + attribute of the AudioContext is not already + closed: +
        +
      1. Set the state + attribute of the AudioContext to + closed. +
      2. +
      3. Queue a task to fire a simple event named + statechange at the AudioContext +
      4. +
      +
    4. +
    +
  4. +
+

+ When an AudioContext has been closed, implementation can + choose to aggressively release more resources than when + suspending. +

+
MediaElementAudioSourceNode createMediaElementSource()