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