Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(853)

Unified Diff: third_party/WebKit/public/platform/WebAudioLatencyHint.h

Issue 2501863003: Support for AudioContextOptions latencyHint. (Closed)
Patch Set: Fixes to WebAudioDeviceImpl unit test. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/public/platform/WebAudioDevice.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f1db4040a75f59810494e0719db37eaf394c4264
--- /dev/null
+++ b/third_party/WebKit/public/platform/WebAudioLatencyHint.h
@@ -0,0 +1,52 @@
+// Copyright 2017 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 WebAudioLatencyHint_h
+#define WebAudioLatencyHint_h
+
+#include "public/platform/WebString.h"
+
+namespace blink {
+
+class WebAudioLatencyHint {
+ public:
+ enum AudioContextLatencyCategory {
+ kCategoryInteractive,
+ kCategoryBalanced,
+ kCategoryPlayback,
+ kCategoryExact
+ };
+
+ explicit WebAudioLatencyHint(const WebString& category) {
+ 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
« no previous file with comments | « third_party/WebKit/public/platform/WebAudioDevice.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698