| Index: third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
|
| diff --git a/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
|
| index 920678225ca55b9c22d8908fa4de6b3d7bce0f17..623482ff14f2f9da5b43f1d2c99fa078613008ac 100644
|
| --- a/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
|
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
|
| @@ -11,8 +11,10 @@
|
| #include "core/dom/ExceptionCode.h"
|
| #include "core/frame/UseCounter.h"
|
| #include "modules/webaudio/AudioBufferCallback.h"
|
| +#include "modules/webaudio/AudioContextOptions.h"
|
| #include "platform/Histogram.h"
|
| #include "platform/audio/AudioUtilities.h"
|
| +#include "public/platform/WebAudioLatencyHint.h"
|
|
|
| #if DEBUG_AUDIONODE_REFERENCES
|
| #include <stdio.h>
|
| @@ -27,6 +29,26 @@ static unsigned s_hardwareContextCount = 0;
|
| static unsigned s_contextId = 0;
|
|
|
| AudioContext* AudioContext::create(Document& document,
|
| + const AudioContextOptions& contextOptions,
|
| + ExceptionState& exceptionState) {
|
| + WebAudioLatencyHint::Category latencyCategory;
|
| + if (contextOptions.latencyHint() == "interactive") {
|
| + latencyCategory = WebAudioLatencyHint::CategoryInteractive;
|
| + } else if (contextOptions.latencyHint() == "balanced") {
|
| + latencyCategory = WebAudioLatencyHint::CategoryBalanced;
|
| + } else if (contextOptions.latencyHint() == "playback") {
|
| + latencyCategory = WebAudioLatencyHint::CategoryPlayback;
|
| + } else {
|
| + NOTREACHED();
|
| + latencyCategory = WebAudioLatencyHint::CategoryInteractive;
|
| + }
|
| +
|
| + WebAudioLatencyHint latencyHint(latencyCategory);
|
| + return AudioContext::create(document, latencyHint, exceptionState);
|
| +}
|
| +
|
| +AudioContext* AudioContext::create(Document& document,
|
| + const WebAudioLatencyHint& latencyHint,
|
| ExceptionState& exceptionState) {
|
| DCHECK(isMainThread());
|
|
|
| @@ -41,7 +63,7 @@ AudioContext* AudioContext::create(Document& document,
|
| return nullptr;
|
| }
|
|
|
| - AudioContext* audioContext = new AudioContext(document);
|
| + AudioContext* audioContext = new AudioContext(document, latencyHint);
|
| audioContext->suspendIfNeeded();
|
|
|
| if (!AudioUtilities::isValidAudioBufferSampleRate(
|
| @@ -83,8 +105,9 @@ AudioContext* AudioContext::create(Document& document,
|
| return audioContext;
|
| }
|
|
|
| -AudioContext::AudioContext(Document& document)
|
| - : BaseAudioContext(&document), m_contextId(s_contextId++) {}
|
| +AudioContext::AudioContext(Document& document,
|
| + const WebAudioLatencyHint& latencyHint)
|
| + : BaseAudioContext(&document, latencyHint), m_contextId(s_contextId++) {}
|
|
|
| AudioContext::~AudioContext() {
|
| #if DEBUG_AUDIONODE_REFERENCES
|
|
|