Chromium Code Reviews| Index: third_party/WebKit/public/platform/WebAudioLatencyHint.h |
| diff --git a/third_party/WebKit/public/platform/WebAudioLatencyHint.h b/third_party/WebKit/public/platform/WebAudioLatencyHint.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1eac3b87fbc5552c7e18d6332535809159c02546 |
| --- /dev/null |
| +++ b/third_party/WebKit/public/platform/WebAudioLatencyHint.h |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
|
tkent
2017/02/08 22:38:46
2016 -> 2017
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef WebAudioLatencyHint_h |
| +#define WebAudioLatencyHint_h |
| + |
| +#include "WebString.h" |
|
tkent
2017/02/08 22:38:46
WebString.h -> public/platform/WebString.h
|
| + |
| +namespace blink { |
| + |
| +class WebAudioLatencyHint { |
| + public: |
| + enum AudioContextLatencyCategory { |
| + kCategoryInteractive, |
| + kCategoryBalanced, |
| + kCategoryPlayback, |
| + kCategoryExact |
| + }; |
| + |
| + explicit WebAudioLatencyHint(WebString category) { |
|
tkent
2017/02/08 22:38:46
WebString -> const WebString&
|
| + if (category == "interactive") { |
| + m_category = kCategoryInteractive; |
| + } else if (category == "balanced") { |
| + m_category = kCategoryBalanced; |
| + } else if (category == "playback") { |
| + m_category = kCategoryPlayback; |
| + } else { |
| + NOTREACHED(); |
| + m_category = kCategoryInteractive; |
| + } |
| + } |
| + |
| + explicit WebAudioLatencyHint(AudioContextLatencyCategory category) |
| + : m_category(category), m_seconds(0) {} |
| + explicit WebAudioLatencyHint(double seconds) |
| + : m_category(kCategoryExact), m_seconds(seconds) {} |
| + |
| + AudioContextLatencyCategory category() const { return m_category; } |
| + double seconds() const { |
| + DCHECK_EQ(m_category, kCategoryExact); |
| + return m_seconds; |
| + } |
| + |
| + private: |
| + AudioContextLatencyCategory m_category; |
| + double m_seconds; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif |