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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/public/platform/WebAudioDevice.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WebAudioLatencyHint_h
6 #define WebAudioLatencyHint_h
7
8 #include "public/platform/WebString.h"
9
10 namespace blink {
11
12 class WebAudioLatencyHint {
13 public:
14 enum AudioContextLatencyCategory {
15 kCategoryInteractive,
16 kCategoryBalanced,
17 kCategoryPlayback,
18 kCategoryExact
19 };
20
21 explicit WebAudioLatencyHint(const WebString& category) {
22 if (category == "interactive") {
23 m_category = kCategoryInteractive;
24 } else if (category == "balanced") {
25 m_category = kCategoryBalanced;
26 } else if (category == "playback") {
27 m_category = kCategoryPlayback;
28 } else {
29 NOTREACHED();
30 m_category = kCategoryInteractive;
31 }
32 }
33
34 explicit WebAudioLatencyHint(AudioContextLatencyCategory category)
35 : m_category(category), m_seconds(0) {}
36 explicit WebAudioLatencyHint(double seconds)
37 : m_category(kCategoryExact), m_seconds(seconds) {}
38
39 AudioContextLatencyCategory category() const { return m_category; }
40 double seconds() const {
41 DCHECK_EQ(m_category, kCategoryExact);
42 return m_seconds;
43 }
44
45 private:
46 AudioContextLatencyCategory m_category;
47 double m_seconds;
48 };
49
50 } // namespace blink
51
52 #endif
OLDNEW
« 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