| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef AudioContext_h | 5 #ifndef AudioContext_h |
| 6 #define AudioContext_h | 6 #define AudioContext_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "modules/webaudio/AbstractAudioContext.h" | 10 #include "modules/webaudio/BaseAudioContext.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class Document; | 15 class Document; |
| 16 class ExceptionState; | 16 class ExceptionState; |
| 17 class HTMLMediaElement; |
| 18 class MediaElementAudioSourceNode; |
| 19 class MediaStreamAudioDestinationNode; |
| 20 class MediaStreamAudioSourceNode; |
| 17 class ScriptState; | 21 class ScriptState; |
| 18 | 22 |
| 19 // This is an AbstractAudioContext which actually plays sound, unlike an | 23 // This is an BaseAudioContext which actually plays sound, unlike an |
| 20 // OfflineAudioContext which renders sound into a buffer. | 24 // OfflineAudioContext which renders sound into a buffer. |
| 21 class AudioContext : public AbstractAudioContext { | 25 class AudioContext : public BaseAudioContext { |
| 26 DEFINE_WRAPPERTYPEINFO(); |
| 22 public: | 27 public: |
| 23 static AbstractAudioContext* create(Document&, ExceptionState&); | 28 static AudioContext* create(Document&, ExceptionState&); |
| 24 | 29 |
| 25 ~AudioContext() override; | 30 ~AudioContext() override; |
| 26 DECLARE_VIRTUAL_TRACE(); | 31 DECLARE_VIRTUAL_TRACE(); |
| 27 | 32 |
| 33 MediaElementAudioSourceNode* createMediaElementSource(HTMLMediaElement*, Exc
eptionState&); |
| 34 MediaStreamAudioSourceNode* createMediaStreamSource(MediaStream*, ExceptionS
tate&); |
| 35 MediaStreamAudioDestinationNode* createMediaStreamDestination(ExceptionState
&); |
| 36 |
| 37 |
| 28 ScriptPromise closeContext(ScriptState*) final; | 38 ScriptPromise closeContext(ScriptState*) final; |
| 29 bool isContextClosed() const final; | 39 bool isContextClosed() const final; |
| 30 | 40 |
| 31 ScriptPromise suspendContext(ScriptState*) final; | 41 ScriptPromise suspendContext(ScriptState*) final; |
| 32 ScriptPromise resumeContext(ScriptState*) final; | 42 ScriptPromise resumeContext(ScriptState*) final; |
| 33 | 43 |
| 34 bool hasRealtimeConstraint() final { return true; } | 44 bool hasRealtimeConstraint() final { return true; } |
| 35 | 45 |
| 36 protected: | 46 protected: |
| 37 AudioContext(Document&); | 47 AudioContext(Document&); |
| 38 | 48 |
| 39 void didClose() final; | 49 void didClose() final; |
| 40 | 50 |
| 41 private: | 51 private: |
| 42 void stopRendering(); | 52 void stopRendering(); |
| 43 | 53 |
| 44 unsigned m_contextId; | 54 unsigned m_contextId; |
| 45 Member<ScriptPromiseResolver> m_closeResolver; | 55 Member<ScriptPromiseResolver> m_closeResolver; |
| 46 }; | 56 }; |
| 47 | 57 |
| 48 } // namespace blink | 58 } // namespace blink |
| 49 | 59 |
| 50 #endif // AudioContext_h | 60 #endif // AudioContext_h |
| OLD | NEW |