OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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 "WebString.h" | |
9 | |
10 namespace blink { | |
11 | |
12 class WebAudioLatencyHint { | |
13 public: | |
14 enum Category { | |
Raymond Toy
2016/12/13 15:53:11
Category seems a bit terse. Maybe AudioLatencyCat
Andrew MacPherson
2016/12/14 09:07:20
Done, with AudioContextLatencyCategory.
| |
15 CategoryInteractive, | |
16 CategoryBalanced, | |
17 CategoryPlayback, | |
18 CategoryExact | |
19 }; | |
Raymond Toy
2016/12/13 15:53:11
https://www.chromium.org/blink/coding-style, item
Andrew MacPherson
2016/12/14 09:07:20
Done.
| |
20 | |
21 explicit WebAudioLatencyHint(WebString category) { | |
22 if (category == "interactive") { | |
23 m_category = CategoryInteractive; | |
24 } else if (category == "balanced") { | |
25 m_category = CategoryBalanced; | |
26 } else if (category == "playback") { | |
27 m_category = CategoryPlayback; | |
28 } else { | |
Raymond Toy
2016/12/13 15:53:11
I think you need a case for category == CategoryEx
Andrew MacPherson
2016/12/14 09:07:20
Should it be possible to create a WebAudioLatencyH
Raymond Toy
2016/12/14 18:23:32
Sorry, you're right. It shouldn't be possible, and
| |
29 NOTREACHED(); | |
30 m_category = CategoryInteractive; | |
31 } | |
32 } | |
33 | |
34 explicit WebAudioLatencyHint(Category category) | |
35 : m_category(category), m_seconds(0) {} | |
36 explicit WebAudioLatencyHint(double seconds) | |
37 : m_category(CategoryExact), m_seconds(seconds) {} | |
38 | |
39 Category category() const { return m_category; } | |
40 double seconds() const { return m_seconds; } | |
Raymond Toy
2016/12/13 15:53:11
Should there be asserts here so that you only ask
Andrew MacPherson
2016/12/14 09:07:20
Done.
| |
41 | |
42 private: | |
43 Category m_category; | |
44 double m_seconds; | |
45 }; | |
46 | |
47 } // namespace blink | |
48 | |
49 #endif | |
OLD | NEW |